mirror of
https://github.com/visualboyadvance-m/visualboyadvance-m
synced 2025-10-05 15:42:52 +02:00
Adjust cmake code to support building a Windows arm64 binary on a Windows x86/x64 host. Add /EHsc to MSVC compiler flags for exception unwind support. Check VCPKG_TARGET_TRIPLET in Architecture.cmake to set the appropriate cmake variables for cross-compiling for arm64. Add MSVC_x86_Host_Compile.cmake script, used from HostCompile.cmake, to adjust the path of the cl.exe compiler and ENV{LIB} to build a C program for x86 when cross-compiling, necessary for the bin2c utility. Use wxrc from dependencies submodule when cross-compiling, because the cross wxrc executable cannot be run on the host. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
25 lines
583 B
CMake
25 lines
583 B
CMake
# This is a hack to be run with cmake -P to compile a source C program passed
|
|
# in `src` to the `dst` executable using the host MSVC x86 toolchain.
|
|
|
|
find_program(cl_path NAME cl.exe HINTS ENV PATH)
|
|
|
|
string(REGEX REPLACE "[^/]+/cl\\.exe$" "x86/cl.exe" cl_path "${cl_path}")
|
|
|
|
set(orig_lib "$ENV{LIB}")
|
|
set(new_lib)
|
|
|
|
foreach(lib $ENV{LIB})
|
|
string(REGEX REPLACE "[^\\]+$" "x86" lib "${lib}")
|
|
|
|
list(APPEND new_lib "${lib}")
|
|
endforeach()
|
|
|
|
set(ENV{LIB} "${new_lib}")
|
|
|
|
execute_process(
|
|
COMMAND ${cl_path} /nologo ${src} /Fe:${dst}
|
|
OUTPUT_QUIET
|
|
)
|
|
|
|
set(ENV{LIB} "${orig_lib}")
|