Getting Started on Windows with CMake

This guide walks through building the core compiler and runtime parts of IREE from source. Auxiliary components like the Python bindings and Vulkan driver are documented separately, as they require further setup.

Prerequisites

Install CMake

Install CMake version >= 3.13 from the downloads page.

Tip:
    Your editor of choice likely has plugins for CMake, such as the Visual Studio Code CMake Tools extension.

Install Ninja

Ninja is a fast build system that you can use as a CMake generator. Download it from the releases page, extract somewhere, and add it to your PATH.

Install a Compiler

We recommend MSVC from either the full Visual Studio or from “Build Tools For Visual Studio”:

  • Choose either option from the downloads page and during installation make sure you include “C++ Build Tools”

  • Initialize MSVC by running vcvarsall.bat:

    > "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
    

Clone and Build

Clone

Using your shell of choice (such as PowerShell or cmder), clone the repository and initialize its submodules:

> git clone https://github.com/google/iree.git
> cd iree
> git submodule update --init

Tip:
    Editors and other programs can also clone the repository, just make sure that they initialize the submodules.

Build

Configure:

> cmake -G Ninja -B build\ .

Tip:
    The root CMakeLists.txt file has options for configuring which parts of the project to enable.
    These are further documented in CMake Options and Variables.

Build all targets:

> cmake --build build\

What's next?

Take a Look Around

Check out the contents of the ‘tools’ build directory:

> dir build\iree\tools
> .\build\iree\tools\iree-translate.exe --help

Translate a MLIR file and execute a function in the compiled module:

> .\build\iree\tools\iree-run-mlir.exe .\iree\tools\test\simple.mlir -function-input="i32=-2" -iree-hal-target-backends=vmla -print-mlir

Further Reading