build2: msvc: build2 fail with '__cpp_modules' is reserved
I have been using CMake for a long time and I am looking for an alternative for CXX modules. Build2 seems to meet almost all my requirements. It’s brilliant.
Unfortunately, it currently fails with MSVC. This is probably a known issue but I could not see it reflected in the issues board:
# Suppress warnings coming from external libraries.
#
cxx.internal.scope = current
# Some compilers (e.g. gcc) require that experimental features be enabled.
#
cxx.std = experimental
cxx.features.modules = true
assert $cxx.features.modules "no modules support for $cxx.signature"
using cxx
mxx{*}: extension = cero
# Assume headers are not importable unless stated otherwise.
#
hxx{*}: cxx.importable = false
# The test target for cross-testing (running tests under Wine, etc).
#
test.target = $cxx.target
C:\Users\wroy\Desktop\cero\cero-std\main.cero: error C2220: the following warning is treated as an error
C:\Users\wroy\Desktop\cero\cero-std\main.cero: error C2220: the following warning is treated as an error
C:\Users\wroy\Desktop\cero\cero-std\main.cero: warning C4117: macro name '__cpp_modules' is reserved, '#define' ignored
C:\Users\wroy\Desktop\cero\cero-std\main.cero: warning C4117: macro name '__cpp_modules' is reserved, '#define' ignored
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (16 by maintainers)
FYI, I am planning to start looking into this next week.
In my opinion, they are very important, necessary and I definitely intend to use them haha! XD (based on my experience with various experiments with modules in msvc)
That is not at all the same result
^^;: one is a partition ofa, so onlya’s primary module interface can have this import line, and code in that partition is only for implementing definitions of moduleaand owned by it, it’s quite important distinction. The other is importing a totally separate module (notaand not part ofaeither) so any source file can use that import line anda.bhave no relationship witha, they are completely separated modules (dot is not introducing a hierarchy, it’s just part of the name). They are not even used the same way nor lead to the same consequences.But if that hack and only-primary-interface support is enough for you to start, kudos! Personally I need most of the features of modules to work to start anything other than small projects I already experimented modules with. Ideally just supporting what works with msvc (so not everything -there are bugs- but most of the standard features) should be enough for me to start real projects.
Kind of, if we are talking about interface partition that’s kind of the idea but more “hermetic”. If we are talking private/implementation partitions, then it’s closer to pairing cpp files with definitions/implementations and a header exposing the interface. You might want to check a complete explanation, though clear ones are not easy to find. Unfortunately the subject is not that as easy as it could have been.
^^;This is planned for the next release and I hope to start looking into this in a few weeks. I will ping this issue with anything to test.
Thanks for the offer, but at this stage I suspect setting this up will take more time than it will gain. But we will definitely consider this if/when
build2becomes more widely used.Exactly same here 👍🏽