Building with Clang on Windows
You can build ezEngine 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
Prerequisites
- Install CMake (or locate
cmake-gui.exe
in the ez repository). - Get a recent Clang Windows distribution: https://releases.llvm.org/download.html (the 64-bit version is recommended)
- Note: The binary should be called something like
LLVM-<version>-win64.exe
- A Windows binary may not be available for the latest version, use an older version, if necessary.
- Note: The binary should be called something like
- Get ninja from https://ninja-build.org and put it in your
PATH
environment variable. - If you had to edit your
PATH
variable, restart your PC.
Generate a Solution
- Using
cmake-gui.exe
, create a new solution for a 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.
- 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
- C:
- Click Finish
- If CMake can't find your
ninja.exe
even though it is in yourPATH
set theCMAKE_MAKE_PROGRAM
manually to point toninja.exe
and click Configure again. - You will now get an error from CMake
No CMAKE_RC_COMPILER could be found
.- Check the Advanced checkbox to show additional options.
- Point
CMAKE_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
). - Also set
CMAKE_RC_COMPILER_INIT
torc
(if it even shows up).
- Click Configure
- Click Generate
- Open a Terminal and
cd
into the build location - 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. Use official LLVM Clang as described above.