Clang on Windows
You can build Plasma Engine using Clang on Windows. This can be useful to find and fix compilation errors and warnings, that do not happen with MSVC. However, as Clang support on Windows is still experimental, you may not be able to build a working executable.
Using Clang/LLVM with the CMake GUI
Get the latest clang windows distribution: https://releases.llvm.org/download.html (the 64-bit version is recommended)
Create a new solution for the Clang build by pointing Where to build the binaries to a new location.
Press Configure once, a dialog will show up.
Choose Ninja as the generator. (Note: Get ninja from https://ninja-build.org and put it in your PATH)
Choose Specify native compilers then hit Finish.
Specify the C and C++ compiler. When using the default paths they are located at:
C: C:/Program Files/LLVM/bin/clang.exe
C++: C:/Program Files/LLVM/bin/clang++.exe
Hit Finish
You will now get an error from cmake
No CMAKE_RC_COMPILER could be found
. Check the Advanced checkbox to show additional options and pointCMAKE_RC_COMPILER
toC:\Program Files (x86)\Windows Kits\10\bin\<windows-sdk-version>\x64\rc.exe
(for exampleC:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\rc.exe
).Hit Configure
Hit Generate
cd
into the build location and runninja
to build.
Using the Clang frontend for Visual Studio with the CMake GUI
The clang frontend for the Visual Studio Compiler is no longer in development. Using the official LLVM clang is recommended.
Create a new solution for the Clang build by pointing Where to build the binaries to a new location.
Press Configure once, a dialog will show up.
Choose the desired Visual Studio generator at the top.
In the field Optional toolset to use (argument to -T) type v140_clang_c2
Finish the dialog and run 'Configure'.
Check the Advanced checkbox to show additional options.
Disable PL_USE_PCH, as the Clang build will not work with precompiled headers.
You may also want to disable PL_ENABLE_FOLDER_UNITY_FILES as that makes it easier to see from which file a compilation error originated.
Finish the CMake configuration, open the solution in Visual Studio and start compiling.