Fix cmake_bgfx sample build on native-Windows Ninja + Clang#240
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#!/usr/bin/env bashflag-filtering wrapper onCMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang", but a native Windows LLVMclang++.exealso matches "Clang". Ninja on Windows launches commands viaCreateProcessand cannot exec a.shscript, failing with%1 is not a valid Win32 application. Replaced the bash wrapper with a portabletslang_filter_flags.cmakeinvoked viacmake -P, which behaves identically on every host.setup_tslang_link_paths()linkeddefaultlib/libdirectly, but the compiled default-lib binaries are stored indefaultlib/lib/debugordefaultlib/lib/release, with no fallback at the parent level. Now selects the subfolder fromCMAKE_BUILD_TYPE.Test plan
cmake --preset default && cmake --build --preset defaulton Windows (Ninja + native LLVM clang++) — TSLANG compile step now runs instead of failing at the.shinvocation.tslang_filter_flags.cmakecorrectly strips-msse4.2/-mavx/etc. and forwards the rest.release/debugsubfolder matchingCMAKE_BUILD_TYPE.🤖 Generated with Claude Code