Installing Wt on Mac OS X Yosemite » History » Version 22
Kevin Patterson, 07/11/2016 07:35 PM
1 | 22 | Kevin Patterson | h1. Installing Wt on Mac OS X Yosemite or El Capitan (macosx 10.10-10.11+) |
---|---|---|---|
2 | 1 | Kevin Patterson | |
3 | {{toc}} |
||
4 | |||
5 | 22 | Kevin Patterson | The following are installation instructions for installing Wt (from source) on OS X 10.10 "Yosemite", using Homebrew to install dependencies. These instructions have also been tested and found to work on OS X 10.11 "El Capitan". 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 | 15 | Kevin Patterson | * Xcode (free download from the Apple App Store) |
10 | * Xcode Command-Line Tools (installed from within Xcode or from the command line) |
||
11 | * "Homebrew":http://brew.sh |
||
12 | 1 | Kevin Patterson | |
13 | h2. Preparation |
||
14 | |||
15 | 13 | Kevin Patterson | h3. Get Homebrew |
16 | 1 | Kevin Patterson | |
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 | 4 | Kevin Patterson | If you haven't installed Homebrew already, it's very easy to do using the following command in Terminal: |
20 | 1 | Kevin Patterson | <pre> |
21 | $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
||
22 | </pre> |
||
23 | |||
24 | 13 | Kevin Patterson | h3. Install Base Dependencies |
25 | |||
26 | 1 | Kevin Patterson | With Homebrew installed, let's install the base dependencies for Wt: |
27 | <pre> |
||
28 | $ brew install cmake |
||
29 | $ brew install boost |
||
30 | </pre> |
||
31 | |||
32 | 13 | Kevin Patterson | h3. Install Additional Dependencies |
33 | |||
34 | For this guide, we we be enabling the following optional features in Wt: |
||
35 | * HTTPS (SSL) |
||
36 | * FastCGI |
||
37 | * MySQL |
||
38 | * Graphics drawing and PDF Generation |
||
39 | |||
40 | 1 | Kevin Patterson | If you want FastCGI support: |
41 | <pre> |
||
42 | $ brew install fcgi |
||
43 | </pre> |
||
44 | |||
45 | If you want SSL (HTTPS) support in Wt's built-in web server: |
||
46 | <pre> |
||
47 | $ brew install openssl |
||
48 | </pre> |
||
49 | |||
50 | 13 | Kevin Patterson | If you want support for MySQL: |
51 | 1 | Kevin Patterson | <pre> |
52 | $ brew install mysql-connector-c |
||
53 | </pre> |
||
54 | |||
55 | 13 | Kevin Patterson | If you want graphics drawing and PDF generation support: |
56 | 1 | Kevin Patterson | <pre> |
57 | $ brew install libpng |
||
58 | $ brew install libtiff |
||
59 | $ brew install libharu |
||
60 | $ brew install pango |
||
61 | 4 | Kevin Patterson | $ brew install GraphicsMagick |
62 | 1 | Kevin Patterson | </pre> |
63 | |||
64 | 18 | Kevin Patterson | *NOTE:* _Homebrew detects existing packages on your system, and by 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 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._ |
65 | 1 | Kevin Patterson | |
66 | 12 | Kevin Patterson | h3. Download Wt |
67 | 1 | Kevin Patterson | |
68 | 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: |
||
69 | <pre> |
||
70 | $ git clone git://github.com/kdeforche/wt.git |
||
71 | </pre> |
||
72 | |||
73 | h2. Building Wt |
||
74 | 16 | Kevin Patterson | |
75 | 17 | Kevin Patterson | *NOTE:* _Please notice the lines related to MySQL, GraphicsMagick, and OpenSSL passed to cmake below. Make sure the paths (and version numbers) match those reported by the brew installation of these packages on your system._ |
76 | 1 | Kevin Patterson | |
77 | 12 | Kevin Patterson | To build Wt, do the following: |
78 | 1 | Kevin Patterson | <pre> |
79 | $ cd wt |
||
80 | $ mkdir build |
||
81 | $ cd build |
||
82 | 22 | Kevin Patterson | $ cmake \ |
83 | -DCMAKE_CXX_FLAGS='-stdlib=libc++' \ |
||
84 | -DCMAKE_EXE_LINKER_FLAGS='-stdlib=libc++' \ |
||
85 | -DCMAKE_MODULE_LINKER_FLAGS='-stdlib=libc++' \ |
||
86 | -DWT_CPP_11_MODE='-std=c++11' \ |
||
87 | -DMYSQL_LIBRARY=mysqlclient -DMYSQL_PREFIX=/usr/local/Cellar/mysql-connector-c/6.1.6 \ |
||
88 | -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick -DGM_PREFIX=/usr/local \ |
||
89 | -DSSL_PREFIX=/usr/local/Cellar/openssl/1.0.2h_1 ../ |
||
90 | $ make -j4 # set -jN to your number of CPU cores for a faster parallel build |
||
91 | 1 | Kevin Patterson | $ make -C examples # to build the examples |
92 | $ sudo make install |
||
93 | </pre> |
||
94 | |||
95 | 18 | Kevin Patterson | You may receive warnings that not all features will be built, but Wt doesn't require them. To enable additional features, you can install the additional dependencies needed using brew. |
96 | 1 | Kevin Patterson | |
97 | 11 | Kevin Patterson | If you successfully enable other optional features in Wt, or if you know how to get Wt's OpenGL support built under macosx, please contact me at _kevpatt~at~khptech.com_ and/or consider updating this Wiki page. |
98 | 1 | Kevin Patterson | |
99 | 7 | Kevin Patterson | h2. Running Examples |
100 | 1 | Kevin Patterson | |
101 | To run the examples, please see the "generic installation instructions":http://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html#examples. |
||
102 | |||
103 | 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 |
||
104 | |||
105 | Assuming the code for "Hello World" has been saved in source file named "hello.cc": |
||
106 | <pre> |
||
107 | $ c++ -o hello hello.cc -lwthttp -lwt -I/usr/local/include -L/usr/local/lib |
||
108 | $ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090 |
||
109 | </pre> |
||
110 | 8 | Kevin Patterson | |
111 | Have fun! |