17
17
cmake_minimum_required (VERSION 3.19 )
18
18
project (executorch )
19
19
20
+ if (ANDROID )
21
+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )
22
+ set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH )
23
+ endif ()
24
+
20
25
find_package (executorch CONFIG REQUIRED COMPONENTS vulkan_backend )
21
26
find_package (GTest CONFIG REQUIRED )
22
27
@@ -31,16 +36,14 @@ endif()
31
36
include (${EXECUTORCH_ROOT} /tools/cmake/Utils.cmake )
32
37
33
38
get_torch_base_path (TORCH_BASE_PATH )
34
- message (STATUS "torch base path: ${TORCH_BASE_PATH} " )
35
-
36
- # Only build tests if Vulkan was compiled
37
- find_library (LIB_VULKAN_BACKEND vulkan_backend )
38
- find_library (LIB_TORCH torch ${TORCH_BASE_PATH} /lib )
39
- find_library (LIB_TORCH_CPU torch_cpu ${TORCH_BASE_PATH} /lib )
40
- find_library (LIB_C10 c10 ${TORCH_BASE_PATH} /lib )
39
+ if (NOT TORCH_INSTALL_PREFIX )
40
+ set (TORCH_INSTALL_PREFIX ${TORCH_BASE_PATH} )
41
+ endif ()
41
42
42
- message (STATUS "Vulkan backend lib ${LIB_VULKAN_BACKEND} " )
43
- message (STATUS "Torch ${LIB_TORCH} " )
43
+ # libtorch is needed for Vulkan correctness tests
44
+ find_library (LIB_TORCH torch HINTS ${TORCH_INSTALL_PREFIX} /lib )
45
+ find_library (LIB_TORCH_CPU torch_cpu HINTS ${TORCH_INSTALL_PREFIX} /lib )
46
+ find_library (LIB_C10 c10 HINTS ${TORCH_INSTALL_PREFIX} /lib )
44
47
45
48
if (NOT PYTHON_EXECUTABLE )
46
49
set (PYTHON_EXECUTABLE python3 )
@@ -88,7 +91,7 @@ function(vulkan_op_test test_name test_src)
88
91
add_test (${test_name} ${test_name} )
89
92
endfunction ()
90
93
91
- if (LIB_VULKAN_BACKEND AND LIB_TORCH )
94
+ if (TARGET vulkan_backend AND LIB_TORCH )
92
95
find_library (
93
96
CUSTOM_OPS_LIB custom_ops_aot_lib
94
97
HINTS ${CMAKE_INSTALL_PREFIX} /executorch/extension/llm/custom_ops
0 commit comments