From 920183ecc3ac7e4d9a2286a192b0b7f58a4c0fe8 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 22 Oct 2024 14:48:28 -0700 Subject: [PATCH] [Android] Introduce build types and set default to Release ghstack-source-id: cc77b01229f655728aa981a11944333a4936dbd5 Pull Request resolved: https://github.com/pytorch/executorch/pull/6440 --- build/build_android_llm_demo.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build/build_android_llm_demo.sh b/build/build_android_llm_demo.sh index 4eb47c7d05a..3f80d379b4a 100644 --- a/build/build_android_llm_demo.sh +++ b/build/build_android_llm_demo.sh @@ -19,6 +19,7 @@ build_android_native_library() { ANDROID_ABI="$1" ANDROID_NDK="${ANDROID_NDK:-/opt/ndk}" CMAKE_OUT="cmake-out-android-${ANDROID_ABI}" + EXECUTORCH_CMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE:-Release}" QNN_SDK_ROOT="${QNN_SDK_ROOT:-}" if [ -n "$QNN_SDK_ROOT" ]; then EXECUTORCH_BUILD_QNN=ON @@ -52,7 +53,7 @@ build_android_native_library() { -DNEURON_BUFFER_ALLOCATOR_LIB="${NEURON_BUFFER_ALLOCATOR_LIB}" \ -DEXECUTORCH_BUILD_QNN="${EXECUTORCH_BUILD_QNN}" \ -DQNN_SDK_ROOT="${QNN_SDK_ROOT}" \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE}" \ -B"${CMAKE_OUT}" if [ "$(uname)" == "Darwin" ]; then @@ -60,7 +61,7 @@ build_android_native_library() { else CMAKE_JOBS=$(( $(nproc) - 1 )) fi - cmake --build "${CMAKE_OUT}" -j "${CMAKE_JOBS}" --target install --config Release + cmake --build "${CMAKE_OUT}" -j "${CMAKE_JOBS}" --target install --config "${EXECUTORCH_CMAKE_BUILD_TYPE}" cmake extension/android \ -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ @@ -72,10 +73,10 @@ build_android_native_library() { -DNEURON_BUFFER_ALLOCATOR_LIB="$NEURON_BUFFER_ALLOCATOR_LIB" \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \ -DEXECUTORCH_BUILD_LLAMA_JNI=ON \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE}" \ -B"${CMAKE_OUT}"/extension/android - cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}" --config Release + cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}" --config "${EXECUTORCH_CMAKE_BUILD_TYPE}" # Copy artifacts to ABI specific directory mkdir -p "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}"