Skip to content

Getting started

Prerequisites

You will need to install CMake, the Ninja CMake generator, and the clang or MSVC C/C++ compilers:

Note

You are welcome to try different CMake generators and compilers, but IREE devs and CIs exclusively use these and other configurations are "best effort". Additionally, compilation on macOS is "best effort" as well, though we generally expect it to work due to its similarity with Linux. Patches to improve support for these are always welcome.

  1. Install a compiler/linker (typically "clang" and "lld" package)

  2. Install CMake (typically "cmake" package)

  3. Install Ninja (typically "ninja-build" package)

On a relatively recent Debian/Ubuntu:

sudo apt install cmake ninja-build clang lld
  1. Install MSVC from Visual Studio or "Tools for Visual Studio" on the official downloads page

  2. Install CMake from the official downloads page

  3. Install Ninja either from the official site

Note

You will need to initialize MSVC by running vcvarsall.bat to use it from the command line. See the official documentation for details.

Clone and build

Use Git to clone the IREE repository and initialize its submodules:

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

Configure then build all targets using CMake:

Configure CMake:

# Recommended for simple development using clang and lld:
cmake -GNinja -B ../iree-build/ -S . \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DIREE_ENABLE_ASSERTIONS=ON \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DIREE_ENABLE_LLD=ON

# Alternately, with system compiler and your choice of CMake generator:
# cmake -B ../iree-build/ -S .

# Additional quality of life CMake flags:
# Enable ccache:
# See https://github.com/iree-org/iree/blob/main/docs/developers/developing_iree/ccache.md
#   -DCMAKE_C_COMPILER_LAUNCHER=ccache
#   -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake -GNinja -B ../iree-build/ -S . \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DIREE_ENABLE_ASSERTIONS=ON

Build:

cmake --build ../iree-build/
Tip

We recommend using the RelWithDebInfo build type by default for a good balance of debugging information and performance. The Debug, Release, and MinSizeRel build types are useful in more specific scenarios. In particular, note that several useful LLVM debugging features are only available in Debug builds. See the official CMake documentation for general details.

What's next?

Running tests

Build test dependencies:

cmake --build ../iree-build --target iree-test-deps

Run all built tests through CTest:

ctest --test-dir ../iree-build/ --output-on-failure

Take a look around

Check out the contents of the 'tools' build directory:

ls ../iree-build/tools/
../iree-build/tools/iree-compile --help