Skip to content

Commit

Permalink
Merge pull request #556 from ax3l/topic-json370
Browse files Browse the repository at this point in the history
NLohmann-JSON: 3.7.0+
  • Loading branch information
ax3l authored Aug 22, 2019
2 parents cca6882 + 9086118 commit 3f7d581
Show file tree
Hide file tree
Showing 8 changed files with 12,285 additions and 10,182 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Bug Fixes
Other
"""""

- NLohmann-JSON: updated to 3.7.0+ #556


0.9.0-alpha
-----------
Expand Down
20 changes: 8 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,13 @@ endif()
# external library: nlohmann-json (optional)
if(openPMD_USE_JSON STREQUAL AUTO)
if(openPMD_USE_INTERNAL_JSON)
# see https://github.com/nlohmann/json/pull/1330
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(
"${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/json"
EXCLUDE_FROM_ALL) # does not need to be publicly installed
set(JSON_Install OFF CACHE INTERNAL "") # only used PRIVATE
add_subdirectory("${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/json")
set(openPMD_HAVE_JSON TRUE)
message(STATUS "nlohmann-json: Using INTERNAL version 3.5.0")
message(STATUS "nlohmann-json: Using INTERNAL version 3.7.0")
else()
find_package(nlohmann_json 3.5.0 CONFIG)
find_package(nlohmann_json 3.7.0 CONFIG)
if(nlohmann_json_FOUND)
set(openPMD_HAVE_JSON TRUE)
message(STATUS "nlohmann-json: Found version ${nlohmann_json_VERSION}")
Expand All @@ -133,15 +131,13 @@ if(openPMD_USE_JSON STREQUAL AUTO)
endif()
elseif(openPMD_USE_JSON)
if(openPMD_USE_INTERNAL_JSON)
# see https://github.com/nlohmann/json/pull/1330
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(
"${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/json"
EXCLUDE_FROM_ALL) # does not need to be publicly installed
set(JSON_Install OFF CACHE INTERNAL "") # only used PRIVATE
add_subdirectory("${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/json")
set(openPMD_HAVE_JSON TRUE)
message(STATUS "nlohmann-json: Using INTERNAL version 3.5.0")
message(STATUS "nlohmann-json: Using INTERNAL version 3.7.0")
else()
find_package(nlohmann_json 3.5.0 CONFIG REQUIRED)
find_package(nlohmann_json 3.7.0 CONFIG REQUIRED)
set(openPMD_HAVE_JSON TRUE)
message(STATUS "nlohmann-json: Found version ${nlohmann_json_VERSION}")
endif()
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Shipped internally in `share/openPMD/thirdParty/`:
* [MPark.Variant](https://github.com/mpark/variant) 1.4.0+ ([BSL-1.0](https://github.com/mpark/variant/blob/master/LICENSE.md))
* [Catch2](https://github.com/catchorg/Catch2) 2.6.1+ ([BSL-1.0](https://github.com/catchorg/Catch2/blob/master/LICENSE.txt))
* [pybind11](https://github.com/pybind/pybind11) 2.3.0+ ([new BSD](https://github.com/pybind/pybind11/blob/master/LICENSE))
* [NLohmann-JSON](https://github.com/nlohmann/json) 3.5.0+ ([MIT](https://github.com/nlohmann/json/blob/develop/LICENSE.MIT))
* [NLohmann-JSON](https://github.com/nlohmann/json) 3.7.0+ ([MIT](https://github.com/nlohmann/json/blob/develop/LICENSE.MIT))

Optional I/O backends:
* [JSON](https://en.wikipedia.org/wiki/JSON)
Expand Down Expand Up @@ -230,7 +230,7 @@ The following options allow to switch to external installs:
| `openPMD_USE_INTERNAL_VARIANT` | **ON**/OFF | MPark.Variant | 1.4.0+ |
| `openPMD_USE_INTERNAL_CATCH` | **ON**/OFF | Catch2 | 2.6.1+ |
| `openPMD_USE_INTERNAL_PYBIND11` | **ON**/OFF | pybind11 | 2.3.0+ |
| `openPMD_USE_INTERNAL_JSON` | **ON**/OFF | NLohmann-JSON | 3.5.0+ |
| `openPMD_USE_INTERNAL_JSON` | **ON**/OFF | NLohmann-JSON | 3.7.0+ |

By default, this will build as a shared library (`libopenPMD.[so|dylib|dll]`) and installs also its headers.
In order to build a static library, append `-DBUILD_SHARED_LIBS=OFF` to the `cmake` command.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/dev/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CMake Option Values Installs Library Version
``openPMD_USE_INTERNAL_VARIANT`` **ON**/OFF Yes MPark.Variant 1.4.0+
``openPMD_USE_INTERNAL_CATCH`` **ON**/OFF No Catch2 2.6.1+
``openPMD_USE_INTERNAL_PYBIND11`` **ON**/OFF No pybind11 2.3.0+
``openPMD_USE_INTERNAL_JSON`` **ON**/OFF No NLohmann-JSON 3.5.0+
``openPMD_USE_INTERNAL_JSON`` **ON**/OFF No NLohmann-JSON 3.7.0+
================================= =========== ======== ============= ========


Expand Down
2 changes: 1 addition & 1 deletion docs/source/dev/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following libraries are shipped internally in ``share/openPMD/thirdParty/``
* `MPark.Variant <https://github.com/mpark/variant>`_ 1.4.0+ (`BSL-1.0 <https://github.com/mpark/variant/blob/master/LICENSE.md>`_)
* `Catch2 <https://github.com/catchorg/Catch2>`_ 2.6.1+ (`BSL-1.0 <https://github.com/catchorg/Catch2/blob/master/LICENSE.txt>`_)
* `pybind11 <https://github.com/pybind/pybind11>`_ 2.3.0+ (`new BSD <https://github.com/pybind/pybind11/blob/master/LICENSE>`_)
* `NLohmann-JSON <https://github.com/nlohmann/json>`_ 3.5.0+ (`MIT <https://github.com/nlohmann/json/blob/develop/LICENSE.MIT>`_)
* `NLohmann-JSON <https://github.com/nlohmann/json>`_ 3.7.0+ (`MIT <https://github.com/nlohmann/json/blob/develop/LICENSE.MIT>`_)

Optional: I/O backends
----------------------
Expand Down
72 changes: 40 additions & 32 deletions share/openPMD/thirdParty/json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1)
## PROJECT
## name and version
##
project(nlohmann_json VERSION 3.5.0 LANGUAGES CXX)
project(nlohmann_json VERSION 3.7.0 LANGUAGES CXX)

##
## INCLUDE
Expand All @@ -16,15 +16,17 @@ include(ExternalProject)
## OPTIONS
##
option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
option(JSON_Install "Install CMake targets during install step." ON)
option(JSON_MultipleHeaders "Use non-amalgamated version of the library." OFF)

##
## CONFIGURATION
##
include(GNUInstallDirs)

set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}"
CACHE INTERNAL "")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include")
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE INTERNAL "")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE "cmake/config.cmake.in")
set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
Expand All @@ -46,7 +48,11 @@ endif()
##
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_range_for)
else()
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
endif()

target_include_directories(
${NLOHMANN_JSON_TARGET_NAME}
Expand Down Expand Up @@ -92,32 +98,34 @@ configure_file(
@ONLY
)

install(
DIRECTORY ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}
DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
)
install(
FILES ${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE} ${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE}
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)
if (NLOHMANN_ADD_NATVIS)
if(JSON_Install)
install(
FILES ${NLOHMANN_NATVIS_FILE}
DESTINATION .
)
DIRECTORY ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}
DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
)
install(
FILES ${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE} ${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE}
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)
if (NLOHMANN_ADD_NATVIS)
install(
FILES ${NLOHMANN_NATVIS_FILE}
DESTINATION .
)
endif()
export(
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE ${NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE}
)
install(
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
)
install(
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)
endif()
export(
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE ${NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE}
)
install(
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
)
install(
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)
4 changes: 2 additions & 2 deletions share/openPMD/thirdParty/json/LICENSE.MIT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License
MIT License

Copyright (c) 2013-2018 Niels Lohmann
Copyright (c) 2013-2019 Niels Lohmann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 3f7d581

Please sign in to comment.