cc/msvc: build blade-test's cc suites (flag translation, framework deps, private incs) - #67
Merged
Merged
Conversation
Drives blade-go's MSVC backend against blade-test's real cc suites on
Windows. cc_basic, cc_incs, cc_export_map, cc_dll_export now build and
their tests pass (3/3, 1/1, 1/1, 1/1). Four gaps fixed, all gcc/clang
behavior unchanged:
* cc_config gcc-flag translation (mapFlagsToMSVC): projects write
cc_config in gcc syntax and layer MSVC bits in msvc_config, so on an
MSVC toolchain translate -std=c++17 -> /std:c++17, -O2 -> /O2, -D/-I
-> /D //I, -g -> /Z7, and drop gcc-only -W/-m/-f -- mirroring Blade's
_map_gcc_flags_to_msvc. Also read msvc_config (append_cppflags,
warnings, ...) and default /SUBSYSTEM:CONSOLE, without which link.exe
can't infer the entry point when main() lives in a static lib
(gtest_main/test_main) -> LNK1561.
* config vocabulary: register the full set of *_config functions
(java/scala/go/cuda/lex_yacc/link/coverage/sanitizer/...) so a
multi-language BLADE_ROOT loads instead of erroring "undefined:
java_test_config"; blade-go records but ignores the ones it doesn't
build.
* framework libs as deps: a cc_test/cc_benchmark's gtest_libs /
gtest_main_libs (and benchmark_*_libs) are injected as deps by the
graph builder, so a `//`-target framework (blade-test's
test_framework), a `#syslib`, and a `thirdparty/<port>` vcpkg lib are
all classified and linked by the normal transitive path. Replaces the
old classify-into-vcpkg/syslib helper that silently dropped
`//`-target frameworks. Verified flare still links libgtest/libgtest_main.
* private incs: a target's own attr['incs'] (package-relative private
include dirs) is added to its compiles -- cc_incs's `incs=['include']`
now resolves `greeting.h`.
Tests: mapFlagsToMSVC translation, cc_test framework-dep injection +
classification, private incs on the compile path. go test ./... green on
macOS/arm64; the suites verified on Windows 11 ARM64 (VS2026).
Remaining (separate): cc_asm (BUILD parse + ml64/armasm rule), real DLL
output for dynamic_link, cc-check-undefined via dumpbin.
Co-Authored-By: Claude Opus 4.8 <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.
Drives blade-go's MSVC backend (#66) against blade-test's real cc suites on Windows. cc_basic (3/3), cc_incs (1/1), cc_export_map (1/1), cc_dll_export (1/1) now build and their tests pass. Four gaps fixed — all gcc/clang behavior unchanged (branch on
IsMSVC()):mapFlagsToMSVC) — projects writecc_configin gcc syntax and layer MSVC bits inmsvc_config. On MSVC, translate-std=c++17→/std:c++17,-O2→/O2,-D/-I→/D//I,-g→/Z7, drop gcc-only-W/-m/-f(mirrors Blade's_map_gcc_flags_to_msvc). Also readmsvc_config(append_cppflags,warnings, …) and default/SUBSYSTEM:CONSOLE— without it link.exe can't infer the entry point whenmain()is only in a static lib (gtest_main/test_main) →LNK1561.*_configset (java/scala/go/cuda/lex_yacc/link/coverage/sanitizer/…) so a multi-languageBLADE_ROOTloads instead of erroringundefined: java_test_config; blade-go records but ignores the ones it doesn't build.gtest_libs/gtest_main_libsare injected as deps by the graph builder, so a//-target framework (blade-test'stest_framework), a#syslib, and athirdparty/<port>vcpkg lib are all classified and linked by the normal transitive path. Replaces the helper that silently dropped//-target frameworks. Verified flare still linkslibgtest/libgtest_main.incs— a target's ownattr['incs'](package-relative private include dirs) now goes on its compiles;cc_incs'sincs=['include']resolvesgreeting.h.Tests
mapFlagsToMSVCtranslation; cc_test framework-dep injection + classification; private incs on the compile path.go test ./...green on macOS/arm64; suites verified on Windows 11 ARM64 (VS2026).Remaining (separate follow-ups)
cc_asm(BUILD parse +ml64/armasmrule), real DLL output fordynamic_link,cc-check-undefinedviadumpbin.