Skip to content

Commit 0ef3827

Browse files
author
Github Executorch
committed
Update base for Update on "stop double-installing ExecuTorch in one-off linux jobs"
setup-linux.sh already installs ExecuTorch with XNNPACK (and it passes use-pt-pinned-commit as it should). Differential Revision: [D67996460](https://our.internmc.facebook.com/intern/diff/D67996460/) [ghstack-poisoned]
1 parent 9dd64ab commit 0ef3827

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

build/build_apple_frameworks.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ echo "Exporting headers"
188188
mkdir -p "$HEADERS_PATH"
189189

190190
# Set BUCK2 to the path of the buck2 executable in $OUTPUT/*/buck2-bin/buck2-*
191-
BUCK2=$(find . -type f -path '*/buck2-bin/buck2-*' | head -n 1)
191+
BUCK2=$(find $SOURCE_ROOT_DIR -type f -path '*/buck2-bin/buck2-*' | head -n 1)
192192
if [[ -z "$BUCK2" ]]; then
193193
echo "Could not find buck2 executable in any buck2-bin directory under $OUTPUT"
194194
BUCK2=$(which buck2)
@@ -201,6 +201,20 @@ check_command "$BUCK2"
201201
//extension/tensor: \
202202
| rsync -av --files-from=- "$SOURCE_ROOT_DIR" "$HEADERS_PATH/executorch"
203203

204+
# HACK: XCFrameworks don't appear to support exporting any build
205+
# options, but we need the following:
206+
# - runtime/core/portable/type/c10 reachable with `#include <c10/...>`
207+
# - exported -DC10_USING_CUSTOM_GENERATED_MACROS compiler flag
208+
# So, just patch our generated framework to do that.
209+
sed -i '' '1i\
210+
#define C10_USING_CUSTOM_GENERATED_MACROS
211+
' $SOURCE_ROOT_DIR/runtime/core/portable_type/c10/macros/Macros.h
212+
sed -i '' '1i\
213+
#define C10_USING_CUSTOM_GENERATED_MACROS
214+
' $SOURCE_ROOT_DIR/runtime/core/portable_type/c10/macros/Export.h
215+
cp -r $SOURCE_ROOT_DIR/runtime/core/portable_type/c10 "$HEADERS_PATH/"
216+
217+
204218
cp "$SOURCE_ROOT_DIR/extension/apple/ExecuTorch/Exported/"*.h "$HEADERS_PATH/executorch"
205219
cp "$SOURCE_ROOT_DIR/extension/apple/ExecuTorch/Exported/"*.modulemap "$HEADERS_PATH"
206220

0 commit comments

Comments
 (0)