Mercurial > hg > orthanc
changeset 2497:0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 22 Mar 2018 15:27:00 +0100 |
parents | 3d65adee289a |
children | 0188c21e417a |
files | INSTALL NEWS Resources/CMake/JsonCppConfiguration.cmake Resources/CMake/OrthancFrameworkParameters.cmake UnitTestsSources/VersionsTests.cpp |
diffstat | 5 files changed, 45 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/INSTALL Thu Mar 22 12:53:20 2018 +0100 +++ b/INSTALL Thu Mar 22 15:27:00 2018 +0100 @@ -75,18 +75,20 @@ ------------------------------------------------- # cd [...]\OrthancBuild -# cmake -DSTANDALONE_BUILD=ON -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON -G "Visual Studio 8 2005" [...]\Orthanc +# cmake -DSTANDALONE_BUILD=ON -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON -DUSE_LEGACY_JSONCPP=ON -G "Visual Studio 8 2008" [...]\Orthanc Then open the "[...]/OrthancBuild/Orthanc.sln" with Visual Studio. NOTES: -* More recent versions of Visual Studio than 2005 should also +* More recent versions of Visual Studio than 2008 should also work. Type "cmake" without arguments to have the list of generators that are available on your computer. * You will have to install the Platform SDK (version 6 or above) for Visual Studio 2005: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK. Read the CMake FAQ: http://goo.gl/By90B +* The "-DUSE_LEGACY_JSONCPP=ON" must be set for versions of + Visual Studio that do not support C++11
--- a/NEWS Thu Mar 22 12:53:20 2018 +0100 +++ b/NEWS Thu Mar 22 15:27:00 2018 +0100 @@ -32,6 +32,9 @@ * Support of Linux Standard Base * Static linking against libuuid (from e2fsprogs) * Fix static build on CentOS 6 +* Upgrade to JsonCpp 1.8.4 for static builds +* Possibility of using JsonCpp 0.10.6 if the compiler does not support C++11 + with the "-DUSE_LEGACY_JSONCPP=ON" CMake option Version 1.3.1 (2017-11-29)
--- a/Resources/CMake/JsonCppConfiguration.cmake Thu Mar 22 12:53:20 2018 +0100 +++ b/Resources/CMake/JsonCppConfiguration.cmake Thu Mar 22 15:27:00 2018 +0100 @@ -1,7 +1,18 @@ +set(JSONCPP_CXX11 OFF) + if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP) - set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.5) - set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-0.10.5.tar.gz") - set(JSONCPP_MD5 "db146bac5a126ded9bd728ab7b61ed6b") + if (USE_LEGACY_JSONCPP) + set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.6) + set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-0.10.6.tar.gz") + set(JSONCPP_MD5 "13d1991d79697df8cadbc25c93e37c83") + add_definitions(-DORTHANC_LEGACY_JSONCPP=1) + else() + set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.8.4) + set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-1.8.4.tar.gz") + set(JSONCPP_MD5 "fa47a3ab6b381869b6a5f20811198662") + add_definitions(-DORTHANC_LEGACY_JSONCPP=0) + set(JSONCPP_CXX11 ON) + endif() DownloadPackage(${JSONCPP_MD5} ${JSONCPP_URL} "${JSONCPP_SOURCES_DIR}") @@ -48,14 +59,24 @@ JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") - if ((CMAKE_COMPILER_IS_GNUCXX OR - "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND - JSONCPP_VERSION_MAJOR GREATER 0) - message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations") + if (JSONCPP_VERSION_MAJOR GREATER 0) + set(JSONCPP_CXX11 ON) endif() else() message("Unable to detect the major version of JsonCpp, assuming < 1.0.0") endif() +endif() + +if (JSONCPP_CXX11) + # Osimis has encountered problems when this macro is left at its + # default value (1000), so we increase this limit + # https://gitlab.kitware.com/third-party/jsoncpp/commit/56df2068470241f9043b676bfae415ed62a0c172 + add_definitions(-DJSONCPP_DEPRECATED_STACK_LIMIT=5000) + + if (CMAKE_COMPILER_IS_GNUCXX OR + "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations") + endif() endif()
--- a/Resources/CMake/OrthancFrameworkParameters.cmake Thu Mar 22 12:53:20 2018 +0100 +++ b/Resources/CMake/OrthancFrameworkParameters.cmake Thu Mar 22 15:27:00 2018 +0100 @@ -67,11 +67,13 @@ set(SYSTEM_MONGOOSE_USE_CALLBACKS ON CACHE BOOL "The system version of Mongoose uses callbacks (version >= 3.7)") set(USE_BOOST_ICONV ON CACHE BOOL "Use iconv instead of wconv (Windows only)") set(USE_PUGIXML ON CACHE BOOL "Use the Pugixml parser (turn off only for debug)") +set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for old versions of Visual Studio)") mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS) mark_as_advanced(USE_BOOST_ICONV) mark_as_advanced(USE_PUGIXML) +mark_as_advanced(USE_LEGACY_JSONCPP) #####################################################################
--- a/UnitTestsSources/VersionsTests.cpp Thu Mar 22 12:53:20 2018 +0100 +++ b/UnitTestsSources/VersionsTests.cpp Thu Mar 22 15:27:00 2018 +0100 @@ -164,7 +164,13 @@ TEST(Version, JsonCpp) { - ASSERT_STREQ("0.10.5", JSONCPP_VERSION_STRING); +#if ORTHANC_LEGACY_JSONCPP == 1 + ASSERT_STREQ("0.10.6", JSONCPP_VERSION_STRING); +#elif ORTHANC_LEGACY_JSONCPP == 0 + ASSERT_STREQ("1.8.4", JSONCPP_VERSION_STRING); +#else +# error Macro ORTHANC_LEGACY_JSONCPP should be set +#endif } #endif