From 149b49e609aab3eb903d9c5defedb7c8c059379c Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Wed, 2 Oct 2024 18:04:50 +0200 Subject: [PATCH] Make it possible to pass existing `CLAD_SOURCE_DIR` This would address two annoyances I have at the same time: 1. One can now clone both `root` and `clad`, linking the source directories together. This makes it much easier to try out changes in clad in the context of ROOT. 2. ROOT can now configure and build without an internet connection, even with `Dclad=ON`. This partially addresses #11603. --- tools/plugins/clad/CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/plugins/clad/CMakeLists.txt b/tools/plugins/clad/CMakeLists.txt index f6b9d29602..aa541e1db9 100644 --- a/tools/plugins/clad/CMakeLists.txt +++ b/tools/plugins/clad/CMakeLists.txt @@ -52,14 +52,20 @@ endif(LLVM_FORCE_USE_OLD_TOOLCHAIN) list(APPEND _clad_extra_cmake_args -DCLAD_BUILD_STATIC_ONLY=ON) # Wrap download, configure and build steps in a script to log output -set(_clad_cmake_logging_settings +set(_clad_extra_settings LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON ) -list(APPEND _clad_cmake_logging_settings LOG_OUTPUT_ON_FAILURE ON) +# If the CLAD_SOURCE_DIR variable is defined in the CMake configuration, we're +# skipping the download of the repository and use the passed directory. +if (DEFINED CLAD_SOURCE_DIR) + list(APPEND _clad_extra_settings DOWNLOAD_COMMAND "") + list(APPEND _clad_extra_settings SOURCE_DIR ${CLAD_SOURCE_DIR}) +endif() #list(APPEND _clad_patches_list "patch1.patch" "patch2.patch") #set(_clad_patch_command @@ -88,7 +94,7 @@ ExternalProject_Add( BUILD_COMMAND ${CMAKE_COMMAND} --build . ${EXTRA_BUILD_ARGS} INSTALL_COMMAND ${CMAKE_COMMAND} --build . ${EXTRA_BUILD_ARGS} --target install BUILD_BYPRODUCTS ${CLAD_BYPRODUCTS} - ${_clad_cmake_logging_settings} + ${_clad_extra_settings} # We need the target clangBasic to be built before building clad. However, we # support building prebuilt clang and adding clangBasic breaks this case. # Delegate the dependency resolution to the clingInterpreter target (which