From e09773b086c2cb350c8bca922e43d286bf00dd2d Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Mon, 27 Jul 2026 12:45:44 +0200 Subject: [PATCH] Redo build system based on ida-sdk repository --- .gitignore | 5 ++ .gitmodules | 3 + 3rdparty/byte_order.hpp | 2 +- 3rdparty/excrypt | 2 +- 3rdparty/ida-sdk | 1 + CMakeLists.txt | 104 +++++++++++++++++-------------- README.md | 37 ++++++----- formats/xex.hpp | 3 + idaloader.cpp | 4 +- idaloader_xbe.cpp | 4 +- idaxex.sln | 31 ---------- idaxex.vcxproj | 103 ------------------------------- idaxex.vcxproj.filters | 129 --------------------------------------- xex1tool.vcxproj | 127 -------------------------------------- xex1tool.vcxproj.filters | 114 ---------------------------------- xex1tool/CMakeLists.txt | 38 +++++++++--- 16 files changed, 130 insertions(+), 577 deletions(-) create mode 160000 3rdparty/ida-sdk delete mode 100644 idaxex.sln delete mode 100644 idaxex.vcxproj delete mode 100644 idaxex.vcxproj.filters delete mode 100644 xex1tool.vcxproj delete mode 100644 xex1tool.vcxproj.filters diff --git a/.gitignore b/.gitignore index b248083..9d80bbd 100644 --- a/.gitignore +++ b/.gitignore @@ -347,3 +347,8 @@ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 MigrationBackup/ + +# CMake +build*/ +cmake-build*/ +CMakeUserPresets.json diff --git a/.gitmodules b/.gitmodules index 29fad0f..59dfa44 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "3rdparty/XbSymbolDatabase"] path = 3rdparty/XbSymbolDatabase url = https://github.com/Cxbx-Reloaded/XbSymbolDatabase.git +[submodule "3rdparty/ida-sdk"] + path = 3rdparty/ida-sdk + url = https://github.com/HexRaysSA/ida-sdk.git diff --git a/3rdparty/byte_order.hpp b/3rdparty/byte_order.hpp index dae0226..50513fc 100644 --- a/3rdparty/byte_order.hpp +++ b/3rdparty/byte_order.hpp @@ -22,7 +22,7 @@ namespace xe { #define XENIA_BASE_BYTE_SWAP_16 _byteswap_ushort #define XENIA_BASE_BYTE_SWAP_32 _byteswap_ulong #define XENIA_BASE_BYTE_SWAP_64 _byteswap_uint64 -#elif XE_PLATFORM_MAC +#elif defined(XE_PLATFORM_MAC) || defined(__APPLE__) #include #define XENIA_BASE_BYTE_SWAP_16 OSSwapInt16 #define XENIA_BASE_BYTE_SWAP_32 OSSwapInt32 diff --git a/3rdparty/excrypt b/3rdparty/excrypt index fc70c3a..0880945 160000 --- a/3rdparty/excrypt +++ b/3rdparty/excrypt @@ -1 +1 @@ -Subproject commit fc70c3a5ed3c8d0626b80624dc022f1b284ca368 +Subproject commit 088094585aee1694cdeef9a9330d29d14aef9203 diff --git a/3rdparty/ida-sdk b/3rdparty/ida-sdk new file mode 160000 index 0000000..2348615 --- /dev/null +++ b/3rdparty/ida-sdk @@ -0,0 +1 @@ +Subproject commit 2348615c25f90e357cd2cc72fcfede1ba14ad41a diff --git a/CMakeLists.txt b/CMakeLists.txt index fb77aab..8f8e036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,49 +1,43 @@ -cmake_minimum_required(VERSION 3.27 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) -project(idaxex) +# --------------------------------------------------------------------------- +# IDA SDK +# +# The loader builds against the official IDA SDK +# (https://github.com/HexRaysSA/ida-sdk), vendored as the 3rdparty/ida-sdk +# submodule. That repository ships its own CMake package +# (find_package(idasdk)) together with the link stub libraries, so no separate +# SDK download or IDASDK environment variable is needed -- just make sure the +# submodules are checked out (git submodule update --init --recursive). +# --------------------------------------------------------------------------- +set(IDAXEX_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ida-sdk") -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_C_STANDARD 11) +if(NOT EXISTS "${IDAXEX_SDK_ROOT}/src/include/pro.h") + message(FATAL_ERROR + "IDA SDK submodule not found at ${IDAXEX_SDK_ROOT}. " + "Run: git submodule update --init --recursive") +endif() -if(DEFINED ENV{IDASDK}) - file(TO_CMAKE_PATH "$ENV{IDASDK}" _IDASDK_ROOT) - set(_IDASDK_BOOTSTRAP "") - if(EXISTS "${_IDASDK_ROOT}/src/cmake/bootstrap.cmake") - set(_IDASDK_BOOTSTRAP "${_IDASDK_ROOT}/src/cmake/bootstrap.cmake") - elseif(EXISTS "${_IDASDK_ROOT}/ida-cmake/bootstrap.cmake") - set(_IDASDK_BOOTSTRAP "${_IDASDK_ROOT}/ida-cmake/bootstrap.cmake") - endif() +# idasdk_init.cmake resolves the SDK, makes find_package(idasdk) reachable, and +# pre-selects MSVC on Windows. It must be included before project(). +set(ENV{IDASDK} "${IDAXEX_SDK_ROOT}/src") +include("${IDAXEX_SDK_ROOT}/src/cmake/idasdk_init.cmake") - if(NOT _IDASDK_BOOTSTRAP) - message(FATAL_ERROR "Could not find ida-cmake bootstrap under $ENV{IDASDK}") - endif() +project(idaxex CXX C) - include("${_IDASDK_BOOTSTRAP}") - find_package(idasdk REQUIRED) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_C_STANDARD 11) - foreach(_IDAXEX_QT_HELPER_TARGET IN ITEMS - build_qt - qt6_external - qt6_external-download - qt6_external-configure - qt6_external-build - qt6_external-install - ) - if(TARGET ${_IDAXEX_QT_HELPER_TARGET}) - set_target_properties(${_IDAXEX_QT_HELPER_TARGET} PROPERTIES - EXCLUDE_FROM_ALL TRUE - EXCLUDE_FROM_DEFAULT_BUILD TRUE - EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE - EXCLUDE_FROM_DEFAULT_BUILD_RELEASE TRUE - EXCLUDE_FROM_DEFAULT_BUILD_RELWITHDEBINFO TRUE - EXCLUDE_FROM_DEFAULT_BUILD_MINSIZEREL TRUE - ) - endif() - endforeach() -else() - message(FATAL_ERROR "Set IDASDK to an IDA SDK root before configuring idaxex") +# `cmake --build` writes the loader into the build tree (build/bin/loaders/). +# `cmake --install` (below) is what copies it into IDA's directory. This must +# be set before find_package(), which bakes the output location into +# ida_add_loader(). +if(NOT DEFINED IDABIN AND NOT DEFINED ENV{IDABIN}) + set(IDABIN "${CMAKE_BINARY_DIR}/bin") endif() +find_package(idasdk REQUIRED) + ida_add_loader(idaxex SOURCES idaloader.cpp @@ -72,17 +66,37 @@ ida_add_loader(idaxex 3rdparty/excrypt/src 3rdparty/XbSymbolDatabase/include 3rdparty/XbSymbolDatabase/src/OOVPADatabase - ${_IDASDK_ROOT}/src/ldr/pe - ${_IDASDK_ROOT}/ldr/pe DEFINES IDALDR=1 ) +# excrypt's AES path uses x86 AES-NI intrinsics (wmmintrin.h); enable them on +# x86/x64 only. MSVC exposes the intrinsics without an explicit switch. +if((IDA_X64 OR IDA_X86) AND NOT MSVC) + target_compile_options(idaxex PRIVATE $<$:-maes>) +endif() target_compile_options(idaxex PRIVATE - $<$>,$>:-maes> - $<$>,$>:-maes> - $<$:-Wno-non-pod-varargs> - $<$:-Wno-non-pod-varargs> -) + $<$:-Wno-non-pod-varargs>) ida_disable_warnings(idaxex) + +# `cmake --install build` installs the loader so IDA picks it up automatically. +# Default the install prefix to IDA's per-user directory (loaders/ subdir): +# ~/.idapro/loaders on Linux/macOS +# %APPDATA%\Hex-Rays\IDA Pro\loaders on Windows +# Pass -DCMAKE_INSTALL_PREFIX= to install elsewhere (e.g. an IDA +# installation directory); the loader always lands in /loaders. +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + if(WIN32) + set(_idaxex_userdir "$ENV{APPDATA}/Hex-Rays/IDA Pro") + else() + set(_idaxex_userdir "$ENV{HOME}/.idapro") + endif() + set(CMAKE_INSTALL_PREFIX "${_idaxex_userdir}" CACHE PATH + "Install location (IDA directory)" FORCE) +endif() + +install(FILES "$" DESTINATION "loaders") + +# xex1tool: standalone command-line companion (does not use the IDA SDK). +add_subdirectory(xex1tool) diff --git a/README.md b/README.md index 9ce4aa8..3b2d255 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # idaxex -idaxex is a native loader plugin for IDA Pro 9.3, adding support for loading Xbox 360 XEX and Xbox XBE executables. +idaxex is a native loader plugin for IDA Pro 9.4, adding support for loading Xbox 360 XEX and Xbox XBE executables. Originally started as an [IDAPython loader](https://github.com/emoose/reversing/blob/master/xbox360.py), work was continued as a native DLL to solve the shortcomings of it. @@ -41,24 +41,33 @@ For PPC Altivec analysis, the PPCAltivec plugin remains a useful companion: http ## Building -Make sure to clone repo recursively for excrypt submodule to get pulled in. +Dependencies are pulled in as submodules, so clone recursively: -**Windows** +``` +git clone --recursive https://github.com/emoose/idaxex.git +# or, if already cloned: +git submodule update --init --recursive +``` -- Point `IDASDK` environment variable at your IDA SDK 9.3 root. -- Run CMake to generate the VS solution: `cmake -B build -G "Visual Studio 18 2026"` -- Build with `cmake --build build` or use the `idaxex.slnx` file. -- idaxex.dll will be built at `$IDASDK\src\bin\loaders\idaxex.dll` +Then build with the Ninja generator from the repo root: -**Linux** +``` +cmake -S . -B build -G Ninja +cmake --build build +``` -- Use the IDA SDK 9.3 CMake bootstrap from `src/cmake/bootstrap.cmake` if your SDK tree has it, or the standalone [ida-cmake](https://github.com/allthingsida/ida-cmake) bootstrap if you keep that package separately. -- Make sure `IDASDK` points at the SDK root. -- Run `cmake -S . -B build` from the repo root. -- Run `cmake --build build`. -- To build `xex1tool`, run `cmake -S xex1tool -B xex1tool/build` and `cmake --build xex1tool/build`. +This builds the loader at `build/bin/loaders/` (`idaxex.dll` on Windows, +`idaxex.so` on Linux, `idaxex.dylib` on macOS). To install it into IDA's +per-user directory so it's picked up automatically, run: -On newer IDA SDKs, `libida.so` may be the correct library name in place of `libida64.so`. +``` +cmake --install build +``` + +- **Windows:** run the commands from a Visual Studio Developer Command Prompt + (or any shell where `cl.exe` is on `PATH`). +- To build `xex1tool`, run `cmake -S xex1tool -B xex1tool/build -G Ninja` and + `cmake --build xex1tool/build`. ## Credits Based on work by the Xenia project, XEX2.bt by Anthony, xextool 0.1 by xor37h, Xex Loader & x360_imports.idc by xorloser, xkelib, XeCLI, and probably many others I forgot to name. diff --git a/formats/xex.hpp b/formats/xex.hpp index d903389..915e59b 100644 --- a/formats/xex.hpp +++ b/formats/xex.hpp @@ -131,6 +131,9 @@ class XEXFile #ifndef IDALDR #ifdef _MSC_VER read = (read_fn)fread; seek = (seek_fn)_fseeki64; tell = (tell_fn)_ftelli64; dbgmsg = stdio_msg; +#elif defined(__APPLE__) + // On macOS/BSD off_t is already 64-bit, so fseeko/ftello are the 64-bit variants. + read = (read_fn)fread; seek = (seek_fn)fseeko; tell = (tell_fn)ftello; dbgmsg = stdio_msg; #else read = (read_fn)fread; seek = (seek_fn)fseeko64; tell = (tell_fn)ftello64; dbgmsg = stdio_msg; #endif diff --git a/idaloader.cpp b/idaloader.cpp index b9600f4..7f81bb7 100644 --- a/idaloader.cpp +++ b/idaloader.cpp @@ -15,8 +15,8 @@ #include struct exehdr {}; // needed for pe.h -#include -#include +#include +#include #include #include diff --git a/idaloader_xbe.cpp b/idaloader_xbe.cpp index 7c0f253..4068a08 100644 --- a/idaloader_xbe.cpp +++ b/idaloader_xbe.cpp @@ -9,8 +9,8 @@ #include struct exehdr {}; // needed for pe.h -#include -#include +#include +#include #include #include diff --git a/idaxex.sln b/idaxex.sln deleted file mode 100644 index 11be132..0000000 --- a/idaxex.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.32014.148 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idaxex", "idaxex.vcxproj", "{6104AB02-F465-4FBA-B66E-232EF0925C65}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xex1tool", "xex1tool.vcxproj", "{67F256A0-C7FB-448F-9B8F-362AE793C5B4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6104AB02-F465-4FBA-B66E-232EF0925C65}.Debug|x64.ActiveCfg = Debug|x64 - {6104AB02-F465-4FBA-B66E-232EF0925C65}.Debug|x64.Build.0 = Debug|x64 - {6104AB02-F465-4FBA-B66E-232EF0925C65}.Release|x64.ActiveCfg = Release|x64 - {6104AB02-F465-4FBA-B66E-232EF0925C65}.Release|x64.Build.0 = Release|x64 - {67F256A0-C7FB-448F-9B8F-362AE793C5B4}.Debug|x64.ActiveCfg = Debug|x64 - {67F256A0-C7FB-448F-9B8F-362AE793C5B4}.Debug|x64.Build.0 = Debug|x64 - {67F256A0-C7FB-448F-9B8F-362AE793C5B4}.Release|x64.ActiveCfg = Release|x64 - {67F256A0-C7FB-448F-9B8F-362AE793C5B4}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2D699616-57E8-408D-B1AA-67CAF83E0B70} - EndGlobalSection -EndGlobal diff --git a/idaxex.vcxproj b/idaxex.vcxproj deleted file mode 100644 index 93afbb6..0000000 --- a/idaxex.vcxproj +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {6104AB02-F465-4FBA-B66E-232EF0925C65} - Win32Proj - 10.0 - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - - - - - - - - - - - - - - - - ..\..\include;..\..\ldr\pe;3rdparty\XbSymbolDatabase\src\OOVPADatabase;3rdparty\XbSymbolDatabase\include;3rdparty/excrypt/src;3rdparty/mspack;%(AdditionalIncludeDirectories) - __NT__;IDALDR;__EA64__;_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - stdcpp20 - stdc11 - - - ..\..\lib\x64_win_vc_64\ida.lib;%(AdditionalDependencies) - - - - - ..\..\include;..\..\ldr\pe;3rdparty\XbSymbolDatabase\src\OOVPADatabase;3rdparty\XbSymbolDatabase\include;3rdparty/excrypt/src;3rdparty/mspack;%(AdditionalIncludeDirectories) - __NT__;IDALDR;__EA64__;_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - stdcpp20 - stdc11 - - - ..\..\lib\x64_win_vc_64\ida.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/idaxex.vcxproj.filters b/idaxex.vcxproj.filters deleted file mode 100644 index 792181e..0000000 --- a/idaxex.vcxproj.filters +++ /dev/null @@ -1,129 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {b9a1b327-7db0-4490-abf7-1b7deabf3b71} - - - {a4c096a6-e13b-4af5-8a6c-776b53f9acd5} - - - {2e3fab5a-2e7a-443e-8abb-92c47a5ca017} - - - {eb5158b2-1fed-4520-848c-17295b1940e8} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\formats - - - Source Files\formats - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\lzx - - - Source Files\lzx - - - Source Files\lzx - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - \ No newline at end of file diff --git a/xex1tool.vcxproj b/xex1tool.vcxproj deleted file mode 100644 index 27dc546..0000000 --- a/xex1tool.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - 16.0 - {67F256A0-C7FB-448F-9B8F-362AE793C5B4} - Win32Proj - xex1tool - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - true - - - false - - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 - 3rdparty/excrypt/src;3rdparty/mspack - - - Console - true - 3rdparty/excrypt - - - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 - 3rdparty/excrypt/src;3rdparty/mspack - - - Console - true - true - true - 3rdparty/excrypt - - - - - - - - - - - - - - - - _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/xex1tool.vcxproj.filters b/xex1tool.vcxproj.filters deleted file mode 100644 index 786deec..0000000 --- a/xex1tool.vcxproj.filters +++ /dev/null @@ -1,114 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {bcbb88ec-15d3-4ca7-b4ad-94813d536d60} - - - {166b01ed-282b-4f1c-b5e9-26e8696318b4} - - - {bf9da4ae-4f30-46ac-881f-014918c66db9} - - - {7071ccd0-cad0-4907-9d95-90600bd9d1f5} - - - - - Source Files - - - Source Files - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\excrypt - - - Source Files\formats - - - Source Files\lzx - - - Source Files\lzx - - - Source Files\excrypt - - - Source Files\lzx - - - Source Files\formats - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - Header Files\formats - - - \ No newline at end of file diff --git a/xex1tool/CMakeLists.txt b/xex1tool/CMakeLists.txt index a0f0b52..8e53c18 100644 --- a/xex1tool/CMakeLists.txt +++ b/xex1tool/CMakeLists.txt @@ -1,13 +1,14 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.25) -project(xex1tool) +# xex1tool is a standalone command-line tool and does NOT use the IDA SDK. It +# can be built on its own (cmake -S xex1tool -B xex1tool/build) or as part of +# the loader build via add_subdirectory() from the repo-root CMakeLists. +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + project(xex1tool CXX C) +endif() set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED True) - -# Enable AES NI intrinsic -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") +set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(xex1tool ../xex1tool.cpp @@ -28,4 +29,25 @@ add_executable(xex1tool ../3rdparty/mspack/system.c ) -target_include_directories(xex1tool PRIVATE ${PROJECT_SOURCE_DIR}/../3rdparty/excrypt/src) +target_include_directories(xex1tool PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/excrypt/src") + +# excrypt's AES path uses x86 AES-NI intrinsics (wmmintrin.h); enable them on +# x86/x64 only. MSVC exposes the intrinsics without an explicit switch. +set(_xex1tool_x86 FALSE) +if(CMAKE_OSX_ARCHITECTURES) + if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64|i386") + set(_xex1tool_x86 TRUE) + endif() +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64|i[3-6]86|x86") + set(_xex1tool_x86 TRUE) +endif() +if(_xex1tool_x86 AND NOT MSVC) + target_compile_options(xex1tool PRIVATE -maes) +endif() + +# formats/xex.cpp passes byte-swapped be<> wrappers (trivially copyable) through +# printf-style varargs; clang flags this as an error by default. The loader +# target suppresses the same warning. +target_compile_options(xex1tool PRIVATE + $<$:-Wno-non-pod-varargs>)