From 41bb9fddfc7ba9e35ceb94eca944676cf6d4a6ca Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 21 Oct 2023 13:46:56 +1000 Subject: [PATCH] CMake: Fix Debug x64 builds on Linux --- dep/CMakeLists.txt | 6 ++++ dep/xbyak/CMakeLists.txt | 2 ++ dep/zydis/CMakeLists.txt | 77 ++++++++++++++++++++++++++++++++++++++++ src/core/CMakeLists.txt | 2 +- 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 dep/xbyak/CMakeLists.txt create mode 100644 dep/zydis/CMakeLists.txt diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 6b4473f9d..368363ef2 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -49,6 +49,12 @@ if(ENABLE_DISCORD_PRESENCE) disable_compiler_warnings_for_target(discord-rpc) endif() +if(${CPU_ARCH} STREQUAL "x64") + add_subdirectory(xbyak EXCLUDE_FROM_ALL) + add_subdirectory(zydis EXCLUDE_FROM_ALL) + disable_compiler_warnings_for_target(zydis) +endif() + if(${CPU_ARCH} STREQUAL "aarch32" OR ${CPU_ARCH} STREQUAL "aarch64") add_subdirectory(vixl EXCLUDE_FROM_ALL) disable_compiler_warnings_for_target(vixl) diff --git a/dep/xbyak/CMakeLists.txt b/dep/xbyak/CMakeLists.txt new file mode 100644 index 000000000..26017bd3c --- /dev/null +++ b/dep/xbyak/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(xbyak INTERFACE) +target_include_directories(xbyak INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/xbyak") diff --git a/dep/zydis/CMakeLists.txt b/dep/zydis/CMakeLists.txt new file mode 100644 index 000000000..812b4ca65 --- /dev/null +++ b/dep/zydis/CMakeLists.txt @@ -0,0 +1,77 @@ +add_library(zydis + dependencies/zycore/include/Zycore/Allocator.h + dependencies/zycore/include/Zycore/Comparison.h + dependencies/zycore/include/Zycore/Defines.h + dependencies/zycore/include/Zycore/Format.h + dependencies/zycore/include/Zycore/LibC.h + dependencies/zycore/include/Zycore/Object.h + dependencies/zycore/include/Zycore/Status.h + dependencies/zycore/include/Zycore/String.h + dependencies/zycore/include/Zycore/Types.h + dependencies/zycore/include/Zycore/Vector.h + dependencies/zycore/src/Allocator.c + dependencies/zycore/src/Format.c + dependencies/zycore/src/String.c + dependencies/zycore/src/Vector.c + include/Zydis/Decoder.h + include/Zydis/DecoderTypes.h + include/Zydis/Defines.h + include/Zydis/Disassembler.h + include/Zydis/FormatterBuffer.h + include/Zydis/Formatter.h + include/Zydis/Generated/EnumInstructionCategory.h + include/Zydis/Generated/EnumISAExt.h + include/Zydis/Generated/EnumISASet.h + include/Zydis/Generated/EnumMnemonic.h + include/Zydis/Generated/EnumRegister.h + include/Zydis/Internal/DecoderData.h + include/Zydis/Internal/FormatterATT.h + include/Zydis/Internal/FormatterBase.h + include/Zydis/Internal/FormatterIntel.h + include/Zydis/Internal/SharedData.h + include/Zydis/Internal/String.h + include/Zydis/MetaInfo.h + include/Zydis/Mnemonic.h + include/Zydis/Register.h + include/Zydis/Segment.h + include/Zydis/SharedTypes.h + include/Zydis/ShortString.h + include/Zydis/Status.h + include/Zydis/Utils.h + include/Zydis/Zydis.h + src/Decoder.c + src/DecoderData.c + src/Disassembler.c + src/FormatterATT.c + src/FormatterBase.c + src/FormatterBuffer.c + src/Formatter.c + src/FormatterIntel.c + src/MetaInfo.c + src/Mnemonic.c + src/Register.c + src/Segment.c + src/SharedData.c + src/String.c + src/Utils.c + src/Zydis.c +) + +target_compile_definitions(zydis PUBLIC + ZYCORE_STATIC_BUILD + ZYDIS_DISABLE_ENCODER + ZYDIS_DISABLE_AVX512 + ZYDIS_DISABLE_KNC + ZYDIS_STATIC_BUILD +) + +target_include_directories(zydis PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zycore/include + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +target_include_directories(zydis PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zycore/src + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ee3cdf607..d7812e0ab 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -133,11 +133,11 @@ target_link_libraries(core PUBLIC Threads::Threads common util zlib) target_link_libraries(core PRIVATE stb xxhash imgui rapidjson rcheevos) if(${CPU_ARCH} STREQUAL "x64") - target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../dep/xbyak/xbyak") target_compile_definitions(core PUBLIC "XBYAK_NO_EXCEPTION=1" "ENABLE_RECOMPILER=1" "ENABLE_MMAP_FASTMEM=1") target_sources(core PRIVATE ${RECOMPILER_SRCS} cpu_recompiler_code_generator_x64.cpp ) + target_link_libraries(core PRIVATE xbyak zydis) message("Building x64 recompiler") if(ENABLE_NEWREC)