diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt index 162235343e66c..52f8eb8439e4b 100644 --- a/interpreter/CMakeLists.txt +++ b/interpreter/CMakeLists.txt @@ -2,6 +2,10 @@ set(CMAKE_MODULE_PATH "") #--- Check if we need to build llvm and clang ------------------------------------------------------ +if (builtin_llvm AND NOT builtin_clang) + message(FATAL_ERROR "Cannot enable builtin LLVM, but provide external Clang") +endif() + if (NOT builtin_clang) message(WARNING "Due to ROOT-specific patches you need a special version of clang. You cannot use vanilla clang.") endif() @@ -52,7 +56,7 @@ set(LLVM_FORCE_USE_OLD_TOOLCHAIN ON CACHE BOOL "") set(CMAKE_DISABLE_FIND_PACKAGE_CUDA ON) # will be set again in case NOT builtin_llvm -set(LLVM_DIR "${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm") +set(LLVM_DIR "${CMAKE_CURRENT_BINARY_DIR}/llvm-project/llvm") if (clad) set(CLING_BUILD_PLUGINS ON) endif() @@ -235,8 +239,8 @@ if(builtin_llvm) unset(CMAKE_MESSAGE_LOG_LEVEL) endif() - set(LLVM_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/interpreter/llvm-project/llvm/include - ${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm/include + set(LLVM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/llvm-project/llvm/include + ${CMAKE_CURRENT_BINARY_DIR}/llvm-project/llvm/include CACHE STRING "LLVM include directories." ) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/llvm-project/llvm/cmake/modules") @@ -458,18 +462,17 @@ endif(builtin_llvm) if (builtin_clang) if (builtin_llvm) - # For builtin LLVM this is set in interpreter/llvm-project/llvm/CMakeLists.txt - set(Clang_DIR "${LLVM_BINARY_DIR}/tools/clang/") + set(CLANG_BINARY_DIR "${LLVM_BINARY_DIR}/tools/clang/") else() - set(Clang_DIR "${CMAKE_BINARY_DIR}/interpreter/llvm-project/clang/") - set(Clang_Config_ExtraPathHints "${Clang_DIR}cmake/modules/CMakeFiles") + set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/llvm-project/clang/") endif() set(CLANG_INCLUDE_DIRS - ${CMAKE_SOURCE_DIR}/interpreter/llvm-project/clang/include - ${Clang_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/llvm-project/clang/include + ${CLANG_BINARY_DIR}/include CACHE STRING "Clang include directories.") + set(CLANG_CMAKE_DIR "${CMAKE_BINARY_DIR}/lib/cmake/clang/") else() - set(Clang_DIR "${LLVM_BINARY_DIR}/lib/cmake/clang/") + set(CLANG_CMAKE_DIR "${LLVM_BINARY_DIR}/lib/cmake/clang/") endif() # Reset the compiler flags after compiling LLVM and Clang @@ -517,7 +520,7 @@ if (builtin_cling) add_subdirectory(cling EXCLUDE_FROM_ALL) add_dependencies(CLING ${CLING_LIBRARIES}) - set(CLING_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/interpreter/cling/include CACHE STRING "") + set(CLING_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/cling/include CACHE STRING "") diff --git a/interpreter/cling/CMakeLists.txt b/interpreter/cling/CMakeLists.txt index 710de930b4ac4..c15ae096a30a6 100644 --- a/interpreter/cling/CMakeLists.txt +++ b/interpreter/cling/CMakeLists.txt @@ -23,7 +23,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) find_package(Clang REQUIRED CONFIG) message(STATUS "Found supported version: Clang ${CLANG_PACKAGE_VERSION}") - message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}") + message(STATUS "Using ClangConfig.cmake in: ${CLANG_CMAKE_DIR}") find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) @@ -111,6 +111,7 @@ else() list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") include(${LLVMCONFIG_FILE}) endif() + set(CLANG_CMAKE_DIR "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang") if (NOT CLANG_INCLUDE_DIRS) set (CLANG_INCLUDE_DIRS "${LLVM_MAIN_SRC_DIR}/tools/clang/include") if (NOT EXISTS ${CLANG_INCLUDE_DIRS}) diff --git a/interpreter/cling/cmake/modules/CMakeLists.txt b/interpreter/cling/cmake/modules/CMakeLists.txt index e28220db6a06b..4de71a0994783 100644 --- a/interpreter/cling/cmake/modules/CMakeLists.txt +++ b/interpreter/cling/cmake/modules/CMakeLists.txt @@ -13,7 +13,7 @@ export(TARGETS ${CLING_EXPORTS} FILE ${cling_cmake_builddir}/ClingTargets.cmake) # Generate ClingConfig.cmake for the build tree. set(CLING_CONFIG_CMAKE_DIR "${cling_cmake_builddir}") -set(CLING_CONFIG_CLANG_CMAKE_DIR "${clang_cmake_builddir}") +set(CLING_CONFIG_CLANG_CMAKE_DIR "${CLANG_CMAKE_DIR}") set(CLING_CONFIG_EXPORTS_FILE "${cling_cmake_builddir}/ClingTargets.cmake") set(CLING_CONFIG_INCLUDE_DIRS "${CLING_SOURCE_DIR}/include" diff --git a/interpreter/cling/tools/plugins/clad/CMakeLists.txt b/interpreter/cling/tools/plugins/clad/CMakeLists.txt index 3c70d00a10f3b..6c5c145da40f9 100644 --- a/interpreter/cling/tools/plugins/clad/CMakeLists.txt +++ b/interpreter/cling/tools/plugins/clad/CMakeLists.txt @@ -46,10 +46,6 @@ if (CMAKE_CXX_STANDARD) list(APPEND _clad_extra_cmake_args -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}) endif(CMAKE_CXX_STANDARD) -if (Clang_DIR) - list(APPEND _clad_extra_cmake_args -DClang_DIR=${Clang_DIR} -DClang_CONFIG_EXTRA_PATH_HINTS=${Clang_Config_ExtraPathHints}) -endif(Clang_DIR) - if (LLVM_FORCE_USE_OLD_TOOLCHAIN) list(APPEND _clad_extra_cmake_args -DLLVM_FORCE_USE_OLD_TOOLCHAIN=${LLVM_FORCE_USE_OLD_TOOLCHAIN}) endif(LLVM_FORCE_USE_OLD_TOOLCHAIN) @@ -94,7 +90,7 @@ ExternalProject_Add( -DCMAKE_CXX_FLAGS=${CLAD_CXX_FLAGS} -DCMAKE_INSTALL_PREFIX=${clad_install_dir}/plugins -DLLVM_DIR=${LLVM_BINARY_DIR} - -DCLANG_INCLUDE_DIRS=${CLANG_INCLUDE_DIRS} + -DClang_DIR=${CLANG_CMAKE_DIR} ${_clad_extra_cmake_args} # FIXME # Building with 1 core is a temporary workaround for #16654 and has to be diff --git a/interpreter/llvm-project/clang/cmake/modules/CMakeLists.txt b/interpreter/llvm-project/clang/cmake/modules/CMakeLists.txt index 9a3ffb0ee624a..d2d68121371bf 100644 --- a/interpreter/llvm-project/clang/cmake/modules/CMakeLists.txt +++ b/interpreter/llvm-project/clang/cmake/modules/CMakeLists.txt @@ -9,7 +9,7 @@ include(FindPrefixFromConfig) set(CLANG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/clang" CACHE STRING "Path for CMake subdirectory for Clang (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/clang')") # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -set(clang_cmake_builddir "${CLANG_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang") +set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang") # Keep this in sync with llvm/cmake/CMakeLists.txt! set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING diff --git a/interpreter/llvm-project/llvm-project.tag b/interpreter/llvm-project/llvm-project.tag index e06c311eb1fb0..b6c5cd7502d0a 100644 --- a/interpreter/llvm-project/llvm-project.tag +++ b/interpreter/llvm-project/llvm-project.tag @@ -1 +1 @@ -ROOT-llvm18-20250117-01 \ No newline at end of file +ROOT-llvm18-20250121-01