Skip to content

Commit

Permalink
fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
p4vook committed Dec 15, 2023
1 parent cf18068 commit f367c0b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions cmake/CppInterOp/CppInterOpConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ endif()

set(link_libs
${cling_clang_interp}
clangAST
clangBasic
clangFrontend
clangLex
clangSema
clang-cpp
dl
)

Expand Down
9 changes: 2 additions & 7 deletions lib/Interpreter/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

0 comments on commit f367c0b

Please sign in to comment.