Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@
"hidden": true,
"binaryDir": "${sourceDir}/cmake-out"
},
{
"name": "android-arm64-v8a",
"displayName": "Build executorch core and JNI bindings on android arm64-v8a",
"inherits": ["common"],
"binaryDir": "${sourceDir}/cmake-out-android-arm64-v8a",
"cacheVariables": {
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/android.cmake",
"ANDROID_ABI": "arm64-v8a"
},
"condition": {
"type": "inList",
"string": "${hostSystemName}",
"list": ["Darwin", "Linux", "Windows"]
}
},
{
"name": "android-x86_64",
"displayName": "Build executorch core and JNI bindings on android x86_64",
"inherits": ["common"],
"binaryDir": "${sourceDir}/cmake-out-android-x86_64",
"cacheVariables": {
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/android.cmake",
"ANDROID_ABI": "x86_64"
},
"condition": {
"type": "inList",
"string": "${hostSystemName}",
"list": ["Darwin", "Linux", "Windows"]
}
},
{
"name": "macos",
"displayName": "Build ExecuTorch for macOS",
Expand Down
18 changes: 1 addition & 17 deletions scripts/build_android_library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,12 @@ build_android_native_library() {

cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI="${ANDROID_ABI}" \
--preset "android-${ANDROID_ABI}" \
-DANDROID_PLATFORM=android-26 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to preset as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to build twice, one for x86_64, one for arm64-v8a.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can set one as default and override another one

-DBUILD_TESTING=OFF \
-DEXECUTORCH_PAL_DEFAULT=android \
-DEXECUTORCH_ENABLE_LOGGING=ON \
-DEXECUTORCH_BUILD_ANDROID_JNI=ON \
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
-DEXECUTORCH_ENABLE_EVENT_TRACER="${EXECUTORCH_ANDROID_PROFILING:-OFF}" \
-DEXECUTORCH_LOG_LEVEL=Info \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
-DEXECUTORCH_BUILD_EXTENSION_LLM="${EXECUTORCH_BUILD_EXTENSION_LLM:-ON}" \
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER="${EXECUTORCH_BUILD_EXTENSION_LLM:-ON}" \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-DEXECUTORCH_BUILD_EXTENSION_TRAINING=ON \
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
-DEXECUTORCH_BUILD_KERNELS_LLM="${EXECUTORCH_BUILD_EXTENSION_LLM:-ON}" \
-DEXECUTORCH_BUILD_LLAMA_JNI="${EXECUTORCH_BUILD_EXTENSION_LLM:-ON}" \
-DEXECUTORCH_BUILD_NEURON="${EXECUTORCH_BUILD_NEURON}" \
-DNEURON_BUFFER_ALLOCATOR_LIB="${NEURON_BUFFER_ALLOCATOR_LIB}" \
Expand Down
31 changes: 31 additions & 0 deletions tools/cmake/preset/android.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set_overridable_option(BUILD_TESTING OFF)

set_overridable_option(EXECUTORCH_BUILD_ANDROID_JNI ON)
set_overridable_option(EXECUTORCH_PAL_DEFAULT android)
set_overridable_option(EXECUTORCH_ENABLE_EVENT_TRACER OFF)
set_overridable_option(EXECUTORCH_ENABLE_LOGGING ON)
set_overridable_option(EXECUTORCH_LOG_LEVEL Info)

set_overridable_option(EXECUTORCH_BUILD_DEVTOOLS ON)

set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)
set_overridable_option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE ON)

set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_LLM ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TRAINING ON)

set_overridable_option(EXECUTORCH_BUILD_KERNELS_LLM ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
Loading