me
/
guix
Archived
1
0
Fork 0
This repository has been archived on 2024-08-07. You can view files and clone it, but cannot push or open issues/pull-requests.
guix/gnu/packages/patches/cling-use-shared-library.patch

108 lines
4.0 KiB
Diff

Upstream status: https://github.com/root-project/root/pull/15563
diff --git a/interpreter/cling/CMakeLists.txt b/interpreter/cling/CMakeLists.txt
index 9775b07f10..7028042096 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,81 +13,22 @@ endif(WIN32)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
project(Cling)
- # Rely on llvm-config.
- set(CONFIG_OUTPUT)
- find_program(LLVM_CONFIG "llvm-config")
- if(LLVM_CONFIG)
- message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
- set(CONFIG_COMMAND ${LLVM_CONFIG}
- "--assertion-mode"
- "--bindir"
- "--libdir"
- "--includedir"
- "--prefix")
- execute_process(
- COMMAND ${CONFIG_COMMAND}
- RESULT_VARIABLE HAD_ERROR
- OUTPUT_VARIABLE CONFIG_OUTPUT
- )
- if(NOT HAD_ERROR)
- string(REGEX REPLACE
- "[ \t]*[\r\n]+[ \t]*" ";"
- CONFIG_OUTPUT ${CONFIG_OUTPUT})
- else()
- string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
- message(STATUS "${CONFIG_COMMAND_STR}")
- message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
- endif()
- else()
- message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
- endif()
+ # See <https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project>.
+ find_package(LLVM REQUIRED CONFIG)
+ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
+ message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
- list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
- list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
- list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
- list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
- list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
-
- if(NOT MSVC_IDE)
- set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
- CACHE BOOL "Enable assertions")
- # Assertions should follow llvm-config's.
- mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
- endif()
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+ add_definitions(${LLVM_DEFINITIONS_LIST})
- set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
- set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
- set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
- set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
+ find_package(Clang REQUIRED CONFIG)
+ message(STATUS "Found supported version: Clang ${CLANG_PACKAGE_VERSION}")
+ message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
- set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
- if(EXISTS ${LLVMCONFIG_FILE})
- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
- include(${LLVMCONFIG_FILE})
- else()
- message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
- endif()
-
- # They are used as destination of target generators.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
- if(WIN32 OR CYGWIN)
- # DLL platform -- put DLLs into bin.
- set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
- else()
- set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
- endif()
-
- option(LLVM_INSTALL_TOOLCHAIN_ONLY
- "Only include toolchain files in the 'install' target." OFF)
-
- option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
- "Set to ON to force using an old, unsupported host toolchain." OFF)
-
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)
include(TableGen)
include(HandleLLVMOptions)
@@ -99,7 +40,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
set(LLVM_INCLUDE_TESTS ON)
endif()
- include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+ include_directories("${LLVM_INCLUDE_DIRS}")
link_directories("${LLVM_LIBRARY_DIR}")
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )