Trick-17 / clang-build

Clang-based cross platform build system written in Python
https://clang-build.readthedocs.io
MIT License
8 stars 3 forks source link

First try of making standard C++ modules buildable #139

Open GPMueller opened 1 year ago

GPMueller commented 1 year ago

A trivial MWE module can be built, a more complete module using module partitions cannot be automatically built yet, because there seems to be no way to let clang-15 tell us the dependencies between the partitions. The user would have to manually specify the interdependencies, which doesn't seem desirable for clang-build to require.

These changes do not attempt to lay groundwork for any well-designed implementation of modules support. Instead, it's just trying to get things to compile.

GPMueller commented 1 year ago

Note: I have placed --precompile onto the .cppm files for the first compilation phase. Unfortunately, if the file is not yet compilable, this will fail with e.g.

test\cpp-modules\full-module\hello_world-impl_world.cppm:7:9: fatal error: module 'hello_world:world' not found
import :world;
~~~~~~~~^~~~~

If we'd use --preprocess, like we do on .cpp files to determine their dependencies, we'd not get an error at this stage, but we'd also not get the precompiled .pcm files, which would allow us to speed up the second compilation phase.

Unfortunately, in clang-15, neither with--precompile nor --preprocess will the -MMD/--write-user-dependencies flag output import-dependencies.