Project

General

Profile

Installing Wt on Mac OS X Yosemite » History » Version 2

Kevin Patterson, 03/06/2015 05:41 PM

1 1 Kevin Patterson
h1. Installing Wt on Mac OS X Yosemite (macosx 10.10)
2
3
{{toc}}
4
5 2 Kevin Patterson
The following are installation instructions for installing Wt (from source) on OS X 10.10 "Yosemite", using Homebrew to install dependencies. The build toolchain on macosx Yosemite is based on CLang and libc++, and requires the installation of Xcode and the Xcode Command-Line tools.
6 1 Kevin Patterson
7
h2. Requirements 
8
9
* Get Xcode from the Apple App Store
10
* Install the Xcode Command-Line Tools from within Xcode or from the command-line
11
* Install "Homebrew":http://brew.sh
12
13
h2. Preparation 
14
15
h3. Install Dependencies
16
17 2 Kevin Patterson
This guide relies on the excellent "Homebrew":http://brew.sh package manager, which facilitates the fast and easy installation of many popular packages and their dependencies on macosx. We will use Homebrew to install the dependencies that Wt requires, as well as additional packages that enable optional features in Wt.
18 1 Kevin Patterson
19
For this tutorial, we we be enabling the following features:
20
* HTTPS (SSL)
21
* FastCGI
22
* MySQL
23
* Graphics drawing
24
* PDF Generation
25
26
If you haven't installed Homebrew already, it's very easy to do using the following command in Terminal:
27
<pre>
28
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
29
</pre>
30
31
With Homebrew installed, let's install the base dependencies for Wt:
32
<pre>
33
$ brew install cmake
34
$ brew install boost
35
</pre>
36
37
If you want FastCGI support:
38
<pre>
39
$ brew install fcgi
40
</pre>
41
42
If you want SSL (HTTPS) support in Wt's built-in web server:
43
<pre>
44
$ brew install openssl
45
</pre>
46
47
Support for MySQL:
48
<pre>
49
$ brew install mysql-connector-c
50
</pre>
51
52
Graphics drawing support:
53
<pre>
54
$ brew install libpng
55
$ brew install libtiff
56
$ brew install libharu
57
$ brew install GraphicsMagick
58
</pre>
59
60
PDF generation:
61
<pre>
62
$ brew install pango
63
</pre>
64
65
*NOTE: Homebrew detects existing packages on your system, and be default will not overwrite existing packages when installing new ones. Please pay attention to the messages displayed during the brew process. Mac OS X includes a few packages that conflict (harmlessly) with some of the packages we are installing (e.g. OpenSSL). When an a package already exists on your system, Homebrew will place the new package in a different location, and notify you during the install. In the Wt configuration process, I have modified some of the library prefixes passed to cmake to point to these alternate locations for the affected libraries installed by brew.*
66
67
h2. Building Wt 
68
69
At the time of this writing, you'll need to download the latest version of Wt using git, in order to support Boost version 1.57 installed by brew:
70
<pre>
71
$ git clone git://github.com/kdeforche/wt.git
72
</pre>
73
74
To build Wt, do the following:
75
76
<pre>
77
$ cd wt
78
$ mkdir build
79
$ cd build
80
$ cmake \
81
     -DSSL_PREFIX=/usr/local/Cellar/openssl/1.0.2 \
82
     -DMYSQL_LIBRARY=mysqlclient -DMYSQL_PREFIX=/usr/local/Cellar/mysql-connector-c/6.1.3 \
83
     -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick -DGM_PREFIX=/usr/local \
84
     -DCMAKE_CXX_FLAGS='-stdlib=libc++' -DCMAKE_EXE_LINKER_FLAGS='-stdlib=libc++' -DCMAKE_MODULE_LINKER_FLAGS='-stdlib=libc++' -DWT_CPP_11_MODE='-std=c++11' \
85
     ../
86
$ make
87
$ make -C examples # to build the examples
88
$ sudo make install
89
</pre>
90
91
You may receive warnings that not all features will be built, but Wt doesn't require those. You can of course install other dependencies too using brew.
92
93
If you know how to get Wt's OpenGL support built under macosx, please contact me at _kevpatt~at~khptech.com_
94
95
h2.
96
97
To run the examples, please see the "generic installation instructions":http://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html#examples.
98
99
Here's how to compile and run the "Hello World" sample application from the "Wt Online Tutorial":http://www.webtoolkit.eu/wt/doc/tutorial/wt.html
100
101
Assuming the code for "Hello World" has been saved in source file named "hello.cc":
102
<pre>
103
$ c++ -o hello hello.cc -lwthttp -lwt -I/usr/local/include -L/usr/local/lib
104
$ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090
105
</pre>