Jerry Wu | d41d073 | 2022-11-23 01:43:55 +0000 | [diff] [blame^] | 1 | #!/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 | |
| 16 | set -xeuo pipefail |
| 17 | |
| 18 | ROOT_DIR="${ROOT_DIR:-$(git rev-parse --show-toplevel)}" |
| 19 | cd "${ROOT_DIR}" |
| 20 | |
| 21 | CMAKE_BIN=${CMAKE_BIN:-$(which cmake)} |
| 22 | IREE_HOST_BINARY_ROOT="$(realpath ${IREE_HOST_BINARY_ROOT})" |
| 23 | IREE_TF_BINARIES_DIR="${IREE_TF_BINARIES_DIR:-integrations/tensorflow/bazel-bin/iree_tf_compiler}" |
| 24 | BUILD_E2E_TEST_ARTIFACTS_DIR="${BUILD_E2E_TEST_ARTIFACTS_DIR:-$ROOT_DIR/build-e2e-test-artifacts}" |
| 25 | |
| 26 | "$CMAKE_BIN" --version |
| 27 | ninja --version |
| 28 | |
| 29 | if [[ -d "${BUILD_E2E_TEST_ARTIFACTS_DIR}" ]]; then |
| 30 | echo "${BUILD_E2E_TEST_ARTIFACTS_DIR} directory already exists. Will use cached results there." |
| 31 | else |
| 32 | echo "${BUILD_E2E_TEST_ARTIFACTS_DIR} directory does not already exist. Creating a new one." |
| 33 | mkdir "${BUILD_E2E_TEST_ARTIFACTS_DIR}" |
| 34 | fi |
| 35 | |
| 36 | echo "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 | |
| 47 | echo "Building e2e test artifacts" |
| 48 | "${CMAKE_BIN}" \ |
| 49 | --build "${BUILD_E2E_TEST_ARTIFACTS_DIR}" \ |
| 50 | --target iree-e2e-test-artifacts \ |
| 51 | -- -k 0 |