[build2] Is build2 the only build-tool capable of c++20 modules

Boris Kolpackov boris at codesynthesis.com
Wed May 10 12:49:50 UTC 2023


Wilhelm Meier via users <users at build2.org> writes:

> But it looks like nobody is using it ;-)

Yes, telling the users of build2 that they don't count is a good way
to make sure they will help you with your problem.


> I can't find reasonable help to my task converting a header-only library to
> simply module-interface-units. Well, rewritung the headers to modules is no
> problem at all. But setting up build2 to generate all the bmi files looks
> very difficult at least to me.
>
> In my opinion the task looks simple:
> 
> the library consists of a set of module interface files (these files
> represent a std-library for the AVR target of µC).
> The are all located in one dir. The is one file std.mpp importing all the
> partitions of the module std.
> 
> The user should simply do: import std; (in another project dir).
> 
> So the task is to generate all the bmi files in the users project dir from
> the module interface files in the library dir - surely in the correct order,
> since they are interdependant.

I think you are approaching this the wrong way. You "just" want to generate
a bunch of BMIs in the correct order in that "library dir" and then "just"
use them in that "project dir". That would be the expected approach if you
were using a build tool (as opposed to a build system) like make.

But build2 is not a build tool. Or, more precisely, you can use it as just
a build tool by writing your own recipes/rules like you would do in make.
But that's not going to be easy to do for C++20 modules (and is probably
the reason why you are looking into this obscure build system that nobody
is using instead of "just" using the industry-standard make).

And if you want to use build2 as a build system and take advantage of its
support for C++20 modules, you need to stop thinking in term of "just
generate a bunch of BMIs in this dir" and think in terms of build2's
build model, which will likely require you to spend some time reading
the documentation and/or studying the examples in order to understand
the conceptual model and how things fit together.

And, BTW, module name `std` is reserved by the C++ standard so I would
suggest you use something else.



More information about the users mailing list