forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Fix potential interaction with GeoModel's bundled json (acts-p…
…roject#2995) GeoModel also bundles JSON. This adds a patch to our bundled GeoModel that allows us to instruct them to not build their own JSON. This should be upstreamed to GeoModel at some point.
- Loading branch information
1 parent
52f809c
commit e0bd2a3
Showing
4 changed files
with
134 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
thirdparty/GeoModel/0001-Add-option-to-skip-setting-up-json-completely.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
From dec8e912948cac74e5362ebc3b89f34e07ecd8e8 Mon Sep 17 00:00:00 2001 | ||
From: Paul Gessinger <hello@paulgessinger.com> | ||
Date: Wed, 28 Feb 2024 11:17:47 +0100 | ||
Subject: [PATCH] Add option to skip setting up json completely | ||
|
||
--- | ||
cmake/SetupJSON.cmake | 94 +++++++++++++++++++++++-------------------- | ||
1 file changed, 51 insertions(+), 43 deletions(-) | ||
|
||
diff --git a/cmake/SetupJSON.cmake b/cmake/SetupJSON.cmake | ||
index 6eb203ec..41e4a1ed 100644 | ||
--- a/cmake/SetupJSON.cmake | ||
+++ b/cmake/SetupJSON.cmake | ||
@@ -10,50 +10,58 @@ include_guard(GLOBAL) | ||
|
||
# Configuration option for how "nlohmann_json" should be used. | ||
option(GEOMODEL_USE_BUILTIN_JSON "Download and compile a version of nlohmann_json during the build" OFF) | ||
+option(GEOMODEL_SETUP_JSON "Whether to set up nlohmann_json at all, or expect the target to be present" ON) | ||
|
||
-# Now do what was requested. | ||
-if(GEOMODEL_USE_BUILTIN_JSON) | ||
- # Tell the user what's happening. | ||
- message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project${ColourReset}" ) | ||
- | ||
- # The include directory and library that will be produced. | ||
- set(nlohmann_json_INCLUDE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" ) | ||
- set(nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" ) | ||
- set(nlohmann_json_VERSION "3.6.1" ) | ||
- set(nlohmann_json_FOUND TRUE ) | ||
- message(STATUS "Installing the built-in 'nlohmann_json' in: ${nlohmann_json_INCLUDE_DIR}") | ||
- | ||
- # Create the include directory already, otherwise CMake refuses to | ||
- # create the imported target. | ||
- file(MAKE_DIRECTORY "${nlohmann_json_INCLUDE_DIR}") | ||
- | ||
- # Build/install nlohmann_json using ExternalProject_Add(...). | ||
- include( ExternalProject ) | ||
- ExternalProject_Add(JSONExt | ||
- PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONBuild | ||
- INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall | ||
- URL "https://cern.ch/lcgpackages/tarFiles/sources/json-${nlohmann_json_VERSION}.tar.gz" | ||
- URL_MD5 "c53592d55e7fec787cf0a406d36098a3" | ||
- CMAKE_CACHE_ARGS | ||
- -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
- -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} | ||
- -DJSON_BuildTests:BOOL=OFF | ||
- -DJSON_MultipleHeaders:BOOL=ON | ||
- BUILD_BYPRODUCTS "${nlohmann_json_INCLUDE_DIR}" ) | ||
- install(DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/ | ||
- DESTINATION . | ||
- COMPONENT Development | ||
- USE_SOURCE_PERMISSIONS) | ||
- | ||
- # Set up nlohmann_json's imported target. | ||
- add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED) | ||
- set_property(TARGET nlohmann_json::nlohmann_json PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}") | ||
- | ||
- # Auto handle dependency | ||
- add_dependencies(nlohmann_json::nlohmann_json JSONExt) | ||
+if(GEOMODEL_SETUP_JSON) | ||
+ message( STATUS "${BoldMagenta}'GEOMODEL_SETUP_JSON' was set to 'true' ==> Explicitly setting up nlohmann_json${ColourReset}" ) | ||
+ # Now do what was requested. | ||
+ if(GEOMODEL_USE_BUILTIN_JSON) | ||
+ # Tell the user what's happening. | ||
+ message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project${ColourReset}" ) | ||
|
||
+ # The include directory and library that will be produced. | ||
+ set(nlohmann_json_INCLUDE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" ) | ||
+ set(nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" ) | ||
+ set(nlohmann_json_VERSION "3.6.1" ) | ||
+ set(nlohmann_json_FOUND TRUE ) | ||
+ message(STATUS "Installing the built-in 'nlohmann_json' in: ${nlohmann_json_INCLUDE_DIR}") | ||
+ | ||
+ # Create the include directory already, otherwise CMake refuses to | ||
+ # create the imported target. | ||
+ file(MAKE_DIRECTORY "${nlohmann_json_INCLUDE_DIR}") | ||
+ | ||
+ # Build/install nlohmann_json using ExternalProject_Add(...). | ||
+ include( ExternalProject ) | ||
+ ExternalProject_Add(JSONExt | ||
+ PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONBuild | ||
+ INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall | ||
+ URL "https://cern.ch/lcgpackages/tarFiles/sources/json-${nlohmann_json_VERSION}.tar.gz" | ||
+ URL_MD5 "c53592d55e7fec787cf0a406d36098a3" | ||
+ CMAKE_CACHE_ARGS | ||
+ -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
+ -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} | ||
+ -DJSON_BuildTests:BOOL=OFF | ||
+ -DJSON_MultipleHeaders:BOOL=ON | ||
+ BUILD_BYPRODUCTS "${nlohmann_json_INCLUDE_DIR}" ) | ||
+ install(DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/ | ||
+ DESTINATION . | ||
+ COMPONENT Development | ||
+ USE_SOURCE_PERMISSIONS) | ||
+ | ||
+ # Set up nlohmann_json's imported target. | ||
+ add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED) | ||
+ set_property(TARGET nlohmann_json::nlohmann_json PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}") | ||
+ | ||
+ # Auto handle dependency | ||
+ add_dependencies(nlohmann_json::nlohmann_json JSONExt) | ||
+ | ||
+ else() | ||
+ # Find an existing installation of nlohmann_json. | ||
+ find_package(nlohmann_json REQUIRED) | ||
+ endif() | ||
else() | ||
- # Find an existing installation of nlohmann_json. | ||
- find_package(nlohmann_json REQUIRED) | ||
+ if(NOT TARGET nlohmann_json::nlohmann_json) | ||
+ message(FATAL_ERROR "The 'nlohmann_json' target was not found, and 'GEOMODEL_SETUP_JSON' was set to 'false'") | ||
+ endif() | ||
endif() | ||
-- | ||
2.39.3 (Apple Git-145) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters