blob: d233664be2f1ecd280f8a5a8364a02e67672ad7a [file] [log] [blame]
bjacobdf119bd2023-06-16 10:27:00 -04001#!/bin/bash
2
3# Copyright 2023 The IREE Authors
4#
5# Licensed under the Apache License v2.0 with LLVM Exceptions.
6# See https://llvm.org/LICENSE.txt for license information.
7# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
9# Build and test, using CMake/CTest, with the bring-your-own-LLVM path.
10
11set -xeuo pipefail
12
13source build_tools/cmake/setup_ccache.sh
14
15# Environment variables read by byo_llvm.sh.
16export IREE_BYOLLVM_BUILD_DIR="${1:-build-byo-llvm}"
17export IREE_BYOLLVM_INSTALL_DIR="${IREE_BYOLLVM_BUILD_DIR}/install"
18
Stella Laurenzo4f400802024-04-04 09:55:24 -070019python3 --version
20
21# We've been instructed to set up a venv.
22VENV_DIR="$IREE_BYOLLVM_BUILD_DIR/.venv"
23echo "Setting up venv at $VENV_DIR"
24python3 -m venv "$VENV_DIR"
25source "$VENV_DIR/bin/activate"
26python -m pip install -r runtime/bindings/python/iree/runtime/build_requirements.txt
Marius Brehler3eeea7f2024-10-29 17:26:26 +010027python -m pip install -r third_party/llvm-project/mlir/python/requirements.txt
28# Note: IREE's Python bindings for Python 3.13 are build with support for
29# free-threading for which support was added to pybind with version 2.13.0.
30# Therefore, we upgrade to a more recent version and avoid mixing of different
31# pybind versions.
32python -m pip install pybind11==2.13.6
Stella Laurenzo4f400802024-04-04 09:55:24 -070033
bjacobdf119bd2023-06-16 10:27:00 -040034# Note: by using the `build_llvm` action here, we are exercising byo_llvm.sh's
35# ability to build LLVM... from our own third_party/llvm-project. That's not
36# the most intuitive interpretation of "bring your own LLVM", since as far as
37# the source repository is concerned, that's just the standard IREE-bundled one,
38# but that exists for good reasons as some users need control more over the
39# building and packaging than over the source repository, and that's good to
40# have test coverage for, and of course that's more convenient for us to test.
Stella Laurenzoae708152023-06-22 21:51:59 -070041build_tools/llvm/byo_llvm.sh build_llvm
bjacobdf119bd2023-06-16 10:27:00 -040042
Stella Laurenzoae708152023-06-22 21:51:59 -070043build_tools/llvm/byo_llvm.sh build_mlir
44build_tools/llvm/byo_llvm.sh build_iree
bjacobdf119bd2023-06-16 10:27:00 -040045
46echo "*********************** TESTING IREE **********************************"
47iree_build_dir="${IREE_BYOLLVM_BUILD_DIR}/iree"
48echo "Build Directory: ${iree_build_dir}"
49cmake --build "${iree_build_dir}" --target iree-test-deps
50build_tools/cmake/ctest_all.sh "${iree_build_dir}"