Skip to content

Commit 4aefd24

Browse files
shoumikhinfacebook-github-bot
authored andcommitted
Update build framework script to skip specifying buck executable.
Summary: . Differential Revision: D64053120
1 parent 513d166 commit 4aefd24

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

build/build_apple_frameworks.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ SOURCE_ROOT_DIR=""
1111
OUTPUT="cmake-out"
1212
MODE="Release"
1313
TOOLCHAIN=""
14-
BUCK2=$(which buck2)
1514
PYTHON=$(which python3)
1615
FLATC=$(which flatc)
1716
COREML=OFF
@@ -80,7 +79,6 @@ usage() {
8079
echo " --output=DIR Output directory. Default: 'cmake-out'"
8180
echo " --Debug Use Debug build mode. Default: Uses Release build mode."
8281
echo " --toolchain=FILE Cmake toolchain file. Default: '\$SOURCE_ROOT_DIR/third-party/ios-cmake/ios.toolchain.cmake'"
83-
echo " --buck2=FILE Buck2 executable path. Default: Path of buck2 found in the current \$PATH"
8482
echo " --python=FILE Python executable path. Default: Path of python3 found in the current \$PATH"
8583
echo " --flatc=FILE FlatBuffers Compiler executable path. Default: Path of flatc found in the current \$PATH"
8684
echo " --coreml Include this flag to build the Core ML backend."
@@ -92,7 +90,7 @@ usage() {
9290
echo " --xnnpack Include this flag to build the XNNPACK backend."
9391
echo
9492
echo "Example:"
95-
echo " $0 /path/to/source/root --output=cmake-out --toolchain=/path/to/cmake/toolchain --buck2=/path/to/buck2 --python=/path/to/python3 --coreml --mps --xnnpack"
93+
echo " $0 /path/to/source/root --output=cmake-out --toolchain=/path/to/cmake/toolchain --python=/path/to/python3 --coreml --mps --xnnpack"
9694
exit 0
9795
}
9896

@@ -102,7 +100,6 @@ for arg in "$@"; do
102100
--output=*) OUTPUT="${arg#*=}" ;;
103101
--Debug) MODE="Debug" ;;
104102
--toolchain=*) TOOLCHAIN="${arg#*=}" ;;
105-
--buck2=*) BUCK2="${arg#*=}" ;;
106103
--python=*) PYTHON="${arg#*=}" ;;
107104
--flatc=*) FLATC="${arg#*=}" ;;
108105
--coreml) COREML=ON ;;
@@ -138,7 +135,6 @@ check_command() {
138135

139136
check_command cmake
140137
check_command rsync
141-
check_command "$BUCK2"
142138
check_command "$PYTHON"
143139
check_command "$FLATC"
144140

@@ -158,7 +154,6 @@ cmake_build() {
158154
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \
159155
-DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD="c++17" \
160156
-DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY="libc++" \
161-
-DBUCK2="$BUCK2" \
162157
-DPYTHON_EXECUTABLE="$PYTHON" \
163158
-DFLATC_EXECUTABLE="$FLATC" \
164159
-DEXECUTORCH_BUILD_COREML=$COREML \
@@ -190,6 +185,13 @@ echo "Exporting headers"
190185

191186
mkdir -p "$HEADERS_PATH"
192187

188+
# Set BUCK2 to the path of the buck2 executable in $OUTPUT/buck2-bin/buck2-*
189+
BUCK2=$(find "$OUTPUT/buck2-bin/" -type f -name 'buck2-*' -executable | head -n 1)
190+
if [[ -z "$BUCK2" ]]; then
191+
echo "Could not find buck2 executable in $OUTPUT/buck2-bin/"
192+
exit 1
193+
fi
194+
193195
"$SOURCE_ROOT_DIR"/build/print_exported_headers.py --buck2="$BUCK2" --targets \
194196
//extension/module: \
195197
//extension/tensor: \

build/test_ios.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ set -e
1515

1616
OUTPUT="${1:-executorch}"
1717
EXIT_STATUS=0
18-
BUCK2_RELEASE_DATE="2024-05-15"
19-
BUCK2_ARCHIVE="buck2-aarch64-apple-darwin.zst"
20-
BUCK2=".venv/bin/buck2"
2118
APP_PATH="examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo"
2219
MODEL_NAME="mv3"
2320
SIMULATOR_NAME="executorch"
@@ -66,10 +63,6 @@ say "Installing Requirements"
6663

6764
pip install --upgrade cmake pip setuptools wheel zstd
6865

69-
curl -LO "https://github.com/facebook/buck2/releases/download/$BUCK2_RELEASE_DATE/$BUCK2_ARCHIVE"
70-
zstd -cdq "$BUCK2_ARCHIVE" > "$BUCK2" && chmod +x "$BUCK2"
71-
rm "$BUCK2_ARCHIVE"
72-
7366
./install_requirements.sh --pybind coreml mps xnnpack
7467
export PATH="$(realpath third-party/flatbuffers/cmake-out):$PATH"
7568
./build/install_flatc.sh
@@ -99,7 +92,7 @@ curl https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt \
9992

10093
say "Building Frameworks"
10194

102-
./build/build_apple_frameworks.sh --buck2="$(realpath $BUCK2)" --coreml --custom --mps --optimized --portable --quantized --xnnpack
95+
./build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
10396
mv cmake-out "$APP_PATH/Frameworks"
10497

10598
say "Creating Simulator"

docs/source/apple-runtime.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,7 @@ source .venv/bin/activate
121121
pip install --upgrade cmake pip zstd
122122
```
123123

124-
5. Install a compatible version of [Buck2](https://buck.build):
125-
126-
```bash
127-
BUCK2_RELEASE_DATE="2024-05-15"
128-
BUCK2_ARCHIVE="buck2-aarch64-apple-darwin.zst"
129-
BUCK2=".venv/bin/buck2"
130-
131-
curl -LO "https://github.com/facebook/buck2/releases/download/$BUCK2_RELEASE_DATE/$BUCK2_ARCHIVE"
132-
zstd -cdq "$BUCK2_ARCHIVE" > "$BUCK2" && chmod +x "$BUCK2"
133-
rm "$BUCK2_ARCHIVE"
134-
```
135-
136-
6. Install the required dependencies, including those needed for the backends like [Core ML](build-run-coreml.md) or [MPS](build-run-mps.md), if you plan to build them as well:
124+
5. Install the required dependencies, including those needed for the backends like [Core ML](build-run-coreml.md) or [MPS](build-run-mps.md), if you plan to build them as well:
137125

138126
```bash
139127
./install_requirements.sh
@@ -145,7 +133,7 @@ rm "$BUCK2_ARCHIVE"
145133
./backends/apple/mps/install_requirements.sh
146134
```
147135

148-
7. Use the provided script to build .xcframeworks:
136+
6. Use the provided script to build .xcframeworks:
149137

150138
```bash
151139
./build/build_apple_frameworks.sh --help
@@ -154,7 +142,7 @@ rm "$BUCK2_ARCHIVE"
154142
For example, the following invocation will build the ExecuTorch Runtime and all currently available kernels and backends for the Apple platform:
155143

156144
```bash
157-
./build/build_apple_frameworks.sh --buck2="$(realpath $BUCK2)" --coreml --custom --mps --optimized --portable --quantized --xnnpack
145+
./build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
158146
```
159147

160148
After the build finishes successfully, the resulting frameworks can be found in the `cmake-out` directory.

0 commit comments

Comments
 (0)