bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.21k stars 4.06k forks source link

Support C++20 modules #4005

Open abergmeier opened 7 years ago

abergmeier commented 7 years ago

Description of the problem / feature request / question:

Starting to look into C++ Modules. While it will earliest officially arrive in 2020, would be good to have support for that soonish. Heard there is some Module support inside of Google. Can/Will that be opensourced?

aaronmondal commented 1 year ago

rules_ll upstream supports the std module from libc++, and Clang 17 will ship the std module as an experimental preview. Most issues have been fixed, and I'd consider modules as pretty much fully usable.

A few issues remain which I could imagine to be fairly hard blockers for rules_cc:

We'll probably need distros to actually ship Clang 17 with the std module .cppm files to get a better feeling on what's good and bad for build-system UX with modules. The implementation in rules_ll certainly has some subtleties regarding inter-module visibility that I've reworked several times now and might have to rework several times more.

Then again C++23 is basically Rust already. Seems like that's also where all the Bazel engineering power is being redirected to. I wouldn't find it too surprising if the recommendation for the future is to just not write new C++ and use rules_rust with crubit for legacy-compatibility instead :smile:

nadiasvertex commented 1 year ago

That’s a shame. I was hoping to use Bazel for a large project we are migrating. C++20 modules are more important to me than Bazels many advantages, and rules_ll is a non-starter because I need to support macOS and Windows.

Maybe next year things will be better.

BorisChenCZY commented 1 year ago

Do we have any update on this?

BorisChenCZY commented 1 year ago

I'm also quite interested in contributing this featuer. Is there any guidance on this for me to do so?

nadiasvertex commented 1 year ago

I would help with such an effort too.

oquenchil commented 1 year ago

See https://github.com/bazelbuild/bazel/issues/4005#issuecomment-1216281033

nadiasvertex commented 1 year ago

See #4005 (comment)

It sounds like that is basically saying nothing is done and some one wanting good support should start from scratch.

jsharpe commented 1 year ago

Note also that post was referring to clang modules and not c++20 modules; this issue got hijacked from clang module support to c++ 20 at some point in the history of this issue.

PikachuHyA commented 1 year ago

Dear all, the support for C++20 Modules is here. PR: https://github.com/bazelbuild/bazel/pull/19940 design doc: https://github.com/bazelbuild/proposals/pull/354 discussion: https://github.com/bazelbuild/bazel/discussions/19939 a demo built with C++20 Modules (about 10 kloc): https://github.com/PikachuHyA/async_simple extra tests: https://github.com/PikachuHyA/bazel_cxx20_module_test the new bazel is built by GitHub Action, see https://github.com/PikachuHyA/bazel/actions/runs/6638058320 you can download the prebuilt version and play with your code. Feedback is very welcome. please note, only Clang is supported now. and Clang 17 or higher is required.

kelteseth commented 6 months ago

This issue is track it on https://arewemodulesyet.org/tools/