2.0 Help

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

  1. Get the latest clang windows distribution: https://releases.llvm.org/download.html (the 64-bit version is recommended)

  2. Create a new solution for the Clang build by pointing Where to build the binaries to a new location.

  3. Press Configure once, a dialog will show up.

  4. Choose Ninja as the generator. (Note: Get ninja from https://ninja-build.org and put it in your PATH)

  5. Choose Specify native compilers then hit Finish.

  6. 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

  7. Hit Finish

  8. You will now get an error from cmake No CMAKE_RC_COMPILER could be found. Check the Advanced checkbox to show additional options and point CMAKE_RC_COMPILER to C:\Program Files (x86)\Windows Kits\10\bin\<windows-sdk-version>\x64\rc.exe (for example C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\rc.exe).

  9. Hit Configure

  10. Hit Generate

  11. cd into the build location and run ninja 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.

  1. Create a new solution for the Clang build by pointing Where to build the binaries to a new location.

  2. Press Configure once, a dialog will show up.

  3. Choose the desired Visual Studio generator at the top.

  4. In the field Optional toolset to use (argument to -T) type v140_clang_c2

  5. Finish the dialog and run 'Configure'.

  6. Check the Advanced checkbox to show additional options.

  7. Disable PL_USE_PCH, as the Clang build will not work with precompiled headers.

  8. 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.

  9. Finish the CMake configuration, open the solution in Visual Studio and start compiling.

See Also

Last modified: 03 July 2024