cmake: fix static standalone build

This commit is contained in:
Alexandre Bouvier 2023-02-27 09:16:10 +01:00 committed by merry
parent e92f69aca0
commit b3a92ab54d
4 changed files with 26 additions and 30 deletions

View file

@ -141,6 +141,7 @@ endif()
if (DYNARMIC_USE_LLVM)
find_package(LLVM REQUIRED CONFIG)
separate_arguments(LLVM_DEFINITIONS)
endif()
if (DYNARMIC_TESTS)

View file

@ -2,31 +2,28 @@
include(CMakeFindDependencyMacro)
set(ARCHITECTURE @ARCHITECTURE@)
set(ARCHITECTURE "@ARCHITECTURE@")
find_dependency(Boost 1.57 REQUIRED)
if (NOT @CMAKE_DISABLE_FIND_PACKAGE_fmt@)
find_dependency(fmt 9 QUIET)
endif()
if (NOT @CMAKE_DISABLE_FIND_PACKAGE_mcl@)
find_dependency(mcl 0.1.12 EXACT QUIET)
endif()
if (NOT @CMAKE_DISABLE_FIND_PACKAGE_tsl-robin-map@)
find_dependency(tsl-robin-map QUIET)
endif()
if (NOT @BUILD_SHARED_LIBS@)
find_dependency(Boost 1.57)
find_dependency(fmt 9)
find_dependency(mcl 0.1.12 EXACT)
find_dependency(tsl-robin-map)
if ("x86_64" IN_LIST ARCHITECTURE)
if (NOT @CMAKE_DISABLE_FIND_PACKAGE_xbyak@)
find_dependency(xbyak 6 QUIET)
if ("arm64" IN_LIST ARCHITECTURE)
find_dependency(oaknut)
endif()
if (NOT @CMAKE_DISABLE_FIND_PACKAGE_Zydis@)
find_dependency(Zydis 4 QUIET)
endif()
endif()
if (@DYNARMIC_USE_LLVM@)
find_dependency(LLVM REQUIRED CONFIG)
if ("x86_64" IN_LIST ARCHITECTURE)
find_dependency(xbyak 6)
find_dependency(Zydis 4)
endif()
if (@DYNARMIC_USE_LLVM@)
find_dependency(LLVM CONFIG)
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components(@PROJECT_NAME@)

View file

@ -2,6 +2,7 @@
if (BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
endif()
# Allow options shadowing with normal variables when subproject use old cmake policy
@ -27,35 +28,35 @@ endif()
if (NOT TARGET fmt::fmt)
# fmtlib formatting library
set(FMT_INSTALL ON)
add_subdirectory(fmt EXCLUDE_FROM_ALL)
add_subdirectory(fmt)
endif()
# mcl
if (NOT TARGET merry::mcl)
set(MCL_INSTALL ON)
add_subdirectory(mcl EXCLUDE_FROM_ALL)
add_subdirectory(mcl)
endif()
# oaknut
if (NOT TARGET merry::oaknut)
if ("arm64" IN_LIST ARCHITECTURE)
add_subdirectory(oaknut EXCLUDE_FROM_ALL)
add_subdirectory(oaknut)
endif()
endif()
# robin-map
if (NOT TARGET tsl::robin_map)
add_subdirectory(robin-map EXCLUDE_FROM_ALL)
add_subdirectory(robin-map)
endif()
# xbyak
if (NOT TARGET xbyak::xbyak)
if ("x86_64" IN_LIST ARCHITECTURE)
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
add_subdirectory(xbyak)
endif()
endif()
@ -68,7 +69,7 @@ if (NOT TARGET Zydis::Zydis)
set(ZYDIS_BUILD_DOXYGEN OFF)
set(ZYAN_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "")
set(CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON)
add_subdirectory(zydis EXCLUDE_FROM_ALL)
add_subdirectory(zydis)
add_library(Zydis::Zydis ALIAS Zydis)
endif()
endif()

View file

@ -468,10 +468,7 @@ target_link_libraries(dynarmic
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)
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)