Skip to content

feat(toolchain): native MSVC cl.exe build backend + graph-global dialect flags (#210) — 0.0.90#213

Merged
Sunrisepeak merged 4 commits into
mainfrom
feat/090-msvc-native-dialect
Jul 13, 2026
Merged

feat(toolchain): native MSVC cl.exe build backend + graph-global dialect flags (#210) — 0.0.90#213
Sunrisepeak merged 4 commits into
mainfrom
feat/090-msvc-native-dialect

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Summary

Implements the FULL .agents/docs/2026-07-13-post-089-roadmap-and-std-dialect-flags-design.md in one PR (step plan: 2026-07-13-single-pr-090-implementation-plan.md).

Native MSVC builds (the 0.0.88 gate is GONE)

mcpp toolchain default msvc + mcpp build/run now compile with cl.exe:

  • Env model: find_windows_sdk() + INCLUDE/LIB/PATH/VSLANG synthesized from detected VC tools + SDK (no vcvarsall); missing SDK → detection still works, build fails with guidance; doctor reports SDK + mingw status.
  • Modules: std/std.compat.ixx staged via /ifcOutput (ifc.cache), .cppm units via /interface /TP, consumption via /ifcSearchDir, /scanDependencies as the third builtin P1689 scanner for dyndep.
  • Link: link.exe/lib.exe (SeparateLinker) through response files; /DLL /IMPLIB; deps=msvc (/showIncludes, VSLANG=1033); /MD|/MT CRT; /std: mapping; .obj end-to-end; fast-path cache learns an @env multi-var encoding so msvc incrementals keep INCLUDE/LIB.

Dialect-class flags are module-graph-global (fixes #210)

-freflection & friends ride -std='s channels (global cxxflags for ALL TUs incl. dependency modules, std BMI prebuild, scans). Known-list auto-promotion + [build] dialect_cxxflags escape hatch. Verified: the issue's exact repro prints x 2 / y 3; e2e 98 covers the dep-module (fmt.gcm-class) variant.

Also

  • mingw polish: windows-only error, doctor sections, e2e 97 unhardcoded.
  • publish-ecosystem mirror: batch upload + ranged-GET patience verify, never delete on timeout (0.0.89 postmortem), timeout 20→30.
  • A-debt: stdmod env-aware execution, cd /d (cross-drive), per-dialect object ext.

Evidence (temp PR #212, one-round green, run 29245851464)

  • PASS: native MSVC build — modules, import std, incremental (e2e 99)
  • PASS: msvc@system detection, selection, guidance, and native build (95)
  • PASS: mingw toolchain — install, default, modules build/run, standalone exe (97)
  • e2e 53 passed / 0 failed; zero-diff gate re-verified for GCC/LLVM vs 0.0.89.

Version

0.0.90 (mcpp.toml + fingerprint.cppm + CHANGELOG). Closes #210.

…ole module graph (#210)

[build].cxxflags like -freflection change what libstdc++ headers DECLARE
(<meta> is gated on __cpp_impl_reflection) — they are module-graph dialect,
same nature as -std=. They now ride -std='s channels: the global $cxxflags
(every TU incl. dependency modules — fixes the fmt.gcm-class secondary
failure), the std/std.compat prebuild command, and scans. Known-list
auto-promotion (reflection/contracts/char8_t/_GLIBCXX_USE_CXX11_ABI) +
explicit [build] dialect_cxxflags escape hatch. The fingerprint already
keyed these flags — only the command construction was missing them.

Also: cppStandardFlag is now spelled per-dialect (std_flag_for — msvc
/std:c++20 | /std:c++latest), groundwork for the native MSVC backend.

Verified: issue #210's exact repro prints 'x 2 / y 3' via import std on
gcc@16.1.0; e2e 98 covers both variants + std-module.json assertion.
- C1 env model: find_windows_sdk() + build_env_for_cl() synthesize
  INCLUDE/LIB/PATH/VSLANG=1033 from the detected VC tools + SDK (no
  vcvarsall run); enrich_toolchain_from_cl fills tc.envOverrides; missing
  SDK keeps detection working and fails the BUILD with guidance (replaces
  the 0.0.88 'not yet supported' gate — the gate is gone).
- C2 emission: SeparateLinker rules (link.exe /OUT + rspfile — cmd's 8191
  limit), lib.exe archives, /DLL+/IMPLIB shared, deps=msvc via
  /showIncludes, /interface /TP for .cppm module units, /std: mapping
  (std_flag_for), /MD|/MT CRT model, /Od, /nologo /EHsc /utf-8 baseline,
  .obj object extension end to end (plan objExt + std staging names).
- C3 std/std.compat staging: single-cl commands (/ifcOutput), ifc.cache
  layout, registry-dispatched staged paths (clang hardcoding removed),
  stdmod executes with the toolchain env (capture_with_env).
- C4 scanning: /scanDependencies as the third builtin P1689 producer
  (provider capability + ninja scan rule); dyndep ifc-parameterized as-is.
- C8 fast path: '@env' multi-var encoding in the build cache env slot so
  incremental msvc builds re-create INCLUDE/LIB for ninja.
- cd /d in std stage commands (cmd.exe won't change drive without it;
  D: workspace + C: BMI cache is the real CI layout).

Zero-diff gate re-verified for GCC and LLVM vs the 0.0.89 release binary.
…rsion/docs

- e2e 99 (requires: msvc): default msvc → modules build/run → import std →
  incremental; 95's build-gate assertion flips to a real build+run; the
  ci-windows MSVC step now drives 99.
- mingw: windows-only guard with a clear message (was 'invalid xpkg target
  xim:mingw-gcc@'); e2e 97 objdump path unhardcoded; doctor gains Windows
  SDK + mingw sections.
- release.yml publish-ecosystem timeout 20→30 (backstop for the fixed
  mirror script's worst case).
- version 0.0.90 + CHANGELOG + docs/03 MSVC build section.
@Sunrisepeak Sunrisepeak merged commit 116f532 into main Jul 13, 2026
6 checks passed
@Sunrisepeak Sunrisepeak deleted the feat/090-msvc-native-dialect branch July 13, 2026 16: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.

import std; 无法暴露 std::meta(P2996 反射):build.cxxflags 中的 -freflection 未应用到 std 模块 BMI 预构建

1 participant