File tree Expand file tree Collapse file tree 5 files changed +10
-2
lines changed
examples/models/llama2/custom_ops Expand file tree Collapse file tree 5 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,13 @@ install_executorch_and_backend_lib() {
16
16
ANDROID_NDK=/opt/ndk
17
17
BUCK2=buck2
18
18
ANDROID_ABI=arm64-v8a
19
+ PYTHON_EXECUTABLE=python3
19
20
cmake -DBUCK2=" ${BUCK2} " \
20
21
-DCMAKE_TOOLCHAIN_FILE=" ${ANDROID_NDK} /build/cmake/android.toolchain.cmake" \
21
22
-DANDROID_ABI=" ${ANDROID_ABI} " \
22
23
-DANDROID_PLATFORM=android-23 \
23
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())" ) \
24
26
-DCMAKE_BUILD_TYPE=Release \
25
27
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
26
28
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ cmake_build_llama_runner() {
75
75
dir=" examples/models/llama2"
76
76
retry cmake -DBUCK2=" $BUCK " \
77
77
-DCMAKE_INSTALL_PREFIX=cmake-out \
78
+ -DCMAKE_PREFIX_PATH=$( $PYTHON_EXECUTABLE -c " from distutils.sysconfig import get_python_lib; print(get_python_lib())" ) \
78
79
-DCMAKE_BUILD_TYPE=Release \
79
80
-DEXECUTORCH_BUILD_OPTIMIZED=ON \
80
81
-DPYTHON_EXECUTABLE=" $PYTHON_EXECUTABLE " \
Original file line number Diff line number Diff line change @@ -187,6 +187,8 @@ cmake_dependent_option(EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON
187
187
188
188
if (EXECUTORCH_BUILD_CPUINFO )
189
189
# --- cpuinfo
190
+ set (ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG ${CMAKE_POSITION_INDEPENDENT_CODE} )
191
+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
190
192
set (CPUINFO_SOURCE_DIR "backends/xnnpack/third-party/cpuinfo" )
191
193
set (CPUINFO_BUILD_TOOLS
192
194
OFF
@@ -208,10 +210,13 @@ if(EXECUTORCH_BUILD_CPUINFO)
208
210
CACHE STRING "" )
209
211
set (CLOG_SOURCE_DIR "${CPUINFO_SOURCE_DIR} /deps/clog" )
210
212
add_subdirectory ("${CPUINFO_SOURCE_DIR} " )
213
+ set (CMAKE_POSITION_INDEPENDENT_CODE ${ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG} )
211
214
endif ()
212
215
213
216
if (EXECUTORCH_BUILD_PTHREADPOOL )
214
217
# --- pthreadpool
218
+ set (ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG ${CMAKE_POSITION_INDEPENDENT_CODE} )
219
+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
215
220
set (PTHREADPOOL_SOURCE_DIR "backends/xnnpack/third-party/pthreadpool" )
216
221
set (PTHREADPOOL_BUILD_TESTS
217
222
OFF
@@ -226,6 +231,7 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
226
231
ON
227
232
CACHE BOOL "" )
228
233
add_subdirectory ("${PTHREADPOOL_SOURCE_DIR} " )
234
+ set (CMAKE_POSITION_INDEPENDENT_CODE ${ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG} )
229
235
endif ()
230
236
231
237
if (NOT PYTHON_EXECUTABLE )
Original file line number Diff line number Diff line change @@ -72,7 +72,6 @@ target_include_directories(
72
72
xnnpack_schema INTERFACE ${_xnnpack_schema__include_dir}
73
73
${EXECUTORCH_ROOT} /third-party/flatbuffers/include )
74
74
75
- target_compile_options (pthreadpool PUBLIC ${_common_compile_options} )
76
75
set (xnnpack_third_party pthreadpool cpuinfo )
77
76
78
77
include (cmake/Dependencies.cmake )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ if(NOT TORCH_ROOT)
25
25
set (TORCH_ROOT ${EXECUTORCH_ROOT} /third-party/pytorch )
26
26
endif ()
27
27
28
- set (_common_compile_options -Wno-deprecated-declarations )
28
+ set (_common_compile_options -Wno-deprecated-declarations -fPIC )
29
29
30
30
include (${EXECUTORCH_ROOT} /build/Utils.cmake )
31
31
include (${EXECUTORCH_ROOT} /build/Codegen.cmake )
You can’t perform that action at this time.
0 commit comments