From b24a0df8d7c9d3e12f074c35bb0559f4c8a18fa8 Mon Sep 17 00:00:00 2001 From: NiccoloN Date: Mon, 23 Feb 2026 19:06:14 +0100 Subject: [PATCH] add basic CMakeLists.txt add build instructions --- CMakeLists.txt | 6 ++++++ README.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..bdccafc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +# Match the minimum required version of onnx-mlir +cmake_minimum_required(VERSION 3.20.0) + +project(raptor) + +add_subdirectory(onnx-mlir) diff --git a/README.md b/README.md index 16f2361..7ed081e 100644 --- a/README.md +++ b/README.md @@ -1 +1,37 @@ # Raptor + +## Build + +### Mlir + +Follow the first part of instructions [here](onnx-mlir/docs/BuildOnLinuxOSX.md) to build mlir. + +Remember to set ```-DCMAKE_BUILD_TYPE=Debug``` for developing on Raptor + +Moreover, if compiling with build type debug, it is also suggested to use +mold as linker (you will need to install it if you don't have it already) +to reduce memory usage during linking. You can use it with: +``` +-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" \ +-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold" +``` + +### Raptor + +Use the following commands to build Raptor. +Remember to set ```-DCMAKE_BUILD_TYPE=Debug``` for developing on Raptor. + +``` +git submodule update --init --recursive + +MLIR_DIR=$(pwd)/onnx-mlir/llvm-project/build/lib/cmake/mlir +mkdir build && cd build +cmake .. -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DMLIR_DIR=${MLIR_DIR} +cmake --build . +``` + +If the build fails because of protobuf missing uint definitions, +just patch the problematic files by adding ```#include ``` to their includes.