Clang

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.

CMake

Download the Zip file from CMake

Extract the CMake zip file. Add /c/CMake to your bash profile or path.

Minimum recommended version of CMake is 3.4.3

Python 2.7

Download the installer from Python 2.7

Run the Python Windows installer. Add /c/Python27 to your bash profile or path.

Msys

We recommend installing the following version of MSYS as it provides GNU Make and several other tools designed to work with the MinGW version of GCC. The same version of MSYS is used for 32-bit and 64-bit systems.

MSYS Version msys+7za+wget+svn+git+mercurial+cvs-rev13.7z   MSYS

Extract the MSYS zip file. Add /c/MSys/bin to your bash profile or path.

MingGW

Use the MinGW SJLJ version to build a 32-bit version on Windows 32 or Windows 64, for Windows 32. MinGW SEH is used to to build for Windows 64.

  • MinGW 64-bit Version x86_64-7.3.0-release-posix-sjlj-rt_v5-rev0.7z   MinGW 64-bit SJLJ

        Use this version of MinGW to build 32-bit binaries on 64-bit systems.

  • MinGW 64-bit Version x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z   MinGW 64-bit SEH

        Use this version of MinGW to build 64-bit binaries on 64-bit systems.

Add /c/MinGW/bin 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. Git is normally installed as part of MSYS. 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

  1.  From the following link locate 'Download LLVM 6.0.1'    LLVM Download Page
  2.  Download the Clang source code and the LLVM source code tar files.

From a root or project directory:

  • md clang
  • cd clang

  • md build
  • md llvm

  • cd llvm
  • Extract llvm tar file ( clang/llvm )

  • cd tools
  • md clang
  • cd clang
  • Extract cfe tar file ( clang/llvm/tools/clang )

  • cd ../../../build

Building (from clang/build)


  • To configure and build the 32-bit version of Clang use the following syntax:
    • CFLAGS=-m32 CXXFLAGS=-m32 cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ../llvm
    • ninja -j2

  • To configure and build the 64-bit version of Clang use the following syntax:
    • cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ../llvm
    • ninja -j2

If you have any questions about these instructions feel free to email us at info [at] copperspice.com