blob: 0c0839a0dac15a6ba40cb1cfc362e10df5100a6e [file] [log] [blame]
Jerry Wud41d0732022-11-23 01:43:55 +00001#!/bin/bash
2
3# Copyright 2022 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 e2e test artifacts using a host tools directory.
10# Designed for CI, but can be run locally.
11#
12# This is copied and modified from build_tools/cmake/build_benchmarks.sh.
13# We will remove build_tools/cmake/build_benchmarks.sh once everything has been
14# migrated.
15
16set -xeuo pipefail
17
18ROOT_DIR="${ROOT_DIR:-$(git rev-parse --show-toplevel)}"
19cd "${ROOT_DIR}"
20
21CMAKE_BIN=${CMAKE_BIN:-$(which cmake)}
22IREE_HOST_BINARY_ROOT="$(realpath ${IREE_HOST_BINARY_ROOT})"
23IREE_TF_BINARIES_DIR="${IREE_TF_BINARIES_DIR:-integrations/tensorflow/bazel-bin/iree_tf_compiler}"
24BUILD_E2E_TEST_ARTIFACTS_DIR="${BUILD_E2E_TEST_ARTIFACTS_DIR:-$ROOT_DIR/build-e2e-test-artifacts}"
25
26"$CMAKE_BIN" --version
27ninja --version
28
29if [[ -d "${BUILD_E2E_TEST_ARTIFACTS_DIR}" ]]; then
30 echo "${BUILD_E2E_TEST_ARTIFACTS_DIR} directory already exists. Will use cached results there."
31else
32 echo "${BUILD_E2E_TEST_ARTIFACTS_DIR} directory does not already exist. Creating a new one."
33 mkdir "${BUILD_E2E_TEST_ARTIFACTS_DIR}"
34fi
35
36echo "Configuring to build e2e test artifacts"
37"${CMAKE_BIN}" -B "${BUILD_E2E_TEST_ARTIFACTS_DIR}" \
38 -G Ninja \
39 -DIREE_HOST_BINARY_ROOT="${IREE_HOST_BINARY_ROOT}" \
40 -DIREE_BUILD_EXPERIMENTAL_E2E_TEST_ARTIFACTS=ON \
41 -DIREE_BUILD_COMPILER=OFF \
42 -DIREE_BUILD_SAMPLES=OFF \
43 -DIREE_BUILD_TESTS=OFF \
44 -DIREE_IMPORT_TFLITE_PATH="${IREE_TF_BINARIES_DIR}/iree-import-tflite" \
45 -DIREE_IMPORT_TF_PATH="${IREE_TF_BINARIES_DIR}/iree-import-tf"
46
47echo "Building e2e test artifacts"
48"${CMAKE_BIN}" \
49 --build "${BUILD_E2E_TEST_ARTIFACTS_DIR}" \
50 --target iree-e2e-test-artifacts \
51 -- -k 0