Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[interpreter] Revert patch to move ClangConfig.cmake #17354

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -223,8 +227,8 @@ if(builtin_llvm)
add_subdirectory(llvm-project/llvm EXCLUDE_FROM_ALL)
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")
Expand Down Expand Up @@ -446,18 +450,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_CONFIG_CMAKE_DIR "${CMAKE_BINARY_DIR}/lib/cmake/clang/")
else()
set(Clang_DIR "${LLVM_BINARY_DIR}/lib/cmake/clang/")
set(CLANG_CONFIG_CMAKE_DIR "${LLVM_BINARY_DIR}/lib/cmake/clang/")
endif()

# Reset the compiler flags after compiling LLVM and Clang
Expand Down Expand Up @@ -505,7 +508,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 "")



Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_CONFIG_CMAKE_DIR}")

find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_CONFIG_CMAKE_DIR}")
set(CLING_CONFIG_EXPORTS_FILE "${cling_cmake_builddir}/ClingTargets.cmake")
set(CLING_CONFIG_INCLUDE_DIRS
"${CLING_SOURCE_DIR}/include"
Expand Down
6 changes: 1 addition & 5 deletions interpreter/cling/tools/plugins/clad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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_CONFIG_CMAKE_DIR}
${_clad_extra_cmake_args}
# FIXME
# Building with 1 core is a temporary workaround for #16654 and has to be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading