Merge pull request #641 from abouvier/unbundle

CMakeLists: Add options to unbundle most external libraries
This commit is contained in:
merry 2021-08-25 07:56:12 +01:00 committed by GitHub
commit 1697902948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 10 deletions

View file

@ -122,6 +122,27 @@ if (NOT TARGET boost)
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIRS})
endif()
if (DYNARMIC_NO_BUNDLED_FMT AND NOT TARGET fmt)
find_package(fmt REQUIRED)
add_library(fmt ALIAS fmt::fmt)
endif()
if (DYNARMIC_NO_BUNDLED_ROBIN_MAP AND NOT TARGET tsl::robin_map)
find_package(tsl-robin-map REQUIRED)
endif()
if (DYNARMIC_NO_BUNDLED_XBYAK AND NOT TARGET xbyak)
if (ARCHITECTURE STREQUAL "x86" OR ARCHITECTURE STREQUAL "x86_64")
find_package(xbyak REQUIRED)
add_library(xbyak ALIAS xbyak::xbyak)
endif()
endif()
if (DYNARMIC_NO_BUNDLED_ZYDIS AND NOT TARGET Zydis)
find_package(Zydis REQUIRED)
add_library(Zydis ALIAS Zydis::Zydis)
endif()
# Enable unit-testing.
enable_testing(true)
@ -137,6 +158,11 @@ if (DYNARMIC_TESTS_USE_UNICORN)
find_package(Unicorn REQUIRED)
endif()
if (DYNARMIC_TESTS AND DYNARMIC_NO_BUNDLED_CATCH AND NOT TARGET catch)
find_package(Catch2 REQUIRED)
add_library(catch ALIAS Catch2::Catch2)
endif()
# Pull in externals CMakeLists for libs where available
add_subdirectory(externals)

View file

@ -4,12 +4,14 @@
# catch
if (DYNARMIC_TESTS AND NOT TARGET catch)
add_library(catch INTERFACE)
target_include_directories(catch INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/catch/include>)
endif()
# fmt
if (NOT DYNARMIC_NO_BUNDLED_FMT)
if (NOT TARGET fmt)
# fmtlib formatting library
add_subdirectory(fmt)
endif()
@ -21,9 +23,11 @@ target_include_directories(mp INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE
# robin-map
if (NOT TARGET tsl::robin_map)
add_library(robin_map INTERFACE)
add_library(tsl::robin_map ALIAS robin_map)
target_include_directories(robin_map SYSTEM INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/robin-map/include>")
endif()
# vixl
@ -45,7 +49,9 @@ endif()
# zydis
if (NOT TARGET Zydis)
option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_EXAMPLES "" OFF)
set(ZYDIS_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "")
add_subdirectory(zydis EXCLUDE_FROM_ALL)
endif()