Closed rnburn closed 2 years ago
For clang (reference), to compile a module
// math-m.cc export module math; export int add(int a, int b) { return a + b; }
run
clang++ -std=c++20 - -fmodules-ts -stdlib=libc++ -c math-m.cc -Xclang -emit-module-interface -o math.pcm
when compiling sources that depend on modules (for example, modules A and B) use the -fmodule-file option.
-fmodule-file
// main.cc import A; import B; ...
clang++ -fmodules-ts -std=c++20 -fmodule-file=A=/path/to/a.pcm -fmodule-file=B=/path/to/b.pcm-c main.cc -o main.o
See also this blog post and this blog post
Examples of usage commands: https://github.com/llvm-mirror/clang/commit/cab7f1f7bc141ac88d15030088b311bd450b2c94
done
For clang (reference), to compile a module
run
when compiling sources that depend on modules (for example, modules A and B) use the
-fmodule-file
option.clang++ -fmodules-ts -std=c++20 -fmodule-file=A=/path/to/a.pcm -fmodule-file=B=/path/to/b.pcm-c main.cc -o main.o