@@ -100,8 +100,8 @@ function(extract_sources sources_file)
100
100
execute_process (
101
101
COMMAND
102
102
${PYTHON_EXECUTABLE} ${executorch_root} /tools/cmake/extract_sources.py
103
- --config=${executorch_root}/tools/cmake/cmake_deps.toml --out=${sources_file}
104
- --buck2=${BUCK2} ${target_platforms_arg}
103
+ --config=${executorch_root}/tools/cmake/cmake_deps.toml
104
+ --out=${sources_file} -- buck2=${BUCK2} ${target_platforms_arg}
105
105
OUTPUT_VARIABLE gen_srcs_output
106
106
ERROR_VARIABLE gen_srcs_error
107
107
RESULT_VARIABLE gen_srcs_exit_code
@@ -203,8 +203,8 @@ function(resolve_python_executable)
203
203
)
204
204
elseif (DEFINED ENV{VIRTUAL_ENV} )
205
205
set (PYTHON_EXECUTABLE
206
- $ENV{VIRTUAL_ENV} /bin/python3
207
- PARENT_SCOPE
206
+ $ENV{VIRTUAL_ENV} /bin/python3
207
+ PARENT_SCOPE
208
208
)
209
209
else ()
210
210
set (PYTHON_EXECUTABLE
@@ -217,29 +217,29 @@ endfunction()
217
217
# find_package(Torch CONFIG REQUIRED) replacement for targets that have a
218
218
# header-only Torch dependency.
219
219
#
220
- # Unlike find_package(Torch ...), this will only set
221
- # TORCH_INCLUDE_DIRS in the parent scope. In particular, it will NOT
222
- # set any of the following:
223
- # - TORCH_FOUND
224
- # - TORCH_LIBRARY
225
- # - TORCH_CXX_FLAGS
220
+ # Unlike find_package(Torch ...), this will only set TORCH_INCLUDE_DIRS in the
221
+ # parent scope. In particular, it will NOT set any of the following: -
222
+ # TORCH_FOUND - TORCH_LIBRARY - TORCH_CXX_FLAGS
226
223
function (find_package_torch_headers )
227
224
# We implement this way rather than using find_package so that
228
- # cross-compilation can still use the host's installed copy of
229
- # torch, since the headers should be fine.
225
+ # cross-compilation can still use the host's installed copy of torch, since
226
+ # the headers should be fine.
230
227
get_torch_base_path (TORCH_BASE_PATH )
231
- set (TORCH_INCLUDE_DIRS "${TORCH_BASE_PATH} /include;${TORCH_BASE_PATH} /include/torch/csrc/api/include" PARENT_SCOPE )
228
+ set (TORCH_INCLUDE_DIRS
229
+ "${TORCH_BASE_PATH} /include;${TORCH_BASE_PATH} /include/torch/csrc/api/include"
230
+ PARENT_SCOPE
231
+ )
232
232
endfunction ()
233
233
234
- # Return the base path to the installed Torch Python library in
235
- # outVar.
234
+ # Return the base path to the installed Torch Python library in outVar.
236
235
function (get_torch_base_path outVar )
237
236
if (NOT PYTHON_EXECUTABLE )
238
237
resolve_python_executable ()
239
238
endif ()
240
239
execute_process (
241
- COMMAND "${PYTHON_EXECUTABLE} " -c
242
- "import importlib.util; print(importlib.util.find_spec('torch').submodule_search_locations[0])"
240
+ COMMAND
241
+ "${PYTHON_EXECUTABLE} " -c
242
+ "import importlib.util; print(importlib.util.find_spec('torch').submodule_search_locations[0])"
243
243
OUTPUT_VARIABLE _tmp_torch_path
244
244
ERROR_VARIABLE _tmp_torch_path_error
245
245
RESULT_VARIABLE _tmp_torch_path_result COMMAND_ECHO STDERR
@@ -252,7 +252,10 @@ function(get_torch_base_path outVar)
252
252
message ("Output:\n ${_tmp_torch_path} " )
253
253
message (FATAL_ERROR "Error:\n ${_tmp_torch_path_error} " )
254
254
endif ()
255
- set (${outVar} ${_tmp_torch_path} PARENT_SCOPE )
255
+ set (${outVar}
256
+ ${_tmp_torch_path}
257
+ PARENT_SCOPE
258
+ )
256
259
endfunction ()
257
260
258
261
# Add the Torch CMake configuration to CMAKE_PREFIX_PATH so that find_package
0 commit comments