Skip to content

Commit 36be75a

Browse files
committed
llext-edk: (refact) filter flags in post-processing step
This changes the LLEXT EDK flag filtering to be done after the main Zephyr build is completed. Instead of filtering the flags via genexes, the full set is passed to the script along with the set of filters to be applied, and the filter is applied later. No functional change is intended. Signed-off-by: Luca Burelli <[email protected]>
1 parent 2c23b6e commit 36be75a

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

CMakeLists.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,18 +2292,14 @@ if(CONFIG_LLEXT_EDK)
22922292
zephyr_get_compile_definitions_for_lang(C zephyr_defs)
22932293
zephyr_get_compile_options_for_lang(C zephyr_flags)
22942294

2295-
# Filter out non LLEXT and LLEXT_EDK flags - and add required ones
2296-
llext_filter_zephyr_flags(LLEXT_REMOVE_FLAGS ${zephyr_flags} llext_filt_flags)
2297-
llext_filter_zephyr_flags(LLEXT_EDK_REMOVE_FLAGS ${llext_filt_flags} llext_filt_flags)
2298-
2299-
set(llext_edk_cflags ${zephyr_defs} -DLL_EXTENSION_BUILD)
2300-
list(APPEND llext_edk_cflags ${llext_filt_flags})
2301-
list(APPEND llext_edk_cflags ${LLEXT_APPEND_FLAGS})
2302-
list(APPEND llext_edk_cflags ${LLEXT_EDK_APPEND_FLAGS})
2295+
set(llext_edk_cflags ${zephyr_defs} ${zephyr_flags})
23032296

2297+
# Export current settings for use in LLEXT EDK generation
23042298
build_info(llext-edk file PATH ${llext_edk_file})
23052299
build_info(llext-edk cflags VALUE ${llext_edk_cflags})
23062300
build_info(llext-edk include-dirs VALUE "$<TARGET_PROPERTY:zephyr_interface,INTERFACE_INCLUDE_DIRECTORIES>")
2301+
build_info(llext-edk remove-cflags VALUE ${LLEXT_REMOVE_FLAGS} ${LLEXT_EDK_REMOVE_FLAGS})
2302+
build_info(llext-edk append-cflags VALUE ${LLEXT_APPEND_FLAGS} ${LLEXT_EDK_APPEND_FLAGS} -DLL_EXTENSION_BUILD)
23072303

23082304
add_custom_command(
23092305
OUTPUT ${llext_edk_file}

cmake/llext-edk.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ set(build_info_file ${PROJECT_BINARY_DIR}/../build_info.yml)
156156
yaml_load(FILE ${build_info_file} NAME build_info)
157157

158158
yaml_get(llext_edk_cflags NAME build_info KEY cmake llext-edk cflags)
159+
yaml_get(llext_remove_cflags NAME build_info KEY cmake llext-edk remove-cflags)
160+
yaml_get(llext_append_cflags NAME build_info KEY cmake llext-edk append-cflags)
161+
foreach(item IN_LIST ${llext_remove_cflags})
162+
list(FILTER llext_edk_cflags EXCLUDE REGEX "^${item}$")
163+
endforeach()
164+
list(APPEND llext_edk_cflags ${llext_append_cflags})
165+
159166
yaml_get(llext_edk_file NAME build_info KEY cmake llext-edk file)
160167
yaml_get(INTERFACE_INCLUDE_DIRECTORIES NAME build_info KEY cmake llext-edk include-dirs)
161168
yaml_get(APPLICATION_SOURCE_DIR NAME build_info KEY cmake application source-dir)

scripts/schemas/build-schema.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ mapping:
9595
type: seq
9696
sequence:
9797
- type: str
98+
remove-cflags:
99+
type: seq
100+
sequence:
101+
- type: str
102+
append-cflags:
103+
type: seq
104+
sequence:
105+
- type: str
98106
sysbuild:
99107
type: bool
100108
toolchain:

0 commit comments

Comments
 (0)