File tree Expand file tree Collapse file tree 9 files changed +22
-60
lines changed Expand file tree Collapse file tree 9 files changed +22
-60
lines changed Original file line number Diff line number Diff line change @@ -76,16 +76,10 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
7676 )
7777
7878 #
79- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
79+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
8080 #
81- set (EXECUTORCH_SRCS_FILE
82- "${CMAKE_CURRENT_BINARY_DIR} /../../../executorch_srcs.cmake"
83- )
84-
85- extract_sources(${EXECUTORCH_SRCS_FILE} )
86-
81+ executorch_load_build_variables()
8782 set (_mps_schema_headers ${CMAKE_BINARY_DIR} /../../../schema/include /)
88- include (${EXECUTORCH_SRCS_FILE} )
8983 target_include_directories (
9084 bundled_program
9185 INTERFACE ${CMAKE_CURRENT_BINARY_DIR} /../../../devtools/include
Original file line number Diff line number Diff line change @@ -36,13 +36,9 @@ set(_common_include_directories
3636)
3737
3838#
39- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
39+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
4040#
41- set (EXECUTORCH_SRCS_FILE
42- "${CMAKE_CURRENT_BINARY_DIR} /../../executorch_srcs.cmake"
43- )
44- extract_sources(${EXECUTORCH_SRCS_FILE} )
45- include (${EXECUTORCH_SRCS_FILE} )
41+ executorch_load_build_variables()
4642
4743# Find prebuilt libraries. executorch package should contain portable_ops_lib,
4844# etdump, bundled_program.
Original file line number Diff line number Diff line change @@ -59,15 +59,9 @@ option(
5959# ------------------------------- OPTIONS END --------------------------------
6060
6161#
62- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
62+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
6363#
64- set (EXECUTORCH_SRCS_FILE
65- "${CMAKE_CURRENT_BINARY_DIR} /../../../executorch_srcs.cmake"
66- )
67-
68- extract_sources(${EXECUTORCH_SRCS_FILE} )
69-
70- include (${EXECUTORCH_SRCS_FILE} )
64+ executorch_load_build_variables()
7165
7266# Generate C++ bindings to register kernels into both PyTorch (for AOT) and
7367# Executorch (for runtime).
Original file line number Diff line number Diff line change @@ -35,13 +35,9 @@ find_package(gflags REQUIRED)
3535set (_common_compile_options -Wno-deprecated-declarations -fPIC)
3636
3737#
38- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
38+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
3939#
40- set (EXECUTORCH_SRCS_FILE
41- "${CMAKE_CURRENT_BINARY_DIR} /../../executorch_srcs.cmake"
42- )
43- extract_sources(${EXECUTORCH_SRCS_FILE} )
44- include (${EXECUTORCH_SRCS_FILE} )
40+ executorch_load_build_variables()
4541
4642get_filename_component (
4743 EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR} /../.." ABSOLUTE
Original file line number Diff line number Diff line change @@ -77,15 +77,9 @@ option(EXECUTORCH_DTYPE_SELECTIVE_BUILD "Enable dtype selective build." OFF)
7777# ------------------------------- OPTIONS END --------------------------------
7878
7979#
80- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
80+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
8181#
82- set (EXECUTORCH_SRCS_FILE
83- "${CMAKE_CURRENT_BINARY_DIR} /../../executorch_srcs.cmake"
84- )
85-
86- extract_sources(${EXECUTORCH_SRCS_FILE} )
87-
88- include (${EXECUTORCH_SRCS_FILE} )
82+ executorch_load_build_variables()
8983
9084#
9185# select_build_lib: C++ library to register selected ops in custom kernel
Original file line number Diff line number Diff line change @@ -25,15 +25,9 @@ include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
2525include (${EXECUTORCH_ROOT} /tools/cmake/Codegen.cmake)
2626
2727#
28- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
28+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
2929#
30- set (EXECUTORCH_SRCS_FILE
31- "${CMAKE_CURRENT_BINARY_DIR} /../../../executorch_srcs.cmake"
32- )
33-
34- extract_sources(${EXECUTORCH_SRCS_FILE} )
35-
36- include (${EXECUTORCH_SRCS_FILE} )
30+ executorch_load_build_variables()
3731
3832set (_common_include_directories
3933 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /..,${CMAKE_CURRENT_SOURCE_DIR} /runtime/core/portable_type/c10>
Original file line number Diff line number Diff line change @@ -24,15 +24,9 @@ include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
2424include (${EXECUTORCH_ROOT} /tools/cmake/Codegen.cmake)
2525
2626#
27- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
27+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
2828#
29- set (EXECUTORCH_SRCS_FILE
30- "${CMAKE_CURRENT_BINARY_DIR} /../../../executorch_srcs.cmake"
31- )
32-
33- extract_sources(${EXECUTORCH_SRCS_FILE} )
34-
35- include (${EXECUTORCH_SRCS_FILE} )
29+ executorch_load_build_variables()
3630
3731# build llm runner library
3832list (TRANSFORM _extension_llm_runner__srcs PREPEND "${EXECUTORCH_ROOT} /" )
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ set(CMAKE_CXX_STANDARD 17)
2323
2424set (EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /..)
2525
26+ include (${EXECUTORCH_ROOT} /tools/cmake/Codegen.cmake)
2627include (${EXECUTORCH_ROOT} /tools/cmake/Utils.cmake)
2728
2829# Find prebuilt executorch library
@@ -34,13 +35,9 @@ find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
3435set (_common_include_directories ${EXECUTORCH_ROOT} /..)
3536
3637#
37- # The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE} .
38+ # The `_<target>_srcs` lists are defined by executorch_load_build_variables .
3839#
39- set (EXECUTORCH_SRCS_FILE "${CMAKE_CURRENT_BINARY_DIR} /../executorch_srcs.cmake" )
40-
41- extract_sources(${EXECUTORCH_SRCS_FILE} )
42-
43- include (${EXECUTORCH_SRCS_FILE} )
40+ executorch_load_build_variables()
4441
4542# Since extract_sources.py is not returning absolute values, we need to patch
4643# the source paths.
Original file line number Diff line number Diff line change @@ -349,13 +349,16 @@ endfunction()
349349function (executorch_append_filelist name outputvar)
350350 # configure_file adds its input to the list of CMAKE_RERUN dependencies
351351 configure_file (
352- ${PROJECT_SOURCE_DIR } /shim_et/xplat/executorch/build /build_variables.bzl
352+ ${EXECUTORCH_ROOT } /shim_et/xplat/executorch/build /build_variables.bzl
353353 ${PROJECT_BINARY_DIR} /build_variables.bzl COPYONLY
354354 )
355+ if (NOT PYTHON_EXECUTABLE)
356+ resolve_python_executable()
357+ endif ()
355358 execute_process (
356359 COMMAND
357360 "${PYTHON_EXECUTABLE} " -c
358- "exec(open('${PROJECT_SOURCE_DIR } /shim_et/xplat/executorch/build/build_variables.bzl').read());print(';'.join(${name} ))"
361+ "exec(open('${EXECUTORCH_ROOT } /shim_et/xplat/executorch/build/build_variables.bzl').read());print(';'.join(${name} ))"
359362 WORKING_DIRECTORY "${_rootdir} "
360363 RESULT_VARIABLE _retval
361364 OUTPUT_VARIABLE _tempvar
You can’t perform that action at this time.
0 commit comments