@@ -19,12 +19,14 @@ format to store user input files.
19
19
* ` 0.y.z ` can be used with older compilers.
20
20
* Major versions maintain binary-compatibility.
21
21
22
- Using JsonCpp in your project
22
+ # Using JsonCpp in your project
23
23
-----------------------------
24
- The recommended approach to integrating JsonCpp in your project is to build
25
- the amalgamated source (a single ` .cpp ` file) with your own build system. This
26
- ensures consistency of compilation flags and ABI compatibility. See the section
27
- "Generating amalgamated source and header" for instructions.
24
+ The recommended approach to integrating JsonCpp in your project is to include
25
+ the [ amalgamated source] ( #generating-amalgamated-source-and-header ) (a single
26
+ ` .cpp ` file and two ` .h ` files) in your project, and compile and build as you
27
+ would any other source file. This ensures consistency of compilation flags and
28
+ ABI compatibility, issues which arise when building shared or static
29
+ libraries. See the next section for instructions.
28
30
29
31
The ` include/ ` should be added to your compiler include path. Jsoncpp headers
30
32
should be included as follow:
@@ -34,6 +36,31 @@ should be included as follow:
34
36
If JsonCpp was built as a dynamic library on Windows, then your project needs to
35
37
define the macro ` JSON_DLL ` .
36
38
39
+ Generating amalgamated source and header
40
+ ----------------------------------------
41
+ JsonCpp is provided with a script to generate a single header and a single
42
+ source file to ease inclusion into an existing project. The amalgamated source
43
+ can be generated at any time by running the following command from the
44
+ top-directory (this requires Python 2.6):
45
+
46
+ python amalgamate.py
47
+
48
+ It is possible to specify header name. See the ` -h ` option for detail.
49
+
50
+ By default, the following files are generated:
51
+ * ` dist/jsoncpp.cpp ` : source file that needs to be added to your project.
52
+ * ` dist/json/json.h ` : corresponding header file for use in your project. It is
53
+ equivalent to including ` json/json.h ` in non-amalgamated source. This header
54
+ only depends on standard headers.
55
+ * ` dist/json/json-forwards.h ` : header that provides forward declaration of all
56
+ JsonCpp types.
57
+
58
+ The amalgamated sources are generated by concatenating JsonCpp source in the
59
+ correct order and defining the macro ` JSON_IS_AMALGAMATION ` to prevent inclusion
60
+ of other headers.
61
+
62
+ # Contributing to JsonCpp
63
+
37
64
Building and testing with CMake
38
65
-------------------------------
39
66
[ CMake] [ ] is a C++ Makefiles/Solution generator. It is usually available on most
@@ -106,7 +133,7 @@ If you are building with Microsoft Visual Studio 2008, you need to set up the
106
133
environment by running ` vcvars32.bat ` (e.g. MSVC 2008 command prompt) before
107
134
running SCons.
108
135
109
- # Running the tests manually
136
+ ## Running the tests manually
110
137
You need to run tests manually only if you are troubleshooting an issue.
111
138
112
139
In the instructions below, replace ` path/to/jsontest ` with the path of the
@@ -142,29 +169,6 @@ Run the Python script `doxybuild.py` from the top directory:
142
169
143
170
See ` doxybuild.py --help ` for options.
144
171
145
- Generating amalgamated source and header
146
- ----------------------------------------
147
- JsonCpp is provided with a script to generate a single header and a single
148
- source file to ease inclusion into an existing project. The amalgamated source
149
- can be generated at any time by running the following command from the
150
- top-directory (this requires Python 2.6):
151
-
152
- python amalgamate.py
153
-
154
- It is possible to specify header name. See the ` -h ` option for detail.
155
-
156
- By default, the following files are generated:
157
- * ` dist/jsoncpp.cpp ` : source file that needs to be added to your project.
158
- * ` dist/json/json.h ` : corresponding header file for use in your project. It is
159
- equivalent to including ` json/json.h ` in non-amalgamated source. This header
160
- only depends on standard headers.
161
- * ` dist/json/json-forwards.h ` : header that provides forward declaration of all
162
- JsonCpp types.
163
-
164
- The amalgamated sources are generated by concatenating JsonCpp source in the
165
- correct order and defining the macro ` JSON_IS_AMALGAMATION ` to prevent inclusion
166
- of other headers.
167
-
168
172
Adding a reader/writer test
169
173
---------------------------
170
174
To add a test, you need to create two files in test/data:
0 commit comments