From 492aa3cb1015c69b8f49a1929c8cc48001250648 Mon Sep 17 00:00:00 2001 From: Castor215 <132155746+Castor215@users.noreply.github.com> Date: Sat, 7 Oct 2023 05:49:56 +0100 Subject: [PATCH] externals: allow user to use system dynarmic (#7044) --- CMakeLists.txt | 1 + externals/CMakeLists.txt | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67f380bc2..cfc5e22b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,7 @@ option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF) option(USE_SYSTEM_CPP_HTTPLIB "Use the system cpp-httplib (instead of the bundled one)" OFF) option(USE_SYSTEM_JSON "Use the system JSON (nlohmann-json3) package (instead of the bundled one)" OFF) +option(USE_SYSTEM_DYNARMIC "Use the system dynarmic (instead of the bundled one)" OFF) if (CITRA_USE_PRECOMPILED_HEADERS) message(STATUS "Using Precompiled Headers.") diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 9f50bbc73..37684654b 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -78,9 +78,20 @@ endif() # Dynarmic if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE) - set(DYNARMIC_TESTS OFF CACHE BOOL "") - set(DYNARMIC_FRONTENDS "A32" CACHE STRING "") - add_subdirectory(dynarmic EXCLUDE_FROM_ALL) + if(USE_SYSTEM_DYNARMIC) + find_package(dynarmic REQUIRED) + add_library(dynarmic INTERFACE) + target_link_libraries(dynarmic INTERFACE dynarmic::dynarmic) + # The dynarmic package's cmake files are helpfully completely silent + # so we have to inform the user of its status ourselves + if(TARGET dynarmic::dynarmic) + message(STATUS "Found dynarmic") + endif() + else() + set(DYNARMIC_TESTS OFF CACHE BOOL "") + set(DYNARMIC_FRONTENDS "A32" CACHE STRING "") + add_subdirectory(dynarmic EXCLUDE_FROM_ALL) + endif() endif() # getopt