From d8e3ba1409748dc0ab3a77dc4a93a2b09f84f081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Mon, 27 Jul 2026 16:06:54 -0700 Subject: [PATCH] Don't let -Xarch_x86_64 break Apple builds that use -Werror. CMAKE_OSX_ARCHITECTURES is only an upper bound on the slices Xcode actually compiles: it picks slices per SDK at build time. An iOS build configured for "arm64;x86_64" (leetal/ios-cmake's OS64COMBINED, where x86_64 is the simulator slice) compiles only arm64 against the iphoneos SDK, so the -Xarch_x86_64 applies to nothing and clang reports it as an unused argument -- fatal for projects building with -Werror. Pair the flag with -Wno-unused-command-line-argument so the SSE minspec still reaches every x86_64 slice that is built, without breaking the slices that aren't. --- cmake/bx/bx.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/bx/bx.cmake b/cmake/bx/bx.cmake index aad5cdfee..ba75800d5 100644 --- a/cmake/bx/bx.cmake +++ b/cmake/bx/bx.cmake @@ -125,7 +125,18 @@ if(APPLE) elseif(BX_APPLE_ARCH_COUNT GREATER 1) # Universal build; -Xarch_x86_64 scopes the flag to the x86_64 slice only, # so the arm64 slice (which uses the NEON SIMD path) is unaffected. - target_compile_options(bx PUBLIC "$<$:SHELL:-Xarch_x86_64 -msse4.2>") + # + # -Wno-unused-command-line-argument is required because CMAKE_OSX_ARCHITECTURES + # is only an upper bound on the slices that actually get compiled. Xcode picks + # the slices per SDK at build time, so an iOS build configured for "arm64;x86_64" + # (leetal/ios-cmake's OS64COMBINED, where x86_64 is the simulator slice) compiles + # only arm64 against the iphoneos SDK. clang then sees an -Xarch_x86_64 that + # applies to nothing and reports it as an unused argument, which is fatal for + # projects building with -Werror. + target_compile_options( + bx PUBLIC + "$<$:SHELL:-Xarch_x86_64 -msse4.2 -Wno-unused-command-line-argument>" + ) else() # Single-slice x86_64 build; the flag applies to the only slice there is. target_compile_options(bx PUBLIC $<$:-msse4.2>)