diff --git a/CMakeLists.txt b/CMakeLists.txt index 54c387ace3..eefa836a02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -534,7 +534,9 @@ endif() # - place the CMakeLists.txt in the first-level subdirectory, e.g. # Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory) # -add_subdirectory(Externals/Bochs_disasm) +if (_M_X86) + add_subdirectory(Externals/Bochs_disasm) +endif() add_subdirectory(Externals/cpp-optparse) add_subdirectory(Externals/glslang) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 0fecda7e8b..7da9192507 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -295,11 +295,15 @@ PUBLIC videosoftware PRIVATE - bdisasm ${LZO} ZLIB::ZLIB ) +if ((DEFINED CMAKE_ANDROID_ARCH_ABI AND CMAKE_ANDROID_ARCH_ABI MATCHES "x86|x86_64") OR + (NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86)) + target_link_libraries(core PRIVATE bdisasm) +endif() + if (APPLE) target_link_libraries(core PRIVATE diff --git a/Source/Core/UICommon/CMakeLists.txt b/Source/Core/UICommon/CMakeLists.txt index b6dde75014..6e5efecaff 100644 --- a/Source/Core/UICommon/CMakeLists.txt +++ b/Source/Core/UICommon/CMakeLists.txt @@ -16,10 +16,14 @@ PUBLIC cpp-optparse PRIVATE - bdisasm $<$:${IOK_LIBRARY}> ) +if ((DEFINED CMAKE_ANDROID_ARCH_ABI AND CMAKE_ANDROID_ARCH_ABI MATCHES "x86|x86_64") OR + (NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86)) + target_link_libraries(uicommon PRIVATE bdisasm) +endif() + if(USE_X11) target_sources(uicommon PRIVATE X11Utils.cpp) endif() diff --git a/Source/Core/UICommon/Disassembler.cpp b/Source/Core/UICommon/Disassembler.cpp index 597669c99f..4f6c49c197 100644 --- a/Source/Core/UICommon/Disassembler.cpp +++ b/Source/Core/UICommon/Disassembler.cpp @@ -1,11 +1,11 @@ -#include // Bochs - #if defined(HAVE_LLVM) // PowerPC.h defines PC. // This conflicts with a function that has an argument named PC #undef PC #include #include +#elif defined(_M_X86) +#include // Bochs #endif #include "Common/StringUtil.h" @@ -16,18 +16,6 @@ #include "UICommon/Disassembler.h" -class HostDisassemblerX86 : public HostDisassembler -{ -public: - HostDisassemblerX86(); - -private: - disassembler m_disasm; - - std::string DisassembleHostBlock(const u8* code_start, const u32 code_size, - u32* host_instructions_count, u64 starting_pc) override; -}; - #if defined(HAVE_LLVM) class HostDisassemblerLLVM : public HostDisassembler { @@ -126,7 +114,18 @@ std::string HostDisassemblerLLVM::DisassembleHostBlock(const u8* code_start, con return x86_disasm.str(); } -#endif +#elif defined(_M_X86) +class HostDisassemblerX86 : public HostDisassembler +{ +public: + HostDisassemblerX86(); + +private: + disassembler m_disasm; + + std::string DisassembleHostBlock(const u8* code_start, const u32 code_size, + u32* host_instructions_count, u64 starting_pc) override; +}; HostDisassemblerX86::HostDisassemblerX86() { @@ -150,6 +149,7 @@ std::string HostDisassemblerX86::DisassembleHostBlock(const u8* code_start, cons return x86_disasm.str(); } +#endif std::unique_ptr GetNewDisassembler(const std::string& arch) {