@@ -386,10 +386,13 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, taint_blobs=Fals
386
386
return '\n ' .join (snippet )
387
387
388
388
389
- def process_kconfig_module_dir (module , meta ):
389
+ def process_kconfig_module_dir (module , meta , cmake_output ):
390
390
module_path = PurePath (module )
391
391
name_sanitized = meta ['name-sanitized' ]
392
- return f'ZEPHYR_{ name_sanitized .upper ()} _MODULE_DIR={ module_path .as_posix ()} \n '
392
+
393
+ if cmake_output is False :
394
+ return f'ZEPHYR_{ name_sanitized .upper ()} _MODULE_DIR={ module_path .as_posix ()} \n '
395
+ return f'list(APPEND kconfig_env_dirs ZEPHYR_{ name_sanitized .upper ()} _MODULE_DIR={ module_path .as_posix ()} )\n '
393
396
394
397
395
398
def process_kconfig (module , meta ):
@@ -865,6 +868,7 @@ def main():
865
868
args = parser .parse_args ()
866
869
867
870
kconfig_module_dirs = ""
871
+ kconfig_module_dirs_cmake = "set(kconfig_env_dirs)\n "
868
872
kconfig = ""
869
873
cmake = ""
870
874
sysbuild_kconfig = ""
@@ -877,7 +881,8 @@ def main():
877
881
args .modules , args .extra_modules )
878
882
879
883
for module in modules :
880
- kconfig_module_dirs += process_kconfig_module_dir (module .project , module .meta )
884
+ kconfig_module_dirs += process_kconfig_module_dir (module .project , module .meta , False )
885
+ kconfig_module_dirs_cmake += process_kconfig_module_dir (module .project , module .meta , True )
881
886
kconfig += process_kconfig (module .project , module .meta )
882
887
cmake += process_cmake (module .project , module .meta )
883
888
sysbuild_kconfig += process_sysbuildkconfig (
@@ -889,13 +894,20 @@ def main():
889
894
if args .kconfig_out or args .sysbuild_kconfig_out :
890
895
if args .kconfig_out :
891
896
kconfig_module_dirs_out = PurePath (args .kconfig_out ).parent / 'kconfig_module_dirs.env'
897
+ kconfig_module_dirs_cmake_out = PurePath (args .kconfig_out ).parent / \
898
+ 'kconfig_module_dirs.cmake'
892
899
elif args .sysbuild_kconfig_out :
893
900
kconfig_module_dirs_out = PurePath (args .sysbuild_kconfig_out ).parent / \
894
901
'kconfig_module_dirs.env'
902
+ kconfig_module_dirs_cmake_out = PurePath (args .sysbuild_kconfig_out ).parent / \
903
+ 'kconfig_module_dirs.cmake'
895
904
896
905
with open (kconfig_module_dirs_out , 'w' , encoding = "utf-8" ) as fp :
897
906
fp .write (kconfig_module_dirs )
898
907
908
+ with open (kconfig_module_dirs_cmake_out , 'w' , encoding = "utf-8" ) as fp :
909
+ fp .write (kconfig_module_dirs_cmake )
910
+
899
911
if args .kconfig_out :
900
912
with open (args .kconfig_out , 'w' , encoding = "utf-8" ) as fp :
901
913
fp .write (kconfig )
0 commit comments