6 ms·
You don't on new projects. CMake + ninja has support for modules on gcc, clang, and MSVC. This should be your default stack on any small-to-medium sized C++ pr
by jjmarr 7mo ago
You don't on new projects. CMake + ninja has support for modules on gcc, clang, and MSVC.
This should be your default stack on any small-to-medium sized C++ project.
Bazel, the default pick for very large codebases, also has support for C++20 modules.
- VerifiedReports 7mo agoThanks. It's been a long time since I started a C++ project, and I've never set up any build chain in Visual Studio or Xcode other than the default.
- sgt 7mo agoHow about using Zig to build C++ projects?
- jjmarr 7mo agoI haven't used it. That being said, while it looks better than CMake, for anything professional I need remote execution support to deviate from the industry standard. Zig doesn't have that. This is because large C++ projects reach a point where they cannot be compiled locally if they use the full language. e.g. Multi-hour Chromium builds.
- sgt 7mo agoSurely Zig can also be invoked using any CI/CD flow running on a remote machine too.
- jjmarr 7mo agoI'm referring to this: https://github.com/bazelbuild/remote-apis https://github.com/bazelbuild/remote-apis Once you get a very large C++ project with several thousand compilation jobs over hundreds of devs, you need to distribute the build across multiple computers and have a shared cache for object files. Zig doesn't seem to support that.
- duped 7mo agoI have yet to see modules in the wild. What I have seen extensively are header-only projects.
- jjmarr 7mo agoYou're not supposed to distribute the precompiled module file. You are supposed to distribute the source code of the module. Header-only projects are the best to convert to modules because you can put the implementation of a module in a "private module fragment" in that same file and make it invisible to users. That prevents the compile-time bloat many header-only dependencies add. It also avoids distributing a `.cpp` file that has to be compiled and linked separately, which is why so many projects are header-only.
- FrostKiwi 7mo agoIt's the fault of built systems. CMake still doesn't support `import std` officially and undocumented things are done in the ecosystem [1] But once it works and you setup the new stuff, having started a new CPP26 Project with modules now, it's kinda awesome. I'm certainly never going back. The big compilers are also retroactively adding `import std` to CPP20, so support is widening. [1] https://gitlab.kitware.com/cmake/cmake/-/work_items/27706 https://gitlab.kitware.com/cmake/cmake/-/work_items/27706
- duped 7mo agoweird to blame build systems for a problem caused by the language
- deleted 7mo ago[deleted]