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

CMake: support LLVM as a single shared library #2291

Merged
merged 1 commit into from
Aug 23, 2023
Merged
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
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,17 @@ if (WITH_LLVM)
add_definitions("-DHAVE_TARGET_X86=1")
endif()

llvm_map_components_to_libnames(llvm_libs ${LPYTHON_LLVM_COMPONENTS})
if (TARGET LLVMCore)
# If `LLVMCore` target is present, then LLVM is distributed as separate
# libraries and llvm_map_components_to_libnames() should work:
llvm_map_components_to_libnames(llvm_libs ${LPYTHON_LLVM_COMPONENTS})
else()
# Workaround for https://github.com/llvm/llvm-project/issues/34593
# If LLVM is distributed as a single library (the LLVMCore target is
# missing), we set `llvm_libs` to "LLVM" which links against the single
# `libLLVM.so` shared library.
set(llvm_libs "LLVM")
endif()
unset(LPYTHON_LLVM_COMPONENTS)

add_library(p::llvm INTERFACE IMPORTED)
Expand Down