@@ -152,6 +152,45 @@ for preset_index in "${!PRESETS[@]}"; do
152152 preset=" ${PRESETS[$preset_index]} "
153153 preset_output_dir=" ${OUTPUT_DIR} /${PRESETS_RELATIVE_OUT_DIR[$preset_index]} "
154154
155+ cmake_build () {
156+ local platform=$1
157+ local platform_flag=$2
158+ local platform_target=$3
159+ local mode=$4
160+ echo " Building for $platform ($mode ) with flag $platform_flag "
161+ mkdir -p " $platform " && cd " $platform " || exit 1
162+ cmake " $SOURCE_ROOT_DIR " -G Xcode \
163+ -DCMAKE_BUILD_TYPE=" $mode " \
164+ -DCMAKE_TOOLCHAIN_FILE=" $TOOLCHAIN " \
165+ -DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD=" c++17" \
166+ -DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY=" libc++" \
167+ -DCMAKE_C_FLAGS=" -ffile-prefix-map=$SOURCE_ROOT_DIR =/executorch -fdebug-prefix-map=$SOURCE_ROOT_DIR =/executorch" \
168+ -DCMAKE_CXX_FLAGS=" -ffile-prefix-map=$SOURCE_ROOT_DIR =/executorch -fdebug-prefix-map=$SOURCE_ROOT_DIR =/executorch" \
169+ -DPYTHON_EXECUTABLE=" $PYTHON " \
170+ -DEXECUTORCH_BUILD_COREML=$COREML \
171+ -DEXECUTORCH_BUILD_MPS=$MPS \
172+ -DEXECUTORCH_BUILD_XNNPACK=$XNNPACK \
173+ -DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \
174+ -DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
175+ -DEXECUTORCH_BUILD_EXTENSION_APPLE=ON \
176+ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
177+ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
178+ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
179+ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=$CUSTOM \
180+ -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=$OPTIMIZED \
181+ -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=$QUANTIZED \
182+ -DEXECUTORCH_BUILD_KERNELS_TORCHAO=$TORCHAO \
183+ -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=" $( pwd) " \
184+ ${platform_flag: +-DPLATFORM=$platform_flag } \
185+ ${platform_target: +-DDEPLOYMENT_TARGET=$platform_target } \
186+ --log-level=VERBOSE
187+ cmake --build . \
188+ --config " $mode " \
189+ --verbose
190+ cd -
191+ }
192+
193+ for index in ${! PLATFORMS[*]} ; do
155194 for mode in " ${MODES[@]} " ; do
156195 echo " Building preset ${preset} (${mode} ) in ${preset_output_dir} ..."
157196
0 commit comments