-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang-cl does not support `-x` currently. llvm/llvm-project#88006 On Unix, install https://github.com/mstorsjo/msvc-wine to /opt/msvc, and pass CXXFLAGS="-winsysroot /opt/msvc -fuse-ld=lld" to Makefile.
- Loading branch information
1 parent
40a1098
commit d03268b
Showing
8 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
default: hello.exe | ||
|
||
hello.pcm: hello.hpp | ||
clang-cl /std:c++20 /clang:--precompile /clang:-fmodule-header hello.hpp $(CXXFLAGS) | ||
|
||
iostream.pcm: | ||
clang-cl /std:c++20 /clang:--precompile -x c++-system-header iostream $(CXXFLAGS) && \ | ||
echo /clang:-fmodule-file=iostream.pcm > modules.obj || \ | ||
echo "" > modules.obj | ||
|
||
hello.exe: main.cpp hello.pcm iostream.pcm | ||
##### Only -fmodule-file=.pcm works for header units. | ||
##### With the existing implementation -fprebuilt-module-path cannot be used for header units (since they are nominally anonymous). | ||
clang-cl /std:c++20 /clang:-fmodule-file=hello.pcm @modules.obj main.cpp /Fe:hello.exe $(CXXFLAGS) | ||
|
||
clean: | ||
-rm *.pcm *.obj *.exe | ||
-del *.pcm *.obj *.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
default: | ||
clang-cl /std:c++20 /clang:-fmodule-output /clang:-fprebuilt-module-path=. hello.cppm impl.cpp main.cpp /Fe:hello.exe $(CXXFLAGS) | ||
|
||
hello.obj hello.pcm: hello.ixx | ||
clang-cl /std:c++20 /clang:-fmodule-output /c hello.cppm $(CXXFLAGS) | ||
|
||
impl.obj: impl.cpp hello.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /c impl.cpp $(CXXFLAGS) | ||
|
||
main.obj: main.cpp hello.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /c main.cpp $(CXXFLAGS) | ||
|
||
hello.exe: main.obj hello.obj impl.obj | ||
clang-cl main.obj hello.obj impl.obj /Fe:hello.exe $(CXXFLAGS) | ||
|
||
clean: | ||
-rm *.pcm *.obj *.exe | ||
-del *.pcm *.obj *.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "hello.ixx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#default: | ||
# The default -fmodule-output of partitions are not same as used by -fprebuilt-module-path. | ||
# clang-cl /std:c++20 /clang:-fmodule-output /clang:-fprebuilt-module-path=. internal.cppm interface.cppm hello.cppm main.cpp /Fe:hello.exe $(CXXFLAGS) | ||
|
||
default: hello.exe | ||
|
||
internal.obj hello-internal.pcm: internal.cppm | ||
clang-cl /std:c++20 /c internal.cppm /clang:-fmodule-output=hello-internal.pcm $(CXXFLAGS) | ||
|
||
interface.obj hello-interface.pcm: interface.cppm hello-internal.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /c interface.cppm /clang:-fmodule-output=hello-interface.pcm $(CXXFLAGS) | ||
|
||
hello.obj hello.pcm: hello.ixx hello-interface.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /c hello.cppm /clang:-fmodule-output $(CXXFLAGS) | ||
|
||
main.obj: main.cpp hello.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /c main.cpp $(CXXFLAGS) | ||
|
||
hello.exe: main.obj hello.obj interface.obj internal.obj | ||
clang-cl main.obj hello.obj interface.obj internal.obj /Fe:hello.exe $(CXXFLAGS) | ||
|
||
clean: | ||
-rm *.pcm *.obj *.exe | ||
-del *.pcm *.obj *.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "hello.ixx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# https://clang.llvm.org/docs/StandardCPlusPlusModules.html | ||
# BMI: Built Module Interface | ||
|
||
default: | ||
clang-cl /std:c++20 /clang:-fmodule-output /clang:-fprebuilt-module-path=. hello.cppm main.cpp /Fe:hello.exe $(CXXFLAGS) | ||
|
||
hello.obj hello.pcm: hello.cppm | ||
clang-cl /std:c++20 /clang:-fmodule-output /c hello.cppm $(CXXFLAGS) | ||
|
||
main.obj: main.cpp hello.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /c main.cpp $(CXXFLAGS) | ||
|
||
hello.exe: main.obj hello.obj | ||
clang-cl main.obj hello.obj /Fe:hello.exe $(CXXFLAGS) | ||
|
||
clean: | ||
-rm *.pcm *.obj *.exe | ||
-del *.pcm *.obj *.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
hello.exe: main.cpp hello.lib hello.pcm | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. \ | ||
/Zc:dllexportInlines- \ | ||
main.cpp /Fe:hello.exe hello.lib $(CXXFLAGS) /Zi /link /PDB:hello.exe.pdb /INCREMENTAL:NO | ||
|
||
hello.dll hello.lib hello.pcm: hello.ixx | ||
clang-cl /std:c++20 /clang:-fprebuilt-module-path=. /clang:-fmodule-output /LD \ | ||
/Zc:dllexportInlines- \ | ||
hello.cppm impl.cpp $(CXXFLAGS) /Zi /link /PDB:hello.dll.pdb | ||
|
||
clean: | ||
-rm *.pcm *.obj *.exe *.exp *.lib *.dll *.pdb | ||
-del *.pcm *.obj *.exe *.exp *.lib *.dll *.pdb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "hello.ixx" |