Building ispc: Windows

Dmitry Babokin edited this page Jun 3, 2013 · 13 revisions

In order to build ispc from source, you first must build LLVM from source. We recommend that you either use the LLVM 3.2 or LLVM 3.3 release or download a snapshot of the LLVM 3.4 development tree.


To build LLVM, do the following. (These directions assume LLVM 3.2; building other versions of LLVM is essentially the same process.)
  • Get the sources. You can either download a tarball from LLVM web site or check out sources using SVN:
  • Create MSVC solution files for LLVM using "CMake". (See also the LLVM documentation about building with MSVC for more information.) First, launch the CMake GUI and exit any running instances of Visual Studio.
    • Click the "Browse Source..." button in CMake and point it to the directory LLVM extracted itself to from the tar file (llvm-3.2.src). Then click the "Browse Build..." button and select a directory for building object files (let's assume it's C:/Users/yourname/llvm/build-3.2).
    • Click "Configure" (for the first time), and then select the appropriate version of Visual Studio (e.g. "Visual Studio 10"). It's recommended to use Win32.
    • Click "Finish".
    • Change the value of CMAKE_INSTALL_PREFIX to a reasonable directory (e.g. C:/Users/yourname/llvm/bin-3.2). Remember which directory you chose here.
    • Set LLVM_LIT_TOOLS_DIR to point to your installation of GnuWin32 (typically C:/gnuwin32/bin), so you don't need to add GnuWin32 to PATH and can avoid conflict with Cygwin.
    • Click "Configure" again, and then click "Generate" to finally create the solution files.
  • Build LLVM:
    • Open the 'install.vcxproj' file in the LLVM directory. Select the 'Release' build and then build the solution (F7). Wait.
    • Right click on "INSTALL" in the solution explorer, and choose "build". This copies the appropriate files into the install directory.
After LLVM has been installed, you can build ispc:
  • The following GNU tools must be installed (e.g. via cygwin) and in your PATH: m4, flex, and bison. Flex must be version 2.5 or later, and bison must be version 2.4 or later.
  • Set an environment variable, LLVM_INSTALL_DIR, that points to the directory in which you installed the LLVM headers, binaries, and libraries (e.g. C:/Users/yourname/llvm/bin-3.2).
  • Set an environment variable, LLVM_VERSION, with the value LLVM_3_2, or LLVM_3_3, or LLVM_3_4 depending on which version of LLVM you're using.
  • Launch a new instance of MSVC2010 and open the ispc.sln file.
  • Select the release x86 build, and build (F7)!
Your ispc executable will be in the Release/ directory of your ispc directory. Copy it to a directory in your PATH and you're ready to go.