Skip to content

Support C++20 modules, MSVC part - #836

Open
PikachuHyA wants to merge 1 commit into
bazelbuild:mainfrom
PikachuHyA:fix-msvc-cpp-modules
Open

Support C++20 modules, MSVC part#836
PikachuHyA wants to merge 1 commit into
bazelbuild:mainfrom
PikachuHyA:fix-msvc-cpp-modules

Conversation

@PikachuHyA

@PikachuHyA PikachuHyA commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
  • Enable /scanDependencies for module dependency scanning
  • Add include paths to the module compile/codegen/deps-scanning actions
  • Select the cpp_module artifact extension (.ifc) by Bazel version,
    matching the unix toolchain's behavior

about cl.exe /scanDependencies, see https://learn.microsoft.com/en-us/cpp/build/reference/scandependencies?view=msvc-170

- Enable /scanDependencies for module dependency scanning
- Add include paths to the module compile/codegen/deps-scanning actions
- Select the cpp_module artifact extension (.ifc) by Bazel version,
  matching the unix toolchain's behavior
@PikachuHyA
PikachuHyA force-pushed the fix-msvc-cpp-modules branch from 42aceef to 9cef373 Compare August 12, 2026 14:31
@PikachuHyA

Copy link
Copy Markdown
Contributor Author

@trybka @fmeum @lilygorsheneva

This PR is ready to review. The macOS CI failure appears to be unrelated to this PR.

Here is the example of hello world with MSVC. see https://github.com/PikachuHyA/bazel_cxx20_modules_demo/actions/runs/31608155422/job/94152354307

There is another error similar to a GCC error I'm currently working on, and it is out of scope for this PR. see https://github.com/PikachuHyA/bazel_cxx20_modules_demo/actions/runs/31608155422/job/94152354238

note: when using C++20 modules with the MSVC toolchain, --action_env=VSLANG=1033 is required to avoid garbled text in the compiler output. I suspect the garbled text is related to CJK encoding (I'm not entirely sure), but forcing an English locale via VSLANG=1033 avoids the issue.

@lilygorsheneva

Copy link
Copy Markdown
Collaborator

I don't know anything about MSVC, not sure i'm qualified to review this

@PikachuHyA

Copy link
Copy Markdown
Contributor Author

@peakschris Sorry for the ping. I noticed your related comment in bazelbuild/bazel#19939 (comment) .
If you have context here, would you mind reviewing or advising?

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.

3 participants