@@ -67,58 +67,6 @@ function(target_link_options_gc_sections target_name)
6767 endif ()
6868endfunction ()
6969
70- # Extract source files based on toml config. This is useful to keep buck2 and
71- # cmake aligned. Do not regenerate if file exists.
72- function (extract_sources sources_file)
73- if (EXISTS "${sources_file} " )
74- message (STATUS "executorch: Using source file list ${sources_file} " )
75- else ()
76- # A file wasn't generated. Run a script to extract the source lists from the
77- # buck2 build system and write them to a file we can include.
78- #
79- # NOTE: This will only happen once during cmake setup, so it will not re-run
80- # if the buck2 targets change.
81- message (STATUS "executorch: Generating source file list ${sources_file} " )
82- if (EXECUTORCH_ROOT)
83- set (executorch_root ${EXECUTORCH_ROOT} )
84- else ()
85- set (executorch_root ${CMAKE_CURRENT_SOURCE_DIR} )
86- endif ()
87-
88- if (ANDROID_ABI)
89- if ("${ANDROID_ABI} " STREQUAL "arm64-v8a" )
90- set (target_platforms_arg "--target-platforms=shim_et//:android-arm64" )
91- elseif ("${ANDROID_ABI} " STREQUAL "x86_64" )
92- set (target_platforms_arg "--target-platforms=shim_et//:android-x86_64" )
93- else ()
94- message (
95- FATAL_ERROR
96- "Unsupported ANDROID_ABI setting ${ANDROID_ABI} . Please add it here!"
97- )
98- endif ()
99- endif ()
100- execute_process (
101- COMMAND
102- ${PYTHON_EXECUTABLE} ${executorch_root} /tools/cmake/extract_sources.py
103- --config=${executorch_root} /tools/cmake/cmake_deps.toml
104- --out=${sources_file} --buck2=${BUCK2} ${target_platforms_arg}
105- OUTPUT_VARIABLE gen_srcs_output
106- ERROR_VARIABLE gen_srcs_error
107- RESULT_VARIABLE gen_srcs_exit_code
108- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
109- )
110-
111- if (NOT gen_srcs_exit_code EQUAL 0)
112- message ("Error while generating ${sources_file} . "
113- "Exit code: ${gen_srcs_exit_code} "
114- )
115- message ("Output:\n ${gen_srcs_output} " )
116- message ("Error:\n ${gen_srcs_error} " )
117- message (FATAL_ERROR "executorch: source list generation failed" )
118- endif ()
119- endif ()
120- endfunction ()
121-
12270# Sets the value of the PYTHON_EXECUTABLE variable to 'python' if in an active
12371# (non-base) conda environment, and 'python3' otherwise. This maintains
12472# backwards compatibility for non-conda users and avoids conda users needing to
0 commit comments