From 7414f76ce92acb8abe4021a9297f90a4cee29a3a Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Thu, 24 Nov 2022 16:36:55 +0100 Subject: [PATCH] build: only require Zydis on x86 Zydis is only used on x86, and this patch allows compilation on ARM without Zydis installed. --- CMakeLists.txt | 6 ++++-- externals/CMakeLists.txt | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf3e69a5..9a8c4acf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,8 +139,10 @@ if (DYNARMIC_NO_BUNDLED_XBYAK AND NOT TARGET xbyak) endif() if (DYNARMIC_NO_BUNDLED_ZYDIS AND NOT TARGET Zydis) - find_package(Zydis REQUIRED) - add_library(Zydis ALIAS Zydis::Zydis) + if (ARCHITECTURE STREQUAL "x86" OR ARCHITECTURE STREQUAL "x86_64") + find_package(Zydis REQUIRED) + add_library(Zydis ALIAS Zydis::Zydis) + endif() endif() # Enable unit-testing. diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index abbb9a55..dcc25aaa 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -57,9 +57,11 @@ endif() # zydis if (NOT TARGET Zydis) - option(ZYDIS_BUILD_TOOLS "" OFF) - option(ZYDIS_BUILD_EXAMPLES "" OFF) - option(ZYDIS_BUILD_DOXYGEN "" OFF) - set(ZYAN_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "") - add_subdirectory(zydis EXCLUDE_FROM_ALL) + if (ARCHITECTURE STREQUAL "x86" OR ARCHITECTURE STREQUAL "x86_64") + option(ZYDIS_BUILD_TOOLS "" OFF) + option(ZYDIS_BUILD_EXAMPLES "" OFF) + option(ZYDIS_BUILD_DOXYGEN "" OFF) + set(ZYAN_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "") + add_subdirectory(zydis EXCLUDE_FROM_ALL) + endif() endif()