-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
124 lines (82 loc) · 2.8 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Installation
============
Requirements
-------------
- C++ compiler toolchain;
- automake/autoconf or scons depending of the way to compile;
- libjsoncpp if available on your system, JsonCpp source files
(http://jsoncpp.sourceforge.net/) otherwise;
- libcurl if you want to build the HTTP client;
Build JsonCpp
--------------
If the libjsoncpp is available on your system, skip this part.
Get JsonCpp source code from SVN repository (there are no releases):
$ svn co https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk jsoncpp
$ cd jsoncpp/
Compilation,
for Linux and MacOS X:
$ scons platform=linux-gcc
Installation,
for Linux:
# cp libs/linux-gcc-*/libjson_linux-gcc*libmt.so /usr/local/lib/libjson.so
# cp -r include/json /usr/local/include/json
for MacOS X:
# cp libs/linux-gcc-*/libjson_linux-gcc*.dylib /usr/local/lib/libjson.dylib
# cp -r include/json /usr/local/include/json
Build JsonRpc-Cpp
------------------
You can use the autotools or the scons way.
1) Autotools
$ ./autogen.sh
$ ./configure
$ make
# make install
To specify another prefix for installation, use ./configure --prefix=/path/to/directory before make.
2) Scons
To build the library:
$ scons build
To build all (library, examples, ...):
$ scons all
To clean up the project:
$ scons -c all
To build documentation:
$ scons doc
To install:
Run (with root or admin privileges):
# scons install
Default will install include files in /usr/local/include/jsonrpc/ and
libjsonrpc.so file in /usr/local/lib/ on Unix-like.
To choose another installation directory add "prefix" option:
$ scons install prefix='/path/to/installation/directory'
To uninstall, run (with root or admin privileges):
# scons -c install
For custom uninstallation:
$ scons -c install prefix='/path/to/installation/directory'
Examples
---------
JsonRpc-Cpp provides simple JSON-RPC TCP and UDP servers as well as TCP and UDP clients.
To build the examples:
$ scons examples
This will build tcp-server, udp-server, tcp-client and udp-client examples.
Note that servers will be bind to localhost, port 8086 and clients will connect to the same address/port.
The examples are built by default when compiling with autotools.
To run the TCP JSON-RPC server:
$ examples/tcp-server
To run the TCP JSON-RPC client:
$ examples/tcp-client
You should see:
Query is: {"id":1,"jsonrpc":"2.0","method":"system.print"}
Received: {"id":1,"jsonrpc":"2.0","result":"success"}
To run the UDP JSON-RPC server:
$ examples/udp-server
To run the UDP JSON-RPC client:
$ examples/udp-client
You should see:
Query is: {"id":1,"jsonrpc":"2.0","method":"system.print"}
Received: {"id":1,"jsonrpc":"2.0","result":"success"}
Unit tests
-----------
CppUnit framework (http://cppunit.sourceforge.net/) is needed in order to use unit tests.
To compile and run unit tests:
$ scons test
$ scons run-test