forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_host_tools.sh
executable file
·50 lines (39 loc) · 1.58 KB
/
build_host_tools.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Copyright 2021 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Builds IREE host tools for use by other builds.
#
# The desired build directory can be passed as the first argument. Otherwise, it
# uses the environment variable IREE_HOST_BUILD_DIR, defaulting to "build-host".
# Designed for CI, but can be run manually. It reuses the build directory if it
# already exists. Expects to be run from the root of the IREE repository.
set -xeuo pipefail
BUILD_DIR="${1:-${IREE_HOST_BUILD_DIR:-build-host}}"
INSTALL_DIR="${INSTALL_DIR:-${BUILD_DIR}/install}"
IREE_ENABLE_ASSERTIONS="${IREE_ENABLE_ASSERTIONS:-OFF}"
source build_tools/cmake/setup_build.sh
source build_tools/cmake/setup_ccache.sh
mkdir -p "${INSTALL_DIR}"
declare -a CMAKE_ARGS=(
"-G" "Ninja"
"-B" "${BUILD_DIR}"
"-DPython3_EXECUTABLE=${IREE_PYTHON3_EXECUTABLE}"
"-DPYTHON_EXECUTABLE=${IREE_PYTHON3_EXECUTABLE}"
"-DCMAKE_INSTALL_PREFIX=$(realpath ${INSTALL_DIR})"
"-DIREE_ENABLE_LLD=ON"
"-DIREE_ENABLE_ASSERTIONS=${IREE_ENABLE_ASSERTIONS}"
"-DIREE_BUILD_COMPILER=ON"
"-DIREE_BUILD_TESTS=OFF"
"-DIREE_BUILD_SAMPLES=OFF"
# Enable the WebGPU compiler build. All deps get fetched as needed, but some
# of the deps are too large to enable by default for all developers.
"-DIREE_TARGET_BACKEND_WEBGPU=ON"
)
"${CMAKE_BIN}" "${CMAKE_ARGS[@]}"
"${CMAKE_BIN}" --build "${BUILD_DIR}" --target install -- -k 0
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi