[Build] Linux→Windows cross-compile toolchain (clang-cl + xwin)
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Successful in 1m19s
Orchestrator / Windows (x86-64) (push) Failing after 5m16s
Orchestrator / Linux (x86-64) (push) Failing after 13m23s
Orchestrator / Create Release (push) Has been skipped
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Successful in 1m19s
Orchestrator / Windows (x86-64) (push) Failing after 5m16s
Orchestrator / Linux (x86-64) (push) Failing after 13m23s
Orchestrator / Create Release (push) Has been skipped
New CMake preset `cross-win-clangcl` for Ninja Multi-Config on non-Windows hosts. Toolchain: clang-cl (MSVC-ABI), lld-link, xwin SDK/CRT splat. Shader compilation routes through wine fxc.exe with FXC_PATH env forwarding and unix→Windows path translation via `winepath -w`. Plus per-file build fixes (constexpr→const, llvm-rc forward-slash, zlib-ng AVX guard, /RTCsu MSVC-only). third_party/snappy bumped to fabi/sylpheed-crossbuild for the target-aware POSIX-gate header. Produces `xenia_canary.exe` (Debug MSVC) suitable for use as the audit oracle under Wine for xenia-rs work. See docs/CROSS_BUILD_SETUP.md for the full reproduction recipe. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,23 @@ file(MAKE_DIRECTORY "${PROJECT_SOURCE_DIR}/scratch")
|
||||
# Python for shader compilation scripts
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
|
||||
# Generate build-tree version.h via xenia-build.py's generate_version_h()
|
||||
# (normally invoked by `xb premake`/`xb build`; CMake-direct flows need it too).
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c
|
||||
"import importlib.util,sys; \
|
||||
spec=importlib.util.spec_from_file_location('xb',r'${PROJECT_SOURCE_DIR}/xenia-build.py'); \
|
||||
m=importlib.util.module_from_spec(spec); spec.loader.exec_module(m); \
|
||||
m.generate_version_h(r'${CMAKE_BINARY_DIR}')"
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE _xenia_version_rc
|
||||
)
|
||||
if(NOT _xenia_version_rc EQUAL 0)
|
||||
message(WARNING "version.h generation failed (rc=${_xenia_version_rc}); writing stub.")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/version.h"
|
||||
"#ifndef GENERATED_VERSION_H_\n#define GENERATED_VERSION_H_\n#define XE_BUILD_BRANCH \"unknown\"\n#define XE_BUILD_COMMIT \"unknown\"\n#define XE_BUILD_COMMIT_SHORT \"unknown\"\n#define XE_BUILD_DATE __DATE__\n#endif\n")
|
||||
endif()
|
||||
|
||||
# Include helpers
|
||||
include(cmake/XeniaHelpers.cmake)
|
||||
|
||||
@@ -146,8 +163,14 @@ if(MSVC)
|
||||
|
||||
# --- Per-configuration MSVC flags ---
|
||||
# Checked
|
||||
string(APPEND CMAKE_C_FLAGS_CHECKED " /RTCsu /fsanitize=address")
|
||||
string(APPEND CMAKE_CXX_FLAGS_CHECKED " /RTCsu /fsanitize=address")
|
||||
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"
|
||||
AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
string(APPEND CMAKE_C_FLAGS_CHECKED " /RTCsu /fsanitize=address")
|
||||
string(APPEND CMAKE_CXX_FLAGS_CHECKED " /RTCsu /fsanitize=address")
|
||||
else()
|
||||
string(APPEND CMAKE_C_FLAGS_CHECKED " /fsanitize=address")
|
||||
string(APPEND CMAKE_CXX_FLAGS_CHECKED " /fsanitize=address")
|
||||
endif()
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_CHECKED " /INCREMENTAL:NO")
|
||||
add_compile_definitions($<$<CONFIG:Checked>:DEBUG>)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user