Skip to content

Fix of build issues #172

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 5 additions & 4 deletions cmake/CppInterOp/CppInterOpConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 1 addition & 5 deletions lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -29,11 +29,7 @@ endif()

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

9 changes: 2 additions & 7 deletions lib/Interpreter/Compatibility.h
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to support earlier versions than clang 16.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're still supported, CLANG_RESOURCE_DIR is manually defined for them

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());
}