File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -846,6 +846,18 @@ if(EXECUTORCH_BUILD_KERNELS_TORCHAO)
846846 set (TORCHAO_ENABLE_ARM_NEON_DOT ON )
847847 set (TORCHAO_BUILD_KLEIDIAI ON )
848848
849+ # TorchAO requires find_package(Torch) for include dirs; add its cmake path.
850+ execute_process (
851+ COMMAND ${PYTHON_EXECUTABLE} -c
852+ "import torch; print(torch.utils.cmake_prefix_path)"
853+ OUTPUT_VARIABLE _torch_cmake_prefix
854+ OUTPUT_STRIP_TRAILING_WHITESPACE
855+ RESULT_VARIABLE _torch_cmake_prefix_result
856+ )
857+ if (_torch_cmake_prefix_result EQUAL 0 AND _torch_cmake_prefix)
858+ list (APPEND CMAKE_PREFIX_PATH "${_torch_cmake_prefix} " )
859+ endif ()
860+
849861 # TorchAO kernels look for EXECUTORCH_INCLUDE_DIRS
850862 if (DEFINED EXECUTORCH_INCLUDE_DIRS)
851863 message (FATAL_ERROR "EXECUTORCH_INCLUDE_DIRS is already defined" )
You can’t perform that action at this time.
0 commit comments