From 5f9a0faccc5ccab15b24be0b44e65431c29642b0 Mon Sep 17 00:00:00 2001
From: Yuri Konotopov <ykonotopov@gnome.org>
Date: Wed, 25 Mar 2020 21:08:50 +0400
Subject: [PATCH] externals: allow to skip bundled dependencies

---
 CMakeLists.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5a26d50..e5a0c83a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,7 @@ endif()
 # Dynarmic project options
 option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
 option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" OFF)
+option(DYNARMIC_SKIP_EXTERNALS "Do not use bundled dependencies" OFF)
 option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
 option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
 option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)
@@ -132,8 +133,17 @@ if (DYNARMIC_TESTS_USE_UNICORN)
     find_package(Unicorn REQUIRED)
 endif()
 
+if (NOT DYNARMIC_SKIP_EXTERNALS)
 # Pull in externals CMakeLists for libs where available
 add_subdirectory(externals)
+else (NOT DYNARMIC_SKIP_EXTERNALS)
+	find_package(fmt 6.0 CONFIG REQUIRED)
+	message(STATUS "Using shared fmt ${fmt_VERSION}")
+
+	add_library(xbyak INTERFACE)
+	target_include_directories(xbyak SYSTEM INTERFACE /usr/include/xbyak)
+	target_compile_definitions(xbyak INTERFACE XBYAK_NO_OP_NAMES)
+endif (NOT DYNARMIC_SKIP_EXTERNALS)
 
 # Dynarmic project files
 add_subdirectory(src)
-- 
2.24.1

