Re: Instruction to setup Xcode environment to work with WebSocket++

316 views
Skip to first unread message

Peter Thorson

unread,
Feb 5, 2014, 12:34:04 AM2/5/14
to Nguyen, Dat, webso...@googlegroups.com
Hi Dat,

As WebSocket++ is a header only library there isn’t much to do. The key things are:

1. Add WebSocket++ headers (the `websocketpp` folder inside the git repo) and any required third party libraries to the header include path.
2. Pass any required third party libraries to the linker
3. Describe the C++11 related features of your compiler to the library

For #1 you can either add the library headers to one of the built in system paths (such as /usr/local/include/) or use the XCode Build Settings -> Search paths -> Header Search Paths setting. 

For #2 you can add libraries using the Build Phases -> Link Binary With Libraries option.

For #3 I would recommend the following build settings:
C++ Language Dialect: C++11 or GNU++11
Preprocessor Macros: _WEBSOCKETPP_CPP11_STL_

This will enable all C++11 library features. They are all supported by any recent version of XCode.

*Determining which third party libraries to use*
For #1 and #2, consult http://www.zaphoyd.com/websocketpp/manual/building-program-websocket/required-external-libraries to determine which third party libraries you will need to include headers for and link with. 

*Getting the right boost libraries*
Any boost libraries will need to be compiled using the same C++ standard library that your WebSocket++ program is using. The XCode default is LLVM’s libc++ which is not the default. The following terminal commands will build boost from source using clang/libc++ to match the compiler/library used by XCode.

# download and uncompress the latest version of boost (1.55 as of today)
# change to the newly downloaded directory
./booststrap.sh
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"

Optionally: `sudo ./b2 install` to install the library in default system directories. If you don’t do this you’ll need to add boost headers to the search path manually as described above.

Best,

Peter

On Feb 4, 2014, at 20:32, Nguyen, Dat <nguy...@amazon.com> wrote:

Hi Peter,

I found your email as the contact info for Zaphoyd Studio. I'm looking for instruction to setup Xcode on Mac OS 10.7 (or 10.8) to work with WebSocket++, but couldn't find any. This instruction for Ubuntu is awesome: https://github.com/zaphoyd/websocketpp/wiki/Setup-0.3X-on-Ubuntu-12.10, so I'm wondering if setting up Xcode is too trivia that there's no instruction. 

Thanks,
Dat

Steven Lu

unread,
Feb 15, 2014, 9:57:55 AM2/15/14
to webso...@googlegroups.com
I just wanted to say thanks to Peter for being so thoughtful to forward these very informative instructions to the mailing list. Thanks for the amazing work on this lib!
Reply all
Reply to author
Forward
0 new messages