Skip to content

Commit c668af9

Browse files
committed
Update README
* Document meson/ninja. * Deprecate cmake. * Drop scons.
1 parent 13b5ed7 commit c668af9

File tree

2 files changed

+15
-114
lines changed

2 files changed

+15
-114
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/build/
2+
/build-*/
23
*.pyc
34
*.swp
45
*.actual
@@ -30,7 +31,7 @@
3031
# CMake-generated files:
3132
CMakeFiles/
3233
*.cmake
33-
pkg-config/jsoncpp.pc
34+
/pkg-config/jsoncpp.pc
3435
jsoncpp_lib_static.dir/
3536

3637
# In case someone runs cmake in the root-dir:

README.md

+13-113
Original file line numberDiff line numberDiff line change
@@ -71,117 +71,23 @@ correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
7171

7272
## Contributing to JsonCpp
7373

74-
### Building and testing with Conan
74+
### Building and testing with Meson/Ninja
75+
Thanks to David Seifert (@SoapGentoo), we (the maintainers) now use [meson](http://mesonbuild.com/) and [ninja](https://ninja-build.org/) to build for debugging, as well as for continuous integration (see [`travis.sh`](travis.sh) ). Other systems may work, but minor things like version strings might break.
7576

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.
77+
First, install both meson (which requires Python3) and ninja.
7878

79-
Conan requires Python for running, and can be installed using pip:
79+
Then,
8080

81-
pip install conan
81+
cd jsoncpp/
82+
BUILD_TYPE=shared
83+
#BUILD_TYPE=static
84+
LIB_TYPE=debug
85+
#LIB_TYPE=release
86+
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE}
87+
ninja -v -C build-${LIB_TYPE} test
8288

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-
111-
### Building and testing with CMake
112-
113-
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most Linux system as package. On Ubuntu:
114-
115-
sudo apt-get install cmake
116-
117-
[CMake]: http://www.cmake.org
118-
119-
Note that Python is also required to run the JSON reader/writer tests. If
120-
missing, the build will skip running those tests.
121-
122-
When running CMake, a few parameters are required:
123-
124-
* A build directory where the makefiles/solution are generated. It is also used
125-
to store objects, libraries and executables files.
126-
* The generator to use: makefiles or Visual Studio solution? What version or
127-
Visual Studio, 32 or 64 bits solution?
128-
129-
Steps for generating solution/makefiles using `cmake-gui`:
130-
131-
* Make "source code" point to the source directory.
132-
* Make "where to build the binary" point to the directory to use for the build.
133-
* Click on the "Grouped" check box.
134-
* Review JsonCpp build options (tick `BUILD_SHARED_LIBS` to build as a
135-
dynamic library).
136-
* Click the configure button at the bottom, then the generate button.
137-
* The generated solution/makefiles can be found in the binary directory.
138-
139-
Alternatively, from the command-line on Unix in the source directory:
140-
141-
mkdir -p build/debug
142-
cd build/debug
143-
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
144-
make
145-
146-
For a good pkg-config file, add:
147-
148-
-DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp
149-
150-
Running `cmake -h` will display the list of available generators (passed using
151-
the `-G` option).
152-
153-
By default CMake hides compilation commands. This can be modified by specifying
154-
`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
155-
156-
### Building and testing with SCons
157-
158-
**Note:** The SCons-based build system is deprecated. Please use CMake (see the
159-
section above).
160-
161-
JsonCpp can use [Scons][] as a build system. Note that SCons requires Python to
162-
be installed.
163-
164-
[SCons]: http://www.scons.org/
165-
166-
Invoke SCons as follows:
167-
168-
scons platform=$PLATFORM [TARGET]
169-
170-
where `$PLATFORM` may be one of:
171-
172-
* `suncc`: Sun C++ (Solaris)
173-
* `vacpp`: Visual Age C++ (AIX)
174-
* `mingw`
175-
* `msvc6`: Microsoft Visual Studio 6 service pack 5-6
176-
* `msvc70`: Microsoft Visual Studio 2002
177-
* `msvc71`: Microsoft Visual Studio 2003
178-
* `msvc80`: Microsoft Visual Studio 2005
179-
* `msvc90`: Microsoft Visual Studio 2008
180-
* `linux-gcc`: Gnu C++ (linux, also reported to work for Mac OS X)
181-
182-
If you are building with Microsoft Visual Studio 2008, you need to set up the
183-
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
184-
running SCons.
89+
### Building and testing with other build systems
90+
See https://github.com/open-source-parsers/jsoncpp/wiki/Building
18591

18692
### Running the tests manually
18793

@@ -207,12 +113,6 @@ In the instructions below, replace `path/to/jsontest` with the path of the
207113
# You can run the tests using valgrind:
208114
python rununittests.py --valgrind path/to/test_lib_json
209115

210-
### Running the tests using SCons
211-
212-
Note that tests can be run using SCons using the `check` target:
213-
214-
scons platform=$PLATFORM check
215-
216116
### Building the documentation
217117

218118
Run the Python script `doxybuild.py` from the top directory:

0 commit comments

Comments
 (0)