You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[JSON][json-org] is a lightweight data-interchange format. It can represent
4
6
numbers, strings, ordered sequences of values, and collections of name/value
5
7
pairs.
@@ -30,12 +32,12 @@ format to store user input files.
30
32
## Using JsonCpp in your project
31
33
32
34
The recommended approach to integrating JsonCpp in your project is to include
33
-
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
34
-
`.cpp` file and two `.h` files) in your project, and compile and build as you
35
+
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
36
+
`.cpp` file and two `.h` files) in your project, and compile and build as you
35
37
would any other source file. This ensures consistency of compilation flags and
36
-
ABI compatibility, issues which arise when building shared or static
38
+
ABI compatibility, issues which arise when building shared or static
37
39
libraries. See the next section for instructions.
38
-
40
+
39
41
The `include/` should be added to your compiler include path. JsonCpp headers
40
42
should be included as follow:
41
43
@@ -69,6 +71,43 @@ correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
69
71
70
72
## Contributing to JsonCpp
71
73
74
+
### Building and testing with Conan
75
+
76
+
[Conan](https://www.conan.io/#/) is an open source package manager intended for C/C++ projects.
77
+
It is cross platform and build system agnostic.
78
+
79
+
Conan requires Python for running, and can be installed using pip:
80
+
81
+
pip install conan
82
+
83
+
Detailed instructions can be found on [conan docs](http://docs.conan.io/en/latest/).
84
+
85
+
For build jsoncpp with conan, you need to create a [conanfile.txt](http://docs.conan.io/en/latest/reference/conanfile_txt.html) or a [conanfile.py](http://docs.conan.io/en/latest/reference/conanfile.html). The first is simpler, but the second is more flexible.
86
+
87
+
This is a sample conanfile.txt:
88
+
89
+
```
90
+
[requires]
91
+
jsoncpp/1.8.0@theirix/ci
92
+
93
+
[generators]
94
+
cmake
95
+
```
96
+
97
+
**Note**: cmake is not required, you can use other [integrations](http://docs.conan.io/en/latest/integrations.html). Or you can set the appropriate environment variables, using [virtualenv generators](http://docs.conan.io/en/latest/mastering/virtualenv.html).
98
+
99
+
Then run the following command from the conanfile directory:
100
+
101
+
conan install --build missing
102
+
103
+
This will try to download the appropriate package for your settings (OS, compiler, architecture) from the [recipe packages](https://www.conan.io/source/jsoncpp/1.8.0/theirix/ci). If it is not found, the package will be built.
104
+
105
+
**Note**: you do not need to install cmake to build jsoncpp using conan, because the recipe will download it automatically.
106
+
107
+
If you need, you can customize the jsoncpp recipe. Just clone/fork [it from github](https://github.com/theirix/conan-jsoncpp/).
108
+
109
+
See [integrations instructions](http://docs.conan.io/en/latest/integrations.html) for how to use your build system with conan.
110
+
72
111
### Building and testing with CMake
73
112
74
113
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most Linux system as package. On Ubuntu:
@@ -85,7 +124,7 @@ When running CMake, a few parameters are required:
85
124
* A build directory where the makefiles/solution are generated. It is also used
86
125
to store objects, libraries and executables files.
87
126
* The generator to use: makefiles or Visual Studio solution? What version or
88
-
Visual Studio, 32 or 64 bits solution?
127
+
Visual Studio, 32 or 64 bits solution?
89
128
90
129
Steps for generating solution/makefiles using `cmake-gui`:
91
130
@@ -154,17 +193,17 @@ In the instructions below, replace `path/to/jsontest` with the path of the
154
193
cd test
155
194
# This will run the Reader/Writer tests
156
195
python runjsontests.py path/to/jsontest
157
-
196
+
158
197
# This will run the Reader/Writer tests, using JSONChecker test suite
159
198
# (http://www.json.org/JSON_checker/).
160
199
# Notes: not all tests pass: JsonCpp is too lenient (for example,
161
200
# it allows an integer to start with '0'). The goal is to improve
0 commit comments