[cmake] refactor: Use CPM over submodules #143

Merged
crueter merged 42 commits from refactor/cpm into master 2025-08-04 04:50:17 +02:00
3 changed files with 27 additions and 17 deletions
Showing only changes of commit dfda29b883 - Show all commits

View file

@ -144,12 +144,12 @@ if (DYNARMIC_USE_BUNDLED_EXTERNALS)
set(CMAKE_DISABLE_FIND_PACKAGE_oaknut ON) set(CMAKE_DISABLE_FIND_PACKAGE_oaknut ON)
set(CMAKE_DISABLE_FIND_PACKAGE_unordered_dense ON) set(CMAKE_DISABLE_FIND_PACKAGE_unordered_dense ON)
set(CMAKE_DISABLE_FIND_PACKAGE_xbyak ON) set(CMAKE_DISABLE_FIND_PACKAGE_xbyak ON)
set(CMAKE_DISABLE_FIND_PACKAGE_Zydis ON)
set(CPM_USE_LOCAL_PACKAGES OFF) set(CMAKE_DISABLE_FIND_PACKAGE_Zycore ON)
else()
set(CPM_USE_LOCAL_PACKAGES ON)
endif() endif()
set(CPM_USE_LOCAL_PACKAGES ON)
find_package(Boost 1.57 REQUIRED) find_package(Boost 1.57 REQUIRED)
find_package(fmt 9 CONFIG) find_package(fmt 9 CONFIG)
find_package(mcl 0.1.12 EXACT CONFIG) find_package(mcl 0.1.12 EXACT CONFIG)

View file

@ -1,5 +1,4 @@
include(CPM) include(CPM)
set(CPM_USE_LOCAL_PACKAGES ON)
# Always build externals as static libraries, even when dynarmic is built as shared # Always build externals as static libraries, even when dynarmic is built as shared
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
@ -67,6 +66,7 @@ CPMAddPackage(
URL "https://github.com/Lizzie841/unordered_dense/archive/e59d30b7b1.zip" URL "https://github.com/Lizzie841/unordered_dense/archive/e59d30b7b1.zip"
OPTIONS OPTIONS
"UNORDERED_DENSE_INSTALL ON" "UNORDERED_DENSE_INSTALL ON"
FIND_PACKAGE_ARGUMENTS "CONFIG"
) )
# xbyak # xbyak
@ -86,15 +86,15 @@ if ("x86_64" IN_LIST ARCHITECTURE)
URL "https://github.com/zyantific/zycore-c/archive/75a36c45ae.zip" URL "https://github.com/zyantific/zycore-c/archive/75a36c45ae.zip"
) )
CPMAddPackage( CPMAddPackage(
NAME Zydis NAME Zydis
VERSION 4 VERSION 4
URL "https://github.com/zyantific/zydis/archive/c2d2bab025.zip" URL "https://github.com/zyantific/zydis/archive/c2d2bab025.zip"
OPTIONS OPTIONS
"ZYDIS_BUILD_TOOLS OFF" "ZYDIS_BUILD_TOOLS OFF"
"ZYDIS_BUILD_EXAMPLES OFF" "ZYDIS_BUILD_EXAMPLES OFF"
"ZYDIS_BUILD_DOXYGEN OFF" "ZYDIS_BUILD_DOXYGEN OFF"
"ZYAN_ZYCORE_PATH ${Zycore_SOURCE_DIR}" "ZYAN_ZYCORE_PATH ${Zycore_SOURCE_DIR}"
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON" "CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON"
) )
endif() endif()

View file

@ -399,13 +399,23 @@ set_target_properties(dynarmic PROPERTIES
VERSION ${dynarmic_VERSION} VERSION ${dynarmic_VERSION}
SOVERSION ${dynarmic_VERSION_MAJOR}.${dynarmic_VERSION_MINOR} SOVERSION ${dynarmic_VERSION_MAJOR}.${dynarmic_VERSION_MINOR}
) )
if (TARGET unordered_dense::unordered_dense)
message(STATUS "Found system unordered_dense kjbgjdskfsdfb")
# weird quirk of system installs
target_link_libraries(dynarmic
PRIVATE
unordered_dense::unordered_dense
)
endif()
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS}) target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
target_link_libraries(dynarmic target_link_libraries(dynarmic
PRIVATE PRIVATE
Boost::boost Boost::boost
fmt::fmt fmt::fmt
merry::mcl merry::mcl
unordered_dense
) )
if (DYNARMIC_USE_LLVM) if (DYNARMIC_USE_LLVM)
target_include_directories(dynarmic PRIVATE ${LLVM_INCLUDE_DIRS}) target_include_directories(dynarmic PRIVATE ${LLVM_INCLUDE_DIRS})