From 65f031c2bd33bc4b5c135c1c41213ee25c644000 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Jun 2023 07:53:34 +0200 Subject: [PATCH] feat(rt-thread): make the rt-thread env recursively glob the UI files --- env_support/rt-thread/squareline/SConscript | 27 ++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/env_support/rt-thread/squareline/SConscript b/env_support/rt-thread/squareline/SConscript index 51edf228e..2818830b5 100644 --- a/env_support/rt-thread/squareline/SConscript +++ b/env_support/rt-thread/squareline/SConscript @@ -1,10 +1,25 @@ from building import * cwd = GetCurrentDir() -src = ['lv_ui_entry.c'] - -src += Glob(cwd + '/ui/*.c') - -group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE']) - +src = Glob('*.c') +inc = [cwd] + +# check if .h or .hpp files exsit +def check_h_hpp_exsit(path): + file_dirs = os.listdir(path) + for file_dir in file_dirs: + if os.path.splitext(file_dir)[1] in ['.h', '.hpp']: + return True + return False + +sls_src_cwd = cwd +for root, dirs, files in os.walk(sls_src_cwd): + for dir in dirs: + current_path = os.path.join(root, dir) + src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files + if check_h_hpp_exsit(current_path): # add .h and .hpp path + inc = inc + [current_path] + +group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'], CPPPATH = inc) + Return('group')