-
Notifications
You must be signed in to change notification settings - Fork 528
/
Copy pathbuild_cadence_runner.sh
executable file
·53 lines (43 loc) · 1.63 KB
/
build_cadence_runner.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
51
52
53
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# Builds cadence_runner and prints its path.
set -euo pipefail
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
readonly SCRIPT_DIR
readonly EXECUTORCH_ROOT="${SCRIPT_DIR}/../.."
# Allow overriding the number of build jobs. Default to 9.
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-9}"
main() {
cd "${EXECUTORCH_ROOT}"
rm -rf cmake-out
CXXFLAGS="-fno-exceptions -fno-rtti" cmake -DCMAKE_INSTALL_PREFIX=cmake-out \
-DCMAKE_BUILD_TYPE=Release \
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
-DEXECUTORCH_ENABLE_LOGGING=ON \
-Bcmake-out .
cmake --build cmake-out --target install --config Release -j16
local example_dir=backends/cadence
local build_dir="cmake-out/${example_dir}"
local cmake_prefix_path="${PWD}/cmake-out/lib/cmake/ExecuTorch;${PWD}/cmake-out/third-party/gflags"
rm -rf ${build_dir}
CXXFLAGS="-fno-exceptions -fno-rtti" cmake -DCMAKE_PREFIX_PATH="${cmake_prefix_path}" \
-DCMAKE_BUILD_TYPE=Release \
-DEXECUTORCH_CADENCE_CPU_RUNNER=ON \
-DEXECUTORCH_ENABLE_LOGGING=ON \
-B"${build_dir}" \
"${example_dir}"
cmake --build "${build_dir}" --config Release -j16
local runner="${PWD}/${build_dir}/cadence_runner"
if [[ ! -f "${runner}" ]]; then
echo "ERROR: Failed to build ${build_dir}/cadence_runner" >&2
exit 1
else
echo "Built ${build_dir}/cadence_runner"
fi
}
main "$@"