|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | # Copyright (c) 2024 Apple Inc. All rights reserved. |
3 | 3 | # Provided subject to the LICENSE file in the top level directory. |
| 4 | +# |
| 5 | +# Copyright (c) Meta Platforms, Inc. and affiliates. |
| 6 | +# All rights reserved. |
| 7 | +# |
| 8 | +# This source code is licensed under the BSD-style license found in the |
| 9 | +# LICENSE file in the root directory of this source tree. |
4 | 10 |
|
5 | | -set -e |
| 11 | + |
| 12 | +set -eux |
6 | 13 |
|
7 | 14 | MODE="Release" |
8 | 15 | OUTPUT="cmake-out" |
|
38 | 45 |
|
39 | 46 | rm -rf "$OUTPUT" |
40 | 47 |
|
41 | | -cmake -DBUCK2="$BUCK" \ |
42 | | - -DCMAKE_INSTALL_PREFIX=cmake-out \ |
43 | | - -DCMAKE_BUILD_TYPE="$MODE" \ |
44 | | - -DEXECUTORCH_BUILD_DEVTOOLS=ON \ |
45 | | - -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \ |
46 | | - -DEXECUTORCH_BUILD_MPS=ON \ |
47 | | - -DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \ |
48 | | - -Bcmake-out . |
49 | | -cmake --build cmake-out -j9 --target install --config "$MODE" |
50 | | -CMAKE_PREFIX_PATH="${PWD}/cmake-out/lib/cmake/ExecuTorch;${PWD}/cmake-out/third-party/gflags" |
51 | | -# build mps_executor_runner |
52 | | -rm -rf cmake-out/examples/apple/mps |
53 | | -cmake \ |
54 | | - -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \ |
55 | | - -DCMAKE_BUILD_TYPE="$MODE" \ |
56 | | - -DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \ |
57 | | - -Bcmake-out/examples/apple/mps \ |
58 | | - examples/apple/mps |
59 | | - |
60 | | -cmake --build cmake-out/examples/apple/mps -j9 --config "$MODE" |
| 48 | +cmake -DCMAKE_INSTALL_PREFIX=${OUTPUT} \ |
| 49 | + -DCMAKE_BUILD_TYPE=${MODE} \ |
| 50 | + -DEXECUTORCH_ENABLE_LOGGING=ON \ |
| 51 | + -DEXECUTORCH_BUILD_DEVTOOLS=ON \ |
| 52 | + -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \ |
| 53 | + -Dprotobuf_BUILD_TESTS=OFF \ |
| 54 | + -B ${OUTPUT} \ |
| 55 | + --preset macos |
| 56 | + |
| 57 | +cmake --build ${OUTPUT} \ |
| 58 | + -j $(sysctl -n hw.ncpu) \ |
| 59 | + --config ${MODE} \ |
| 60 | + --target install |
| 61 | + |
| 62 | +cmake -DCMAKE_PREFIX_PATH="${OUTPUT}/lib/cmake/ExecuTorch;${OUTPUT}/third-party/gflags" \ |
| 63 | + -DCMAKE_BUILD_TYPE="$MODE" \ |
| 64 | + -DCMAKE_OSX_DEPLOYMENT_TARGET="12.0" \ |
| 65 | + -B "${OUTPUT}/examples/apple/mps" \ |
| 66 | + -S examples/apple/mps |
| 67 | + |
| 68 | +cmake --build "${OUTPUT}/examples/apple/mps" \ |
| 69 | + -j $(sysctl -n hw.ncpu) \ |
| 70 | + --config ${MODE} \ |
| 71 | + --target mps_executor_runner |
61 | 72 |
|
62 | 73 | echo "Build succeeded!" |
0 commit comments