Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, /acts/thirdparty/GeoModel/0001-Add-option-to-skip-setting-up-json-completely.patch is written in an unsupported language. File is not indexed.

0001 From dec8e912948cac74e5362ebc3b89f34e07ecd8e8 Mon Sep 17 00:00:00 2001
0002 From: Paul Gessinger <hello@paulgessinger.com>
0003 Date: Wed, 28 Feb 2024 11:17:47 +0100
0004 Subject: [PATCH] Add option to skip setting up json completely
0005 
0006 ---
0007  cmake/SetupJSON.cmake | 94 +++++++++++++++++++++++--------------------
0008  1 file changed, 51 insertions(+), 43 deletions(-)
0009 
0010 diff --git a/cmake/SetupJSON.cmake b/cmake/SetupJSON.cmake
0011 index 6eb203ec..41e4a1ed 100644
0012 --- a/cmake/SetupJSON.cmake
0013 +++ b/cmake/SetupJSON.cmake
0014 @@ -10,50 +10,58 @@ include_guard(GLOBAL)
0015 
0016  # Configuration option for how "nlohmann_json" should be used.
0017  option(GEOMODEL_USE_BUILTIN_JSON "Download and compile a version of nlohmann_json during the build" OFF)
0018 +option(GEOMODEL_SETUP_JSON "Whether to set up nlohmann_json at all, or expect the target to be present" ON)
0019 
0020 -# Now do what was requested.
0021 -if(GEOMODEL_USE_BUILTIN_JSON)
0022 -   # Tell the user what's happening.
0023 -   message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project${ColourReset}" )
0024 -
0025 -   # The include directory and library that will be produced.
0026 -   set(nlohmann_json_INCLUDE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" )
0027 -   set(nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" )
0028 -   set(nlohmann_json_VERSION "3.6.1" )
0029 -   set(nlohmann_json_FOUND TRUE )
0030 -   message(STATUS "Installing the built-in 'nlohmann_json' in: ${nlohmann_json_INCLUDE_DIR}")
0031 -
0032 -   # Create the include directory already, otherwise CMake refuses to
0033 -   # create the imported target.
0034 -   file(MAKE_DIRECTORY "${nlohmann_json_INCLUDE_DIR}")
0035 -
0036 -   # Build/install nlohmann_json using ExternalProject_Add(...).
0037 -   include( ExternalProject )
0038 -   ExternalProject_Add(JSONExt
0039 -     PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONBuild
0040 -     INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall
0041 -     URL "https://cern.ch/lcgpackages/tarFiles/sources/json-${nlohmann_json_VERSION}.tar.gz"
0042 -     URL_MD5 "c53592d55e7fec787cf0a406d36098a3"
0043 -     CMAKE_CACHE_ARGS
0044 -       -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
0045 -       -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
0046 -       -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
0047 -       -DJSON_BuildTests:BOOL=OFF
0048 -       -DJSON_MultipleHeaders:BOOL=ON
0049 -     BUILD_BYPRODUCTS "${nlohmann_json_INCLUDE_DIR}" )
0050 -   install(DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/
0051 -     DESTINATION .
0052 -     COMPONENT Development
0053 -     USE_SOURCE_PERMISSIONS)
0054 -
0055 -   # Set up nlohmann_json's imported target.
0056 -   add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
0057 -   set_property(TARGET nlohmann_json::nlohmann_json PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}")
0058 -
0059 -   # Auto handle dependency
0060 -   add_dependencies(nlohmann_json::nlohmann_json JSONExt)
0061 +if(GEOMODEL_SETUP_JSON)
0062 +   message( STATUS "${BoldMagenta}'GEOMODEL_SETUP_JSON' was set to 'true' ==> Explicitly setting up nlohmann_json${ColourReset}" )
0063 +   # Now do what was requested.
0064 +   if(GEOMODEL_USE_BUILTIN_JSON)
0065 +      # Tell the user what's happening.
0066 +      message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_JSON' was set to 'true' ==> Building nlohmann_json as part of the project${ColourReset}" )
0067 
0068 +      # The include directory and library that will be produced.
0069 +      set(nlohmann_json_INCLUDE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" )
0070 +      set(nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" )
0071 +      set(nlohmann_json_VERSION "3.6.1" )
0072 +      set(nlohmann_json_FOUND TRUE )
0073 +      message(STATUS "Installing the built-in 'nlohmann_json' in: ${nlohmann_json_INCLUDE_DIR}")
0074 +
0075 +      # Create the include directory already, otherwise CMake refuses to
0076 +      # create the imported target.
0077 +      file(MAKE_DIRECTORY "${nlohmann_json_INCLUDE_DIR}")
0078 +
0079 +      # Build/install nlohmann_json using ExternalProject_Add(...).
0080 +      include( ExternalProject )
0081 +      ExternalProject_Add(JSONExt
0082 +        PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONBuild
0083 +        INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall
0084 +        URL "https://cern.ch/lcgpackages/tarFiles/sources/json-${nlohmann_json_VERSION}.tar.gz"
0085 +        URL_MD5 "c53592d55e7fec787cf0a406d36098a3"
0086 +        CMAKE_CACHE_ARGS
0087 +          -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
0088 +          -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
0089 +          -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
0090 +          -DJSON_BuildTests:BOOL=OFF
0091 +          -DJSON_MultipleHeaders:BOOL=ON
0092 +        BUILD_BYPRODUCTS "${nlohmann_json_INCLUDE_DIR}" )
0093 +      install(DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/
0094 +        DESTINATION .
0095 +        COMPONENT Development
0096 +        USE_SOURCE_PERMISSIONS)
0097 +
0098 +      # Set up nlohmann_json's imported target.
0099 +      add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
0100 +      set_property(TARGET nlohmann_json::nlohmann_json PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}")
0101 +
0102 +      # Auto handle dependency
0103 +      add_dependencies(nlohmann_json::nlohmann_json JSONExt)
0104 +
0105 +   else()
0106 +     # Find an existing installation of nlohmann_json.
0107 +     find_package(nlohmann_json REQUIRED)
0108 +   endif()
0109  else()
0110 -  # Find an existing installation of nlohmann_json.
0111 -  find_package(nlohmann_json REQUIRED)
0112 +   if(NOT TARGET nlohmann_json::nlohmann_json)
0113 +      message(FATAL_ERROR "The 'nlohmann_json' target was not found, and 'GEOMODEL_SETUP_JSON' was set to 'false'")
0114 +   endif()
0115  endif()
0116 --
0117 2.39.3 (Apple Git-145)