File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
1515fi
1616which " ${PYTHON_EXECUTABLE} "
1717CMAKE_PREFIX_PATH=" $( python3 -c ' import torch as _; print(_.__path__[0])' ) "
18- SITE_PACKAGES=" $( ${PYTHON_EXECUTABLE} -c ' from distutils.sysconfig import get_python_lib; print(get_python_lib())' ) "
1918
2019install_executorch_and_backend_lib () {
2120 echo " Installing executorch and xnnpack backend"
@@ -29,7 +28,6 @@ install_executorch_and_backend_lib() {
2928 -DANDROID_ABI=" ${ANDROID_ABI} " \
3029 -DCMAKE_INSTALL_PREFIX=cmake-android-out \
3130 -DCMAKE_BUILD_TYPE=Release \
32- -DCMAKE_FIND_ROOT_PATH=" ${SITE_PACKAGES} " \
3331 -DCMAKE_PREFIX_PATH=" ${CMAKE_PREFIX_PATH} " \
3432 -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
3533 -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
Original file line number Diff line number Diff line change @@ -40,10 +40,8 @@ build_android_native_library() {
4040 else
4141 EXECUTORCH_BUILD_NEURON=OFF
4242 fi
43- SITE_PACKAGES=" $( ${PYTHON_EXECUTABLE} -c ' from distutils.sysconfig import get_python_lib; print(get_python_lib())' ) "
4443
4544 cmake . -DCMAKE_INSTALL_PREFIX=" ${CMAKE_OUT} " \
46- -DCMAKE_FIND_ROOT_PATH=" ${SITE_PACKAGES} " \
4745 -DCMAKE_PREFIX_PATH=" ${CMAKE_PREFIX_PATH} " \
4846 -DCMAKE_TOOLCHAIN_FILE=" ${ANDROID_NDK} /build/cmake/android.toolchain.cmake" \
4947 -DANDROID_ABI=" ${ANDROID_ABI} " \
@@ -78,7 +76,6 @@ build_android_native_library() {
7876 -DANDROID_ABI=" ${ANDROID_ABI} " \
7977 -DANDROID_PLATFORM=android-26 \
8078 -DCMAKE_INSTALL_PREFIX=" ${CMAKE_OUT} " \
81- -DCMAKE_FIND_ROOT_PATH=" ${SITE_PACKAGES} " \
8279 -DCMAKE_PREFIX_PATH=" ${CMAKE_PREFIX_PATH} " \
8380 -DEXECUTORCH_ENABLE_LOGGING=ON \
8481 -DEXECUTORCH_LOG_LEVEL=Info \
Original file line number Diff line number Diff line change @@ -63,7 +63,14 @@ message("Generated files ${gen_command_sources}")
6363
6464list (TRANSFORM _optimized_kernels__srcs PREPEND "${EXECUTORCH_ROOT} /" )
6565add_library (optimized_kernels ${_optimized_kernels__srcs} )
66- find_package (Torch CONFIG REQUIRED)
66+ # We require Torch headers, which setup.py puts in CMAKE_PREFIX_PATH
67+ # for us. Toolchains that we might be using for cross-compiling could
68+ # set CMAKE_FIND_ROOT_PATH, which prevents find_package from finding
69+ # headers not rooted under CMAKE_FIND_ROOT_PATH. This is reasonable
70+ # for binary dependencies because they probably aren't built for the
71+ # target platform, but for our header-only use case, we should just
72+ # ignore CMAKE_FIND_ROOT_PATH.
73+ find_package (Torch CONFIG REQUIRED NO_CMAKE_FIND_ROOT_PATH )
6774target_include_directories (optimized_kernels PRIVATE ${TORCH_INCLUDE_DIRS} )
6875target_link_libraries (
6976 optimized_kernels PRIVATE executorch_core cpublas extension_threadpool
You can’t perform that action at this time.
0 commit comments