@@ -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 ):
@@ -870,6 +873,7 @@ def main():
870
873
args = parser .parse_args ()
871
874
872
875
kconfig_module_dirs = ""
876
+ kconfig_module_dirs_cmake = "set(kconfig_env_dirs)\n "
873
877
kconfig = ""
874
878
cmake = ""
875
879
sysbuild_kconfig = ""
@@ -882,7 +886,8 @@ def main():
882
886
args .modules , args .extra_modules )
883
887
884
888
for module in modules :
885
- kconfig_module_dirs += process_kconfig_module_dir (module .project , module .meta )
889
+ kconfig_module_dirs += process_kconfig_module_dir (module .project , module .meta , False )
890
+ kconfig_module_dirs_cmake += process_kconfig_module_dir (module .project , module .meta , True )
886
891
kconfig += process_kconfig (module .project , module .meta )
887
892
cmake += process_cmake (module .project , module .meta )
888
893
sysbuild_kconfig += process_sysbuildkconfig (
@@ -894,13 +899,20 @@ def main():
894
899
if args .kconfig_out or args .sysbuild_kconfig_out :
895
900
if args .kconfig_out :
896
901
kconfig_module_dirs_out = PurePath (args .kconfig_out ).parent / 'kconfig_module_dirs.env'
902
+ kconfig_module_dirs_cmake_out = PurePath (args .kconfig_out ).parent / \
903
+ 'kconfig_module_dirs.cmake'
897
904
elif args .sysbuild_kconfig_out :
898
905
kconfig_module_dirs_out = PurePath (args .sysbuild_kconfig_out ).parent / \
899
906
'kconfig_module_dirs.env'
907
+ kconfig_module_dirs_cmake_out = PurePath (args .sysbuild_kconfig_out ).parent / \
908
+ 'kconfig_module_dirs.cmake'
900
909
901
910
with open (kconfig_module_dirs_out , 'w' , encoding = "utf-8" ) as fp :
902
911
fp .write (kconfig_module_dirs )
903
912
913
+ with open (kconfig_module_dirs_cmake_out , 'w' , encoding = "utf-8" ) as fp :
914
+ fp .write (kconfig_module_dirs_cmake )
915
+
904
916
if args .kconfig_out :
905
917
with open (args .kconfig_out , 'w' , encoding = "utf-8" ) as fp :
906
918
fp .write (kconfig )
0 commit comments