r/cpp • MSVC Game Dev PM • Sep 14 '20

Standard C++20 Modules support with MSVC in Visual Studio 2019 version 16.8 | C++ Team Blog

https://devblogs.microsoft.com/cppblog/standard-c20-modules-support-with-msvc-in-visual-studio-2019-version-16-8/
254 Upvotes

128 comments sorted by

View all comments

Show parent comments

3

u/mjklaim Sep 14 '20

Hmm maybe I'm thinking with source-only dependencies, in which case the modules are being built by the buildsystem which only scan sources pointed as pre-requisite for targets, so there is no need for modules output directories.

In the case where the dependency is only binaries + headers or module interfaces (or BMI?) I guess you are correct that it becomes necessary.

I kind of avoid this issue by using only dependencies that are provided as sources, but in some ways, what you say is already what happened when Visual Studio started shipping pre-compiled modules of the standard library (the std.core stuffs) in which case the buildsystem had to know where to find the BMIs.

I stand corrected :)

2

u/Minimonium Sep 14 '20

Yes, I meant BMIs for when providing a dependency. I see how it could work with some kind of auto registration on build from source, but I believe it's only possible as a part of the same build tree (clashes and such?).

3

u/mjklaim Sep 14 '20 edited Sep 14 '20

Yes, in the case I was talking about (build2) all the dependencies are source packages, so when you build, they are all built in the same configuration (aka build-dir+dependencices+flags+options+etc.), which helps a lot avoid all the issues with figuring out if binaries are compatible or not. You can, of course, add some binaries dependencies, but then you're on you're own (like most build systems).

(sidenote: build2 people intend to use distributed compilation as a solution vs binary packages, and consider binary packages only after having done that, because it might already fix the issues of missing binary packages)

Note that I often ended up with one big CMake file when I was using it to merge all the cmake files of the different dependencies, for the exact same reason. It's not useful in all situations but in mine it was key in making the project maintainable.