@@ -15,11 +15,6 @@ PRESETS_RELATIVE_OUT_DIR=("ios" "simulator" "macos")
1515SOURCE_ROOT_DIR=$( git rev-parse --show-toplevel)
1616OUTPUT_DIR=" ${SOURCE_ROOT_DIR} /cmake-out"
1717
18- BUCK2=$( python3 " $SOURCE_ROOT_DIR /tools/cmake/resolve_buck.py" --cache_dir=" $SOURCE_ROOT_DIR /buck2-bin" )
19- if [[ " $BUCK2 " == " buck2" ]]; then
20- BUCK2=$( command -v buck2)
21- fi
22-
2318FRAMEWORK_EXECUTORCH_NAME=" executorch"
2419FRAMEWORK_EXECUTORCH_MODULE_NAME=" ExecuTorch"
2520FRAMEWORK_EXECUTORCH_HEADERS_DIR=" ${FRAMEWORK_EXECUTORCH_NAME} _include"
208203echo " Building libraries"
209204
210205rm -rf " ${OUTPUT_DIR} "
206+ mkdir -p " $FRAMEWORK_EXECUTORCH_HEADERS_PATH /$FRAMEWORK_EXECUTORCH_MODULE_NAME "
211207for preset_index in " ${! PRESETS[@]} " ; do
212208 preset=" ${PRESETS[$preset_index]} "
213209 preset_output_dir=" ${OUTPUT_DIR} /${PRESETS_RELATIVE_OUT_DIR[$preset_index]} "
214-
210+ do_install=" "
211+ if [[ " ${preset} " == " macos" ]]; then
212+ do_install=" --target install"
213+ fi
215214 for mode in " ${MODES[@]} " ; do
216215 echo " Building preset ${preset} (${mode} ) in ${preset_output_dir} ..."
217216
@@ -221,25 +220,24 @@ for preset_index in "${!PRESETS[@]}"; do
221220 --fresh \
222221 -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=" ${preset_output_dir} " \
223222 -DCMAKE_BUILD_TYPE=" ${mode} " \
223+ -DCMAKE_INSTALL_PREFIX=" ${preset_output_dir} " \
224224 ${CMAKE_OPTIONS_OVERRIDE[@]:- } \
225225 --preset " ${preset} "
226226
227227 cmake --build " ${preset_output_dir} " \
228- --config " ${mode} "
228+ --config " ${mode} " ${do_install}
229229 done
230+ if [[ " ${preset} " == " macos" ]]; then
231+ find " ${preset_output_dir} /include/executorch" -name ' *.h' \
232+ | sort | sed -e " s|${preset_output_dir} /include/executorch/||" \
233+ | rsync -av --files-from=- " ${preset_output_dir} /include/executorch" " $FRAMEWORK_EXECUTORCH_HEADERS_PATH /$FRAMEWORK_EXECUTORCH_MODULE_NAME "
234+ fi
230235done
231236
232237echo " Exporting headers"
233238
234239# FRAMEWORK_EXECUTORCH
235240
236- mkdir -p " $FRAMEWORK_EXECUTORCH_HEADERS_PATH /$FRAMEWORK_EXECUTORCH_MODULE_NAME "
237-
238- " $SOURCE_ROOT_DIR " /scripts/print_exported_headers.py --buck2=$( realpath " $BUCK2 " ) --targets \
239- //extension/module: \
240- //extension/tensor: \
241- | rsync -av --files-from=- " $SOURCE_ROOT_DIR " " $FRAMEWORK_EXECUTORCH_HEADERS_PATH /$FRAMEWORK_EXECUTORCH_MODULE_NAME "
242-
243241# HACK: XCFrameworks don't appear to support exporting any build
244242# options, but we need the following:
245243# - runtime/core/portable/type/c10 reachable with `#include <c10/...>`
0 commit comments