Skip to content

Commit 1c67de8

Browse files
committed
WIP: create build_variables.bzl
First step of #8268. ghstack-source-id: b29aa49 ghstack-comment-id: 2644414497 Pull Request resolved: #8326
1 parent 513e92d commit 1c67de8

File tree

2 files changed

+516
-0
lines changed

2 files changed

+516
-0
lines changed

build/Codegen.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,24 @@ function(merge_yaml)
213213
WORKING_DIRECTORY ${EXECUTORCH_ROOT}
214214
)
215215
endfunction()
216+
217+
function(append_filelist name outputvar)
218+
set(_rootdir "${EXECUTORCH_ROOT}/")
219+
# configure_file adds its input to the list of CMAKE_RERUN dependencies
220+
configure_file(
221+
${PROJECT_SOURCE_DIR}/build/build_variables.bzl
222+
${PROJECT_BINARY_DIR}/build_variables.bzl
223+
COPYONLY)
224+
execute_process(
225+
COMMAND "${Python_EXECUTABLE}" -c
226+
"exec(open('${PROJECT_SOURCE_DIR}/build/build_variables.bzl').read());print(';'.join(['${_rootdir}' + x for x in ${name}]))"
227+
WORKING_DIRECTORY "${_rootdir}"
228+
RESULT_VARIABLE _retval
229+
OUTPUT_VARIABLE _tempvar)
230+
if(NOT _retval EQUAL 0)
231+
message(FATAL_ERROR "Failed to fetch filelist ${name} from build_variables.bzl")
232+
endif()
233+
string(REPLACE "\n" "" _tempvar "${_tempvar}")
234+
list(APPEND ${outputvar} ${_tempvar})
235+
set(${outputvar} "${${outputvar}}" PARENT_SCOPE)
236+
endfunction()

0 commit comments

Comments
 (0)