From 31e99627546a84946a8571d129933fbc025ab7f6 Mon Sep 17 00:00:00 2001 From: Stefan Schweter Date: Sun, 17 May 2015 13:04:40 +0200 Subject: [PATCH 1/6] [Documentation][Markdown] Use correct help option for cmake. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2940852..541109b 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Alternatively, from the command-line on Unix in the source directory: cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -G "Unix Makefiles" ../.. make -Running `cmake -`" will display the list of available generators (passed using +Running `cmake -h` will display the list of available generators (passed using the `-G` option). By default CMake hides compilation commands. This can be modified by specifying From d57ac97db8c8a1480639b42ab8c95a9a79be0493 Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Mon, 18 May 2015 10:06:21 -0700 Subject: [PATCH 2/6] make the unix make example work ...by setting the archive directory variable --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2940852..f48aa24 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Alternatively, from the command-line on Unix in the source directory: mkdir -p build/debug cd build/debug - cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -G "Unix Makefiles" ../.. + cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../.. make Running `cmake -`" will display the list of available generators (passed using From 97e093a361d7235e414807bdad2c41cc4d75f804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ricles=20Lopes=20Machado?= Date: Mon, 18 May 2015 14:31:05 -0300 Subject: [PATCH 3/6] fix compile error on android --- src/lib_json/json_writer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index ba07b07..3be34d9 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -29,6 +29,8 @@ #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #define snprintf _snprintf +#elif defined(__ANDROID__) +#define snprintf snprintf #elif __cplusplus >= 201103L #define snprintf std::snprintf #endif From e6f1cffdd3fb04a0ed96319e6f8df6a7cbdd1557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 19 May 2015 17:32:31 +0200 Subject: [PATCH 4/6] Fix custom includedir & libdir substitution in pkg-config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not prepend ${prefix} to substituted includedir & libdir in the pkg-config file -- if the paths are overriden by user, CMake puts absolute paths there (even if user specifies a relative path). Instead, use the absolute path provided by CMake and appropriately default LIBRARY_INSTALL_DIR & INCLUDE_INSTALL_DIR to absolute paths with ${CMAKE_INSTALL_PREFIX} prepended. Fixes: https://github.com/open-source-parsers/jsoncpp/issues/279 Signed-off-by: Michał Górny --- CMakeLists.txt | 6 +++--- pkg-config/jsoncpp.pc.in | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30038d5..d31a6ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,11 +25,11 @@ SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library i SET(RUNTIME_INSTALL_DIR bin CACHE PATH "Install dir for executables and dlls") -SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX} +SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "Install dir for static libraries") -SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX} +SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "Install dir for shared libraries") -SET(INCLUDE_INSTALL_DIR include +SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Install dir for headers") SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake CACHE PATH "Install dir for cmake package config files") diff --git a/pkg-config/jsoncpp.pc.in b/pkg-config/jsoncpp.pc.in index 9613181..3ca4a84 100644 --- a/pkg-config/jsoncpp.pc.in +++ b/pkg-config/jsoncpp.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@ -includedir=${prefix}/@INCLUDE_INSTALL_DIR@ +libdir=@LIBRARY_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_DIR@ Name: jsoncpp Description: A C++ library for interacting with JSON From 89c51f345799b233e104585d5e139b10aa43dd1c Mon Sep 17 00:00:00 2001 From: Keith Lea Date: Wed, 20 May 2015 09:43:47 -0700 Subject: [PATCH 5/6] Clarify which parts of README for users vs devs When I arrived at the JsonCpp GitHub page, as an intermediate C++ developer, I could not figure out how to include JsonCpp into my project. The changes I propose to the README make this much clearer, and define a clear distinction between which instructions are for those developing and contributing to JsonCpp, and those who are just using it. --- README.md | 62 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 541109b..b2c3574 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,14 @@ format to store user input files. * `0.y.z` can be used with older compilers. * Major versions maintain binary-compatibility. -Using JsonCpp in your project +# Using JsonCpp in your project ----------------------------- -The recommended approach to integrating JsonCpp in your project is to build -the amalgamated source (a single `.cpp` file) with your own build system. This -ensures consistency of compilation flags and ABI compatibility. See the section -"Generating amalgamated source and header" for instructions. +The recommended approach to integrating JsonCpp in your project is to include +the [amalgamated source](#generating-amalgamated-source-and-header) (a single +`.cpp` file and two `.h` files) in your project, and compile and build as you +would any other source file. This ensures consistency of compilation flags and +ABI compatibility, issues which arise when building shared or static +libraries. See the next section for instructions. The `include/` should be added to your compiler include path. Jsoncpp headers should be included as follow: @@ -34,6 +36,31 @@ should be included as follow: If JsonCpp was built as a dynamic library on Windows, then your project needs to define the macro `JSON_DLL`. +Generating amalgamated source and header +---------------------------------------- +JsonCpp is provided with a script to generate a single header and a single +source file to ease inclusion into an existing project. The amalgamated source +can be generated at any time by running the following command from the +top-directory (this requires Python 2.6): + + python amalgamate.py + +It is possible to specify header name. See the `-h` option for detail. + +By default, the following files are generated: +* `dist/jsoncpp.cpp`: source file that needs to be added to your project. +* `dist/json/json.h`: corresponding header file for use in your project. It is + equivalent to including `json/json.h` in non-amalgamated source. This header + only depends on standard headers. +* `dist/json/json-forwards.h`: header that provides forward declaration of all + JsonCpp types. + +The amalgamated sources are generated by concatenating JsonCpp source in the +correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion +of other headers. + +# Contributing to JsonCpp + Building and testing with CMake ------------------------------- [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 environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before running SCons. -# Running the tests manually +## Running the tests manually You need to run tests manually only if you are troubleshooting an issue. 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: See `doxybuild.py --help` for options. -Generating amalgamated source and header ----------------------------------------- -JsonCpp is provided with a script to generate a single header and a single -source file to ease inclusion into an existing project. The amalgamated source -can be generated at any time by running the following command from the -top-directory (this requires Python 2.6): - - python amalgamate.py - -It is possible to specify header name. See the `-h` option for detail. - -By default, the following files are generated: -* `dist/jsoncpp.cpp`: source file that needs to be added to your project. -* `dist/json/json.h`: corresponding header file for use in your project. It is - equivalent to including `json/json.h` in non-amalgamated source. This header - only depends on standard headers. -* `dist/json/json-forwards.h`: header that provides forward declaration of all - JsonCpp types. - -The amalgamated sources are generated by concatenating JsonCpp source in the -correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion -of other headers. - Adding a reader/writer test --------------------------- To add a test, you need to create two files in test/data: From bcb83b921c9f94d569ba4ce1fb2f0dd8b087efaf Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Thu, 4 Jun 2015 21:57:29 -0700 Subject: [PATCH 6/6] fix doxybuild.py for Windows issue #287 (tylerknott@) --- doxybuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doxybuild.py b/doxybuild.py index cb27d2b..f18c9c0 100644 --- a/doxybuild.py +++ b/doxybuild.py @@ -72,7 +72,7 @@ def run_cmd(cmd, silent=False): if silent: status, output = getstatusoutput(cmd) else: - status, output = os.system(' '.join(cmd)), '' + status, output = subprocess.call(cmd), '' if status: msg = 'Error while %s ...\n\terror=%d, output="""%s"""' %(info, status, output) raise Exception(msg)