Skip to content

Getting startedlink

Prerequisiteslink

You will need to install CMake, the Ninja CMake generator, and the clang or MSVC C/C++ compilers. The tests also requires Python3 and the python package requests to run.

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 CMake (typically "cmake" package)

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

If using Homebrew:

brew install cmake ninja
  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 buildlink

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 .
# 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 .
cmake -GNinja -B ../iree-build/ -S . \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DIREE_ENABLE_ASSERTIONS=ON

Build:

cmake --build ../iree-build/
Tip - Build types

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.

Tip - Faster recompilation with ccache

We recommend using ccache together with CMake. To use it, configure CMake with:

-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache

See also our developer documentation for ccache.

What's next?link

Running testslink

Build test dependencies and run tests:

cmake --build ../iree-build --target iree-run-tests

Internally, this builds dependencies via the iree-test-deps target and invokes CTest.

The parallel testing level can be set via the environment variable CTEST_PARALLEL_LEVEL when invoking ctest in this fashion. Instructions are printed to test with a custom command line.

Take a look aroundlink

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

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