From 9b20bb1e1589d95950b787085869f04e9068f0a6 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 13 Apr 2025 15:39:54 +0200 Subject: [PATCH 1/3] [CMake] Don't check if `theanos` library is available The `theanos` library is not used in any test anyway, and looking for it will pollute the CMake output with "not found" messages. --- tmva/pymva/test/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tmva/pymva/test/CMakeLists.txt b/tmva/pymva/test/CMakeLists.txt index f0f76f74b6a65..9605c0bb5e7fa 100644 --- a/tmva/pymva/test/CMakeLists.txt +++ b/tmva/pymva/test/CMakeLists.txt @@ -16,7 +16,6 @@ set(Libraries Core MathCore TMVA PyMVA ROOTTMVASofie) # Look for needed python modules ROOT_FIND_PYTHON_MODULE(torch) ROOT_FIND_PYTHON_MODULE(keras) -ROOT_FIND_PYTHON_MODULE(theano) ROOT_FIND_PYTHON_MODULE(tensorflow) ROOT_FIND_PYTHON_MODULE(sklearn) From 7db0415cd14227d34ec225621966dcc4432491e4 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 13 Apr 2025 15:41:24 +0200 Subject: [PATCH 2/3] [CMake] Disable linking against shared LLVM also for builtin_clang=OFF Disable linking against shared LLVM also for `builtin_clang=OFF`. We have to do this after find_package(Clang). Finding Clang internally calls find_package(LLVM), which overwrites LLVM_LINK_LLVM_DYLIB to what it was set when building LLVM. --- interpreter/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt index e6512a888284c..0df222284c792 100644 --- a/interpreter/CMakeLists.txt +++ b/interpreter/CMakeLists.txt @@ -407,6 +407,12 @@ if (builtin_clang) else() find_package(Clang REQUIRED CONFIG) message(STATUS "Found Clang ${CLANG_PACKAGE_VERSION} in ${CLANG_CMAKE_DIR}") + + # Disable linking against shared LLVM. + # We have to do this after find_package(Clang). Finding Clang internally + # calls find_package(LLVM), which overwrites LLVM_LINK_LLVM_DYLIB to what it + # was set when building LLVM. + set(LLVM_LINK_LLVM_DYLIB FALSE) endif() # Reset the compiler flags after compiling LLVM and Clang From 82b1a496f05e9df6279d3bcac5e0f08156250dac Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 13 Apr 2025 15:39:19 +0200 Subject: [PATCH 3/3] [CMake] Improve Clang directory deduction in `core/clingutils` Assume that the Clang versions alsways matches the LLVM version to simplify the code, and also make it possible to find Clang installations separate from the LLVM directory by considering `CLANG_INSTALL_PREFIX`. --- core/clingutils/CMakeLists.txt | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/core/clingutils/CMakeLists.txt b/core/clingutils/CMakeLists.txt index ec4024f1d9b14..4e592dbdecde9 100644 --- a/core/clingutils/CMakeLists.txt +++ b/core/clingutils/CMakeLists.txt @@ -80,31 +80,19 @@ foreach(dict ${stldicts}) target_include_directories(${dict}Dict PRIVATE ${CMAKE_SOURCE_DIR}/interpreter/cling/include/cling/cint) endforeach() -set(CLANG_RESOURCE_DIR_STEM) if (builtin_clang) - set(CLANG_RESOURCE_DIR_STEM ${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm/${CMAKE_CFG_INTDIR}/lib/clang) - set(CLANG_RESOURCE_DIR_VERSION ${LLVM_VERSION_MAJOR}) + set(CLANG_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm/${CMAKE_CFG_INTDIR}) else () - set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang) - # A user can define a clang version to use, otherwise find it (but will error if more than one version is present) - if (NOT DEFINED CLANG_RESOURCE_DIR_VERSION) - if (NOT EXISTS ${CLANG_RESOURCE_DIR_STEM}) - message(FATAL_ERROR "${CLANG_RESOURCE_DIR_STEM} does not exist. Please install clang.") - endif() - # There is no reasonable way to get the version of clang under which is its resource directory. - # For example, lib/clang/5.0.0/include. Deduce it. - file(GLOB CHILDREN RELATIVE ${CLANG_RESOURCE_DIR_STEM} ${CLANG_RESOURCE_DIR_STEM}/*) - list(LENGTH CHILDREN CHILDREN_LENGTH) - if (${CHILDREN_LENGTH} GREATER 1) - message(FATAL_ERROR "Found more than one version of clang. CLANG_RESOURCE_DIR_VERSION contains: '${CHILDREN}'." ) - endif() - - list(GET CHILDREN 0 CLANG_RESOURCE_DIR_VERSION) + # If no explicit Clang prefix is set, assume it lives inside LLVM prefix. + if(NOT DEFINED CLANG_INSTALL_PREFIX) + set(CLANG_INSTALL_PREFIX ${LLVM_DIR}) endif() endif() +# We only look for the Clang version that matches the LLVM version, because other setups are not supported. +set(CLANG_RESOURCE_DIR_VERSION ${LLVM_VERSION_MAJOR}) -set(CLANG_RESOURCE_DIR ${CLANG_RESOURCE_DIR_STEM}/${CLANG_RESOURCE_DIR_VERSION}/include) +set(CLANG_RESOURCE_DIR ${CLANG_INSTALL_PREFIX}/lib/clang/${CLANG_RESOURCE_DIR_VERSION}/include) #---Deal with clang resource here---------------------------------------------- install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/cling/lib/clang/${CLANG_RESOURCE_DIR_VERSION}/include/