File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ install_executorch_and_backend_lib() {
22
22
-DANDROID_ABI=" ${ANDROID_ABI} " \
23
23
-DANDROID_PLATFORM=android-23 \
24
24
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
25
- -DCMAKE_PREFIX_PATH=$( $PYTHON_EXECUTABLE -c " from distutils.sysconfig import get_python_lib; print(get_python_lib())" ) \
26
25
-DCMAKE_BUILD_TYPE=Release \
27
26
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
28
27
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
@@ -42,7 +41,6 @@ build_llama_runner() {
42
41
-DANDROID_ABI=" ${ANDROID_ABI} " \
43
42
-DANDROID_PLATFORM=android-23 \
44
43
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
45
- -DCMAKE_PREFIX_PATH=$( $PYTHON_EXECUTABLE -c " from distutils.sysconfig import get_python_lib; print(get_python_lib())" ) \
46
44
-DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=python \
47
45
-DEXECUTORCH_BUILD_OPTIMIZED=ON \
48
46
-Bcmake-android-out/examples/models/llama2 examples/models/llama2
Original file line number Diff line number Diff line change @@ -116,6 +116,12 @@ else
116
116
exit 1
117
117
fi
118
118
119
+ # For cmake install custom ops before running
120
+ if [[ " ${BUILD_TOOL} " == " cmake" ]]; then
121
+ echo " Installing executorch libraries"
122
+ cmake_install_executorch_libraries
123
+ fi
124
+
119
125
# Export model.
120
126
EXPORTED_MODEL_NAME=" ${EXPORTED_MODEL_NAME} .pte"
121
127
echo " Exporting ${EXPORTED_MODEL_NAME} "
@@ -142,7 +148,6 @@ if [[ "${BUILD_TOOL}" == "buck2" ]]; then
142
148
# shellcheck source=/dev/null
143
149
$BUCK run examples/models/llama2:main -- ${RUNTIME_ARGS} > result.txt
144
150
elif [[ " ${BUILD_TOOL} " == " cmake" ]]; then
145
- cmake_install_executorch_libraries
146
151
cmake_build_llama_runner
147
152
# Run llama runner
148
153
NOW=$( date +" %H:%M:%S" )
Original file line number Diff line number Diff line change @@ -74,7 +74,9 @@ if(CMAKE_TOOLCHAIN_IOS OR ANDROID)
74
74
endif ()
75
75
76
76
# custom ops library
77
- add_subdirectory (custom_ops )
77
+ if (EXECUTORCH_BUILD_CUSTOM )
78
+ add_subdirectory (custom_ops )
79
+ endif ()
78
80
79
81
# llama_runner library
80
82
add_subdirectory (runner )
@@ -107,7 +109,11 @@ else()
107
109
target_link_options_shared_lib (portable_ops_lib )
108
110
endif ()
109
111
110
- target_link_libraries (llama_main PUBLIC gflags llama_runner custom_ops )
112
+ if (EXECUTORCH_BUILD_CUSTOM )
113
+ list (APPEND link_libraries custom_ops )
114
+ endif ()
115
+
116
+ target_link_libraries (llama_main PUBLIC gflags llama_runner )
111
117
112
118
# XNNPACK pthreadpool cpuinfo
113
119
if (TARGET xnnpack_backend )
You can’t perform that action at this time.
0 commit comments