Skip to content

Commit

Permalink
[CMake] Make it possible to pass existing CLAD_SOURCE_DIR
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guitargeek committed Oct 2, 2024
1 parent d5f48ef commit 2ec063a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ include(RootMacros)
include(CheckAssembler)
include(CheckIntrinsics)

if(clad AND NO_CONNECTION)
# Building Clad requires an internet connection, if we're not side-loading the source directory
if(clad AND NOT DEFINED CLAD_SOURCE_DIR AND NO_CONNECTION)
if(fail-on-missing)
message(FATAL_ERROR "No internet connection. Please check your connection, or either disable the 'clad' option or the 'fail-on-missing' to automatically disable options requiring internet access")
else()
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ ROOT_BUILD_OPTION(builtin_zstd OFF "Build included libzstd, or use system libzst
ROOT_BUILD_OPTION(ccache OFF "Enable ccache usage for speeding up builds")
ROOT_BUILD_OPTION(distcc OFF "Enable distcc usage for speeding up builds (ccache is called first if enabled)")
ROOT_BUILD_OPTION(cefweb OFF "Enable support for CEF (Chromium Embedded Framework) web-based display")
ROOT_BUILD_OPTION(clad ON "Build clad, the cling automatic differentiation plugin (requires network)")
ROOT_BUILD_OPTION(clad ON "Build clad, the cling automatic differentiation plugin (requires network, or existing source directory indicated with -DCLAD_SOURCE_DIR=<clad_src_path>)")
ROOT_BUILD_OPTION(cocoa OFF "Use native Cocoa/Quartz graphics backend (MacOS X only)")
ROOT_BUILD_OPTION(coverage OFF "Enable compile flags for coverage testing")
ROOT_BUILD_OPTION(cuda OFF "Enable support for CUDA (requires CUDA toolkit >= 7.5)")
ROOT_BUILD_OPTION(cudnn ON "Enable support for cuDNN (default when Cuda is enabled)")
ROOT_BUILD_OPTION(cudnn ON "Enable support for cuDNN (default when CUDA is enabled)")
ROOT_BUILD_OPTION(daos OFF "Enable RNTuple support for Intel DAOS")
ROOT_BUILD_OPTION(dataframe ON "Enable ROOT RDataFrame")
ROOT_BUILD_OPTION(test_distrdf_pyspark OFF "Enable distributed RDataFrame tests that use pyspark")
Expand Down
12 changes: 9 additions & 3 deletions interpreter/cling/tools/plugins/clad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2ec063a

Please sign in to comment.