From 108d8b2af5df1783fc0311a28b1a558951a3adea Mon Sep 17 00:00:00 2001 From: "melo.yao" Date: Wed, 8 Apr 2015 01:28:47 +0800 Subject: [PATCH] update readme --- README.md | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b6edd6b..af57640 100755 --- a/README.md +++ b/README.md @@ -15,12 +15,20 @@ By virtue of being written in C++, this client works in several different platfo - Similar API to the Socket.IO JS client ## How to use - -1. Install boost +### With CMake +1. Install boost, see [Boost setup](#boost_setup) section. 2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo. -3. Include `websocket++`, `rapidjson` and `sio_client.cpp`,`sio_packet.cpp`,`sio_socket.cpp`,`internal/sio_client_impl.cpp` in your project. -4. Include `sio_client.h` where you want to use it. -5. Use `message` and its derived classes to compose complex text/binary messages. +3. Run `cmake -DBOOST_PATH:STRING= ./ +4. Run `make`(if makefile generated) or open generated project (if project file generated) to build. +5. Include `sio_client.h` in your client code where you want to use it. + +### Without CMake +1. Install boost, see [Boost setup](#boost_setup) section. +2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo. +3. Add `/include`,`./lib/websocketpp` and `./lib/rapidjson/include` to headers search path. +4. Include all files under `./src` in your project, add `sio_packet.cpp`,`sio_socket.cpp`,`internal/sio_client_impl.cpp` to source list. +5. Add `/lib` to library search path, add `boost.lib`(Win32) or `-lboost`(Other) link option. +6. Include `sio_client.h` in your client code where you want to use it. ## API ### *Overview* @@ -216,7 +224,7 @@ Get socket.io session id. All designated constructor of `message` objects is hidden, you need to create message and get the `message::ptr` by `[derived]_message:create()`. -## Boost setup +## Boost setup * Download boost from [boost.org](http://www.boost.org/). * Unpack boost to some place. @@ -225,22 +233,24 @@ All designated constructor of `message` objects is hidden, you need to create me ## Boost build (Build the necessary subset only) -#### Windows: +#### Windows (or other mainstream desktop platforms shall work too): Run with following script will build the necessary subset: ```bash -bjam stage --toolset=msvc --with-system --with-date_time --with-random --stagedir="release" link=static runtime-link=shared threading=multi release +bjam install --prefix="" --with-system --with-date_time --with-random link=static runtime-link=shared threading=multi ``` -Optionally You can merge all output .lib files into a fat one, in output folder, run: +Optionally You can merge all output .lib files into a fat one,especially if you're not using cmake. + +In output folder, run: ```bash lib.exe /OUT:boost.lib * ``` -#### iOS and OSX +#### iOS Use this [shell](https://github.com/socketio/socket.io-client-cpp/blob/master/examples/iOS/SioChatDemo/boost/boost.sh) to download and build boost completely automattically. -#### Add boost source folder to your `header search path`, and add static libs to link option. +It installs boost to `/prefix`. ##License BSD