Getting started

Prerequisites

You will need to install CMake, along with a C/C++ compiler:

=== “Linux and MacOS”

<!-- TODO(scotttodd): annotation about gcc vs clang -->

``` shell
sudo apt install cmake clang
export CC=clang
export CXX=clang++
```

=== “Windows”

1. Install CMake from the
   [official downloads page](https://cmake.org/download/)

2. Install MSVC from Visual Studio or "Tools for Visual Studio" on the
   [official downloads page](https://visualstudio.microsoft.com/downloads/)

!!! note
    You will need to initialize MSVC by running `vcvarsall.bat` to use it
    from the command line. See the
    [official documentation](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line)
    for details.

Clone and build

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

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

Configure then build all targets using CMake:

cmake -B ../iree-build/ -DCMAKE_BUILD_TYPE=RelWithDebInfo .
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.

???+ Tip Most IREE Core devs use Ninja as the CMake generator. The benefit is that it works the same across all platforms and automatically takes advantage of parallelism. to use it, add a -GNinja argument to your initial cmake command (and make sure to install ninja-build from either your favorite OS package manager, or generically via python -m pip install ninja).

What's next?

Running tests

Run all built tests through CTest:

cd ../iree-build/
ctest --output-on-failure

Take a look around

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

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