Skip to content

Fix cmake_bgfx sample build on native-Windows Ninja + Clang#240

Merged
ASDAlexander77 merged 2 commits into
mainfrom
fix-cmake-bgfx-windows-build
Jul 16, 2026
Merged

Fix cmake_bgfx sample build on native-Windows Ninja + Clang#240
ASDAlexander77 merged 2 commits into
mainfrom
fix-cmake-bgfx-windows-build

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

  • The TSLANG compile rule gated a #!/usr/bin/env bash flag-filtering wrapper on CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang", but a native Windows LLVM clang++.exe also matches "Clang". Ninja on Windows launches commands via CreateProcess and cannot exec a .sh script, failing with %1 is not a valid Win32 application. Replaced the bash wrapper with a portable tslang_filter_flags.cmake invoked via cmake -P, which behaves identically on every host.
  • setup_tslang_link_paths() linked defaultlib/lib directly, but the compiled default-lib binaries are stored in defaultlib/lib/debug or defaultlib/lib/release, with no fallback at the parent level. Now selects the subfolder from CMAKE_BUILD_TYPE.

Test plan

  • cmake --preset default && cmake --build --preset default on Windows (Ninja + native LLVM clang++) — TSLANG compile step now runs instead of failing at the .sh invocation.
  • Verified tslang_filter_flags.cmake correctly strips -msse4.2/-mavx/etc. and forwards the rest.
  • Verified link-path resolution now points at the release/debug subfolder matching CMAKE_BUILD_TYPE.

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits July 16, 2026 20:57
CMakeTSLANGInformation.cmake gated a #!/usr/bin/env bash flag-filtering
wrapper on CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang", but a
native Windows LLVM clang++.exe also matches "Clang". Ninja on Windows
launches commands via CreateProcess and cannot exec a .sh script,
failing with "%1 is not a valid Win32 application". Replace the bash
wrapper with a portable tslang_filter_flags.cmake invoked via
`cmake -P`, which behaves identically on every host.

Also fix setup_tslang_link_paths() in LocateTSLang.cmake: it linked
defaultlib/lib directly, but the compiled default-lib binaries are
stored in defaultlib/lib/debug or defaultlib/lib/release with no
fallback at the parent level. Select the subfolder from
CMAKE_BUILD_TYPE.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit d427cce into main Jul 16, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-cmake-bgfx-windows-build branch July 16, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant