/iree-template-cpp

IREE C++ Template

Primary LanguageCApache License 2.0Apache-2.0

IREE C++ Template

Build IREE C++ Template

DISCLAIMER: This project is not intended for everyday use and made available without any support. However, we welcome any kind of feedback via the issue tracker or if appropriate via IREE's communication channels, e.g. via the Discord server.

The IREE C++ template demonstrated how to integrate IREE into a third-party project with CMake. IREE runtime support is demonstrated via the simple_embedding sample forked from IREE, where the original source can be found here.

The template was developed by Marius Brehler at Fraunhofer IML.
The project is no longer maintained and is archived.

Getting Started

Prerequisites

Since this template demonstrates how to use IREE compontens out-of-tree, the prerequisites match those of IREE, documented in the Getting started guide. Make sure you have CMake >= 3.16.3 and clang installed.

Clone and Build

Clone

git clone https://github.com/iml130/iree-template-cpp.git
cd iree-template-cpp
git submodule update --init
cd third_party/iree
git submodule update --init
cd ../../

Note:
    The submodules used within IREE themself include submodules, so that we advice to avoid an recursive update.

Note:
    It may happen that new submodules are added to IREE.
    Thus it might not be sufficient to only pull the latest master and you may need update the submodules manually.

Configure and Build

# export LDFLAGS=-fuse-ld=$(which ld.lld)

mkdir build
cd build
cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. \
# -DLLVM_ENABLE_LLD=ON

ninja

Note:
    Uncomment the lines above to enable linking via ldd.

What's next?

Explore the sample iree_simple_embedding within the build directory:

iree_simple_embedding

  • simple_embedding_test: Test executable.

Of course it's also worth to explore the corresponding CMake configuration.