cmake: allow shared llvm linking

This commit is contained in:
Alexandre Bouvier 2022-11-28 00:06:31 +01:00 committed by merry
parent 63ebed5760
commit 4bf4d6565e
2 changed files with 8 additions and 4 deletions

View file

@ -139,9 +139,6 @@ endif()
if (DYNARMIC_USE_LLVM)
find_package(LLVM REQUIRED CONFIG)
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(-DDYNARMIC_USE_LLVM ${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs armdesc armdisassembler aarch64desc aarch64disassembler x86desc x86disassembler)
endif()
if (DYNARMIC_TESTS)

View file

@ -454,8 +454,15 @@ target_link_libraries(dynarmic
fmt::fmt
merry::mcl
tsl::robin_map
"$<$<BOOL:DYNARMIC_USE_LLVM>:${llvm_libs}>"
)
if (DYNARMIC_USE_LLVM)
target_include_directories(dynarmic PRIVATE ${LLVM_INCLUDE_DIRS})
target_compile_definitions(dynarmic PRIVATE DYNARMIC_USE_LLVM=1 ${LLVM_DEFINITIONS})
if (BUILD_SHARED_LIBS)
set(USE_SHARED "USE_SHARED")
endif()
llvm_config(dynarmic ${USE_SHARED} armdesc armdisassembler aarch64desc aarch64disassembler x86desc x86disassembler)
endif()
if (DYNARMIC_ENABLE_CPU_FEATURE_DETECTION)
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1)
endif()