diff options
| author | quarrel07 <quarrel-07atolls@icloud.com> | 2026-07-17 15:28:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-18 00:28:29 +0200 |
| commit | 6ed9a8ad288aebd6438af924e2de9f4061f99fb9 (patch) | |
| tree | 74a082445dfd300a12e43301e317490898af55ae /CMakeLists.txt | |
| parent | d1dec0f6f437cf5342a8514f23741da9ded95485 (diff) | |
Fix macOS arm64 build: fmt consteval error in the TorchExternal sub-build (#712)
* Fix macOS arm64 build: fmt consteval error in the TorchExternal sub-build
Torch's pinned spdlog bundles an fmt whose consteval format-string
checking fails to compile under newer AppleClang (Xcode 16+), breaking
the build-macos-arm64 CI job (the intel runner's older Xcode doesn't hit
it):
error: call to consteval function 'fmt::basic_format_string<...>' is
not a constant expression
Define FMT_CONSTEVAL as empty inside the Torch sub-build, falling back to
fmt's pre-C++20 constexpr checking. Injected via CMAKE_PROJECT_INCLUDE
because Torch's CMakeLists overwrites CMAKE_CXX_FLAGS, so plain flag
injection through CMAKE_ARGS is discarded. Scoped to AppleClang; no other
platform or compiler is affected, and the Torch pin is unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Also neutralize FMT_CONSTEVAL for the game build (vcpkg spdlog/fmt)
With the TorchExternal fix in place, CI reaches the game build and hits
the same consteval error again, this time from the vcpkg-provided
spdlog/fmt headers (SPDLOG_FMT_EXTERNAL) under the runner's Xcode 26.5.
Apply the same AppleClang-scoped FMT_CONSTEVAL= define at the project
level so both layers compile.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Pin vcpkg fmt to 10.2.1 (+ spdlog 1.14.1): fmt 11.0.2 can't compile on new AppleClang
The baseline's fmt 11.0.2 both fails to compile under newer AppleClang
(consteval format-string checking) and removed the #ifndef guard around
FMT_CONSTEVAL, so the AppleClang-scoped define from the previous commit
lands on the compile line but gets clobbered by fmt's own definition
(FMT_USE_CONSTEVAL is likewise unguarded in that version). No newer fmt
exists in the pinned baseline.
Override fmt to 10.2.1, which keeps the #ifndef guard, making the
existing define effective; spdlog moves to the matching 1.14.1 (1.15.x
requires fmt >= 11 headers).
Verified locally against the exact CI setup (vcpkg at baseline
2e58bb35ff, vcpkg toolchain file, Ninja): the previous failure reproduces
without this change and the full game builds cleanly with it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Add TODO markers for removing the fmt consteval workarounds
Requested in PR #712 review: mark all three workaround sites (project-level
define, Torch sub-build include, vcpkg fmt/spdlog pins) so they can be found
and removed together once the Torch pin is bumped past its spdlog/fmt update.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: siliconports <aguthmann10@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 45dff319a..53ae41d78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,23 @@ cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) project(Spaghettify VERSION 1.0.0 LANGUAGES C CXX ASM) include(FetchContent) +# fmt's consteval format-string checking fails to compile under newer +# AppleClang (Xcode 16+) with the spdlog/fmt versions in use (both vcpkg's on +# CI and Torch's bundled copy — see cmake/TorchExternalFixes.cmake for the +# latter): +# error: call to consteval function 'fmt::basic_format_string<...>' is not +# a constant expression +# Defining FMT_CONSTEVAL as empty falls back to fmt's pre-C++20 constexpr +# checking, which compiles cleanly with identical runtime behavior. Scoped to +# AppleClang; other platforms and compilers are untouched. +# TODO: Temporary hack. Remove this (plus cmake/TorchExternalFixes.cmake and +# the vcpkg.json fmt/spdlog pins) once the Torch pin is bumped past Torch's +# spdlog/fmt update. Note the bump also needs matching MK64 loader changes, +# see the discussion on PR #712. +if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_definitions("FMT_CONSTEVAL=") +endif() + set(NATO_PHONETIC_ALPHABET "Alfa" "Bravo" "Charlie" "Delta" "Echo" "Foxtrot" "Golf" "Hotel" "India" "Juliett" "Kilo" "Lima" "Mike" "November" "Oscar" "Papa" @@ -704,10 +721,21 @@ add_custom_command( if(NOT CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") include(ExternalProject) + # Torch's pinned spdlog bundles an fmt that trips a consteval error under + # newer AppleClang (Xcode 16+): "call to consteval function + # 'fmt::basic_format_string<...>' is not a constant expression". Neutralize + # FMT_CONSTEVAL inside the Torch sub-build via CMAKE_PROJECT_INCLUDE (Torch's + # CMakeLists overwrites CMAKE_CXX_FLAGS, so flags can't be injected that + # way). Fixes the build-macos-arm64 job; the intel runner's older Xcode + # doesn't hit it. + # TODO: Temporary hack. Remove the CMAKE_PROJECT_INCLUDE line below (plus + # cmake/TorchExternalFixes.cmake itself) once the Torch pin is bumped past + # Torch's spdlog/fmt update, see the discussion on PR #712. ExternalProject_Add(TorchExternal PREFIX TorchExternal SOURCE_DIR ${CMAKE_SOURCE_DIR}/torch CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/torch + -DCMAKE_PROJECT_INCLUDE=${CMAKE_SOURCE_DIR}/cmake/TorchExternalFixes.cmake ) ExternalProject_Get_Property(TorchExternal install_dir) |
