How to build clang on Windows
DoxyPress requires a unique project file for configuration and setup. The project file contains tags which are used to select which output formats should be generated, what should be generated, and numerous other parameters. There is a tag which can be set to instruct DoxyPress to use Clang for parsing C and C++ files.
Since DoxyPress is compiled and linked with the libclang dll we had to build clang on Windows. The steps listed below build a version of clang which does not depend on MSVC.
MinGW-w64
For more information about specific versions and where to download the files, refer to Installing MinGW-w64
CMake
Download the Zip file from CMake
Extract the CMake zip file. Add /c/CMake/bin to your bash profile or path.
Minimum recommended version for CMake is 3.20
Python 3.9
Download the installer from Python 3.9
Run the Python Windows installer. Add /c/Python39 to your bash profile or path.
Ninja
Ninja is used instead of make. In order to install Ninja git needs to be in your path. Follow the steps listed below and do not forget the period at the end of step two.
- cd /c/ninja
- $ git clone git://github.com/martine/ninja.git .
- $ git checkout release
- ./configure.py --bootstrap --host=mingw --platform=mingw
Add /c/Ninja to your bash profile or path.
Minimum recommended version of Ninja is 1.6
Installing Clang Source Code
- From the following link locate 'Download LLVM' LLVM Download Page
- Download the following 4 files LLVM source code (llvm-18.1.8.src.tar.xz), Clang source code (clang-18.1.8.src.tar.xz), Third Party source code (third-party-18.1.8.src.tar.xz), CMake Build files (cmake-18.1.8.src.tar.xz)
From a root or empty directory:
- md clang
- cd clang
- md build
- md llvm
- md third-party
- md cmake
- cd llvm
- Extract llvm tar file ( clang/llvm )
- cd tools
- md clang
- cd clang
- Extract clang tar file ( clang/llvm/tools/clang )
- cd ../../../third-party
- Extract third-party tar file ( clang/third-party )
- cd ../cmake
- Extract cmake tar file ( clang/cmake )
- cd ../build
Building (from clang/build)
- To configure and build the 64-bit version of Clang use the following syntax:
- cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ../llvm
- ninja -j3
If you have any questions about these instructions feel free to email us at info [at] copperspice.com