-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android demo app tutorial fix for XNNPACK and QNN (#2962)
Summary: * Update tutorial due to recent changes. * Clean up setup.sh for app helper lib build. Pull Request resolved: #2962 Reviewed By: cccclai Differential Revision: D55951189 Pulled By: kirklandsign fbshipit-source-id: 2c95e8580145b039f503e7cd99a4003867f8dbb0 (cherry picked from commit 26365f1)
- Loading branch information
1 parent
ca69051
commit 5dbebaa
Showing
4 changed files
with
69 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# Copyright 2023-2024 Arm Limited and/or its affiliates. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
set -eu | ||
|
||
# Note: Set up ANDROID_NDK, ANDROID_ABI, BUCK2, and FLATC | ||
cmake . -DCMAKE_INSTALL_PREFIX=cmake-out \ | ||
CMAKE_OUT="${CMAKE_OUT:-cmake-out-android}" | ||
# Note: Set up ANDROID_NDK and ANDROID_ABI | ||
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \ | ||
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ | ||
-DANDROID_ABI="${ANDROID_ABI}" \ | ||
-DBUCK2="${BUCK2}" \ | ||
-DEXECUTORCH_BUILD_XNNPACK=ON \ | ||
-DEXECUTORCH_BUILD_FLATC=OFF \ | ||
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ | ||
-DFLATC_EXECUTABLE="${FLATC}" \ | ||
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ | ||
-Bcmake-out | ||
-DEXECUTORCH_BUILD_OPTIMIZED=ON \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-B"${CMAKE_OUT}" | ||
|
||
if [ "$(uname)" == "Darwin" ]; then | ||
CMAKE_JOBS=$(( $(sysctl -n hw.ncpu) - 1 )) | ||
else | ||
CMAKE_JOBS=$(( $(nproc) - 1 )) | ||
fi | ||
cmake --build cmake-out -j "${CMAKE_JOBS}" --target install | ||
cmake --build "${CMAKE_OUT}" -j "${CMAKE_JOBS}" --target install --config Release | ||
|
||
cmake extension/android -DBUCK2="${BUCK2}" \ | ||
cmake extension/android \ | ||
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ | ||
-DANDROID_ABI="${ANDROID_ABI}" \ | ||
-DCMAKE_INSTALL_PREFIX=cmake-out \ | ||
-Bcmake-out/extension/android | ||
-DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-B"${CMAKE_OUT}"/extension/android | ||
|
||
cmake --build cmake-out/extension/android -j "${CMAKE_JOBS}" | ||
cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}" --config Release | ||
|
||
JNI_LIBS_PATH="examples/demo-apps/android/ExecuTorchDemo/app/src/main/jniLibs" | ||
mkdir -p "${JNI_LIBS_PATH}/${ANDROID_ABI}" | ||
cp cmake-out/extension/android/libexecutorch_jni.so "${JNI_LIBS_PATH}/${ANDROID_ABI}/libexecutorch.so" | ||
cp "${CMAKE_OUT}"/extension/android/libexecutorch_jni.so "${JNI_LIBS_PATH}/${ANDROID_ABI}/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters