From f367c0bbb2246e568feec72d68760bfb99f4fe6a Mon Sep 17 00:00:00 2001 From: Pavel Kalugin Date: Fri, 15 Dec 2023 18:08:06 +0300 Subject: [PATCH] fix build issues --- CMakeLists.txt | 2 +- cmake/CppInterOp/CppInterOpConfig.cmake.in | 9 +++++---- lib/Interpreter/CMakeLists.txt | 6 +----- lib/Interpreter/Compatibility.h | 9 ++------- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8b340a43..d4e066b53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,7 +326,7 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CppInterOp/CppInterOpConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/CppInterOp/CppInterOpConfigVersion.cmake @ONLY) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/CppInterOp +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/CppInterOp/ DESTINATION lib/cmake/CppInterOp FILES_MATCHING PATTERN "*.cmake" diff --git a/cmake/CppInterOp/CppInterOpConfig.cmake.in b/cmake/CppInterOp/CppInterOpConfig.cmake.in index 6a2a810a7..27b5d3e52 100644 --- a/cmake/CppInterOp/CppInterOpConfig.cmake.in +++ b/cmake/CppInterOp/CppInterOpConfig.cmake.in @@ -8,19 +8,20 @@ get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}" # Determine CMAKE_SHARED_LIBRARY_SUFFIX based on operating system include(CMakeSystemSpecificInformation) +include(GNUInstallDirs) ### build/install workaround if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/include") set(_include "${CPPINTEROP_INSTALL_PREFIX}/include") - set(_libs "${CPPINTEROP_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangCppInterOp${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(_libs "${CPPINTEROP_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}clangCppInterOp${CMAKE_SHARED_LIBRARY_SUFFIX}") else() set(_include "@CMAKE_CURRENT_SOURCE_DIR@/include") - set(_libs "@CMAKE_CURRENT_BINARY_DIR@/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangCppInterOp${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(_libs "@CMAKE_CURRENT_BINARY_DIR@/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}clangCppInterOp${CMAKE_SHARED_LIBRARY_SUFFIX}") endif() -if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/lib/cmake/CppInterOp") - set(_cmake "${CPPINTEROP_INSTALL_PREFIX}/lib/cmake/CppInterOp") +if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/CppInterOp") + set(_cmake "${CPPINTEROP_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/CppInterOp") else() set(_cmake "@CMAKE_CURRENT_SOURCE_DIR@/cmake/CppInterOp") endif() diff --git a/lib/Interpreter/CMakeLists.txt b/lib/Interpreter/CMakeLists.txt index 028ee567d..ae408cbc0 100644 --- a/lib/Interpreter/CMakeLists.txt +++ b/lib/Interpreter/CMakeLists.txt @@ -29,11 +29,7 @@ endif() set(link_libs ${cling_clang_interp} - clangAST - clangBasic - clangFrontend - clangLex - clangSema + clang-cpp dl ) diff --git a/lib/Interpreter/Compatibility.h b/lib/Interpreter/Compatibility.h index b84579c47..53504845f 100644 --- a/lib/Interpreter/Compatibility.h +++ b/lib/Interpreter/Compatibility.h @@ -276,16 +276,11 @@ inline std::string FixTypeName(const std::string type_name) { // Clang >= 16 change CLANG_LIBDIR_SUFFIX to CLANG_INSTALL_LIBDIR_BASENAME #if CLANG_VERSION_MAJOR < 16 #define CLANG_INSTALL_LIBDIR_BASENAME (llvm::Twine("lib") + CLANG_LIBDIR_SUFFIX) +#define CLANG_RESOURCE_DIR ("clang/" CLANG_VERSION_STRING) #endif inline std::string MakeResourceDir(llvm::StringRef Dir) { llvm::SmallString<128> P(Dir); - llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang", -#if CLANG_VERSION_MAJOR < 16 - CLANG_VERSION_STRING -#else - CLANG_VERSION_MAJOR_STRING -#endif - ); + llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, CLANG_RESOURCE_DIR); return std::string(P.str()); }