Skip to content

Commit de2c85f

Browse files
committed
Merge pull request open-source-parsers#282 from keithkml/patch-1
Clarify which parts of README for users vs devs
2 parents b389d81 + 89c51f3 commit de2c85f

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

README.md

+33-29
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ format to store user input files.
1919
* `0.y.z` can be used with older compilers.
2020
* Major versions maintain binary-compatibility.
2121

22-
Using JsonCpp in your project
22+
# Using JsonCpp in your project
2323
-----------------------------
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.
2830

2931
The `include/` should be added to your compiler include path. Jsoncpp headers
3032
should be included as follow:
@@ -34,6 +36,31 @@ should be included as follow:
3436
If JsonCpp was built as a dynamic library on Windows, then your project needs to
3537
define the macro `JSON_DLL`.
3638

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+
3764
Building and testing with CMake
3865
-------------------------------
3966
[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
106133
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
107134
running SCons.
108135

109-
# Running the tests manually
136+
## Running the tests manually
110137
You need to run tests manually only if you are troubleshooting an issue.
111138

112139
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:
142169

143170
See `doxybuild.py --help` for options.
144171

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-
168172
Adding a reader/writer test
169173
---------------------------
170174
To add a test, you need to create two files in test/data:

0 commit comments

Comments
 (0)