Skip to content

add support for macos (#42) #78

add support for macos (#42)

add support for macos (#42) #78

name: Build and Test w/CMake
permissions: read-all
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Install prerequisites
run: |
sudo apt update
sudo apt install -y uuid-dev
- name: Cache LLVM artifact
id: cache-llvm
uses: actions/cache@v3
with:
path: |
./externals/llvm-project
key: ${{ runner.os }}-cmake-${{ hashFiles('bazel/import_llvm.bzl') }}-${{ hashFiles('**/CMakeLists.txt') }}
- name: Cache mlir-tutorial build
id: cache-mlir-tutorial
uses: actions/cache@v3
with:
path: |
./build
key: ${{ runner.os }}-cmake-${{ hashFiles('bazel/import_llvm.bzl') }}-${{ hashFiles('**/CMakeLists.txt') }}
- name: Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Build LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
LLVM_COMMIT=$(grep LLVM_COMMIT ${GITHUB_WORKSPACE}/bazel/import_llvm.bzl | head -n 1 | cut -d'"' -f 2 )
git submodule update --init --recursive
cd externals/llvm-project
git checkout ${LLVM_COMMIT}
mkdir build && cd build
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=ON -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RTTI=ON -DLLVM_TARGETS_TO_BUILD="host"
cmake --build . --target check-mlir
- name: Build and test mlir-tutorial
run: |
mkdir build && cd build
cmake -DLLVM_DIR=${GITHUB_WORKSPACE}/externals/llvm-project/build/lib/cmake/llvm -DMLIR_DIR=${GITHUB_WORKSPACE}/externals/llvm-project/build/lib/cmake/mlir -DBUILD_DEPS="ON" -DBUILD_SHARED_LIBS="OFF" ..
cmake --build . --target MLIRAffineFullUnrollPasses
cmake --build . --target MLIRMulToAddPasses
cmake --build . --target MLIRNoisyPasses
cmake --build . --target mlir-headers
cmake --build . --target tutorial-opt
cmake --build . --target check-mlir-tutorial