Skip to content

Commit d192b1f

Browse files
[Android] Introduce build types and set default to Release (#6442)
ghstack-source-id: cc77b01 Pull Request resolved: #6440 Co-authored-by: Hansong Zhang <[email protected]>
1 parent fe20be9 commit d192b1f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

build/build_android_llm_demo.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ build_android_native_library() {
1919
ANDROID_ABI="$1"
2020
ANDROID_NDK="${ANDROID_NDK:-/opt/ndk}"
2121
CMAKE_OUT="cmake-out-android-${ANDROID_ABI}"
22+
EXECUTORCH_CMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE:-Release}"
2223
QNN_SDK_ROOT="${QNN_SDK_ROOT:-}"
2324
if [ -n "$QNN_SDK_ROOT" ]; then
2425
EXECUTORCH_BUILD_QNN=ON
@@ -52,15 +53,15 @@ build_android_native_library() {
5253
-DNEURON_BUFFER_ALLOCATOR_LIB="${NEURON_BUFFER_ALLOCATOR_LIB}" \
5354
-DEXECUTORCH_BUILD_QNN="${EXECUTORCH_BUILD_QNN}" \
5455
-DQNN_SDK_ROOT="${QNN_SDK_ROOT}" \
55-
-DCMAKE_BUILD_TYPE=Release \
56+
-DCMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE}" \
5657
-B"${CMAKE_OUT}"
5758

5859
if [ "$(uname)" == "Darwin" ]; then
5960
CMAKE_JOBS=$(( $(sysctl -n hw.ncpu) - 1 ))
6061
else
6162
CMAKE_JOBS=$(( $(nproc) - 1 ))
6263
fi
63-
cmake --build "${CMAKE_OUT}" -j "${CMAKE_JOBS}" --target install --config Release
64+
cmake --build "${CMAKE_OUT}" -j "${CMAKE_JOBS}" --target install --config "${EXECUTORCH_CMAKE_BUILD_TYPE}"
6465

6566
cmake extension/android \
6667
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
@@ -72,10 +73,10 @@ build_android_native_library() {
7273
-DNEURON_BUFFER_ALLOCATOR_LIB="$NEURON_BUFFER_ALLOCATOR_LIB" \
7374
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
7475
-DEXECUTORCH_BUILD_LLAMA_JNI=ON \
75-
-DCMAKE_BUILD_TYPE=Release \
76+
-DCMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE}" \
7677
-B"${CMAKE_OUT}"/extension/android
7778

78-
cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}" --config Release
79+
cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}" --config "${EXECUTORCH_CMAKE_BUILD_TYPE}"
7980

8081
# Copy artifacts to ABI specific directory
8182
mkdir -p "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}"

0 commit comments

Comments
 (0)