Installing Wt on Mac OS X Yosemite » History » Revision 9
Revision 8 (Kevin Patterson, 03/06/2015 05:50 PM) → Revision 9/26 (Kevin Patterson, 03/06/2015 05:51 PM)
h1. Installing Wt on Mac OS X Yosemite (macosx 10.10) {{toc}} 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. h2. Requirements * Get Xcode from the Apple App Store * Install the Xcode Command-Line Tools from within Xcode or from the command-line * Install "Homebrew":http://brew.sh h2. Preparation h3. Install Dependencies 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. For this guide, we we be enabling the following features: * HTTPS (SSL) * FastCGI * MySQL * Graphics drawing and PDF Generation If you haven't installed Homebrew already, it's very easy to do using the following command in Terminal: <pre> $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </pre> With Homebrew installed, let's install the base dependencies for Wt: <pre> $ brew install cmake $ brew install boost </pre> If you want FastCGI support: <pre> $ brew install fcgi </pre> If you want SSL (HTTPS) support in Wt's built-in web server: <pre> $ brew install openssl </pre> Support for MySQL: <pre> $ brew install mysql-connector-c </pre> Graphics drawing and PDF generation support: <pre> $ brew install libpng $ brew install libtiff $ brew install libharu $ brew install pango $ brew install GraphicsMagick </pre> *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 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.* h2. Building Wt 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: <pre> $ git clone git://github.com/kdeforche/wt.git </pre> To build Wt, do the following: <pre> $ cd wt $ mkdir build $ cd build $ cmake \ -DCMAKE_CXX_FLAGS='-stdlib=libc++' -DCMAKE_EXE_LINKER_FLAGS='-stdlib=libc++' \ -DCMAKE_MODULE_LINKER_FLAGS='-stdlib=libc++' -DWT_CPP_11_MODE='-std=c++11' \ -DMYSQL_LIBRARY=mysqlclient -DMYSQL_PREFIX=/usr/local/Cellar/mysql-connector-c/6.1.3 \ # for MySQL \ -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick -DGM_PREFIX=/usr/local \ # for GraphicsMagick \ -DSSL_PREFIX=/usr/local/Cellar/openssl/1.0.2 \ # for OpenSSL \ ../ $ make $ make -C examples # to build the examples $ sudo make install </pre> 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. If you know how to get Wt's OpenGL support built under macosx, please contact me at _kevpatt~at~khptech.com_ h2. Running Examples To run the examples, please see the "generic installation instructions":http://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html#examples. 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 Assuming the code for "Hello World" has been saved in source file named "hello.cc": <pre> $ c++ -o hello hello.cc -lwthttp -lwt -I/usr/local/include -L/usr/local/lib $ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090 </pre> Have fun! If you can enable other optional features in Wt (especially OpenGL), please consider updating this Wiki page.