Skip to content

Commit 108d8b2

Browse files
committed
update readme
1 parent e40c6b0 commit 108d8b2

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ By virtue of being written in C++, this client works in several different platfo
1515
- Similar API to the Socket.IO JS client
1616

1717
## How to use
18+
### With CMake
19+
1. Install boost, see [Boost setup](#boost_setup) section.
20+
2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo.
21+
3. Run `cmake -DBOOST_PATH:STRING=<your boost install folder> ./
22+
4. Run `make`(if makefile generated) or open generated project (if project file generated) to build.
23+
5. Include `sio_client.h` in your client code where you want to use it.
1824

19-
1. Install boost
25+
### Without CMake
26+
1. Install boost, see [Boost setup](#boost_setup) section.
2027
2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo.
21-
3. Include `websocket++`, `rapidjson` and `sio_client.cpp`,`sio_packet.cpp`,`sio_socket.cpp`,`internal/sio_client_impl.cpp` in your project.
22-
4. Include `sio_client.h` where you want to use it.
23-
5. Use `message` and its derived classes to compose complex text/binary messages.
28+
3. Add `<your boost install folder>/include`,`./lib/websocketpp` and `./lib/rapidjson/include` to headers search path.
29+
4. Include all files under `./src` in your project, add `sio_packet.cpp`,`sio_socket.cpp`,`internal/sio_client_impl.cpp` to source list.
30+
5. Add `<your boost install folder>/lib` to library search path, add `boost.lib`(Win32) or `-lboost`(Other) link option.
31+
6. Include `sio_client.h` in your client code where you want to use it.
2432

2533
## API
2634
### *Overview*
@@ -216,7 +224,7 @@ Get socket.io session id.
216224

217225
All designated constructor of `message` objects is hidden, you need to create message and get the `message::ptr` by `[derived]_message:create()`.
218226

219-
## Boost setup
227+
##<a name="boost_setup"></a> Boost setup
220228
* Download boost from [boost.org](http://www.boost.org/).
221229

222230
* Unpack boost to some place.
@@ -225,22 +233,24 @@ All designated constructor of `message` objects is hidden, you need to create me
225233

226234
## Boost build (Build the necessary subset only)
227235

228-
#### Windows:
236+
#### Windows (or other mainstream desktop platforms shall work too):
229237
Run with following script will build the necessary subset:
230238

231239
```bash
232-
bjam stage --toolset=msvc --with-system --with-date_time --with-random --stagedir="release" link=static runtime-link=shared threading=multi release
240+
bjam install --prefix="<your boost install folder>" --with-system --with-date_time --with-random link=static runtime-link=shared threading=multi
233241
```
234-
Optionally You can merge all output .lib files into a fat one, in output folder, run:
242+
Optionally You can merge all output .lib files into a fat one,especially if you're not using cmake.
243+
244+
In output folder, run:
235245

236246
```bash
237247
lib.exe /OUT:boost.lib *
238248
```
239249

240-
#### iOS and OSX
250+
#### iOS
241251
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.
242252

243-
#### Add boost source folder to your `header search path`, and add static libs to link option.
253+
It installs boost to `<shell folder>/prefix`.
244254

245255
##License
246256
BSD

0 commit comments

Comments
 (0)