Skip to content

Commit 63e4a27

Browse files
committed
Update
[ghstack-poisoned]
2 parents f5bcdcc + 2e21d9a commit 63e4a27

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install_executorch_and_backend_lib() {
1919
echo "Installing executorch and xnnpack backend"
2020
clean_executorch_install_folders
2121
mkdir cmake-android-out
22-
ANDROID_NDK=/opt/ndk
22+
ANDROID_NDK=${ANDROID_NDK:-/opt/ndk}
2323
BUCK2=buck2
2424
ANDROID_ABI=arm64-v8a
2525
cmake --preset llm \

examples/models/llama/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ find_package(gflags REQUIRED)
7777
# llama_main: test binary to run llama, with tokenizer and sampler integrated
7878
#
7979

80-
# find `executorch` libraries Same as for gflags
81-
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
82-
find_package(executorch CONFIG REQUIRED)
80+
# find `executorch` libraries. CMAKE_PREFIX_PATH would work for host
81+
# compilation, but CMAKE_FIND_ROOT_PATH appears to be necessary for
82+
# cross-compiling (e.g., to Android) to work as well.
83+
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
84+
find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
8385
target_link_options_shared_lib(executorch)
8486

8587
# llama_runner library

examples/models/llava/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ find_package(gflags REQUIRED)
7676
#
7777

7878
# find `executorch` libraries Same as for gflags
79-
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
80-
find_package(executorch CONFIG REQUIRED)
79+
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
80+
find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
8181
target_link_options_shared_lib(executorch)
8282

8383
# llava_runner library

examples/models/phi-3-mini/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ set(EXECUTORCH_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
2424
set(_common_include_directories
2525
${EXECUTORCH_ROOT}/.. ${EXECUTORCH_ROOT}/runtime/core/portable_type/c10
2626
)
27-
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
28-
find_package(executorch CONFIG REQUIRED)
27+
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
28+
find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
2929

3030
target_link_options_shared_lib(executorch)
3131

extension/android/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ set_target_properties(fbjni PROPERTIES
6060
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/third-party/fbjni/prefab/modules/fbjni/libs/android.${ANDROID_ABI}/libfbjni.so"
6161
)
6262

63-
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/../..)
6463
target_link_options_shared_lib(executorch)
6564

6665
add_library(executorch_jni SHARED jni/jni_layer.cpp jni/log.cpp jni/jni_layer_runtime.cpp)

0 commit comments

Comments
 (0)