Import('AIC_ROOT') Import('PRJ_OUT_DIR') from building import * import rtconfig import os # check if .h or .hpp files exist def check_h_hpp_exist(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 src = [] inc = [] group = [] cwd = GetCurrentDir() # get current dir path src = Glob('env_support/rt-thread/*.c') inc = [cwd + '/env_support/rt-thread/'] lvgl_cwd = cwd + '/' lvgl_src_cwd = lvgl_cwd + 'src/' inc = inc + [lvgl_src_cwd] for root, dirs, files in os.walk(lvgl_src_cwd): for dir in dirs: current_path = os.path.join(root, dir) rela_path = current_path.replace(lvgl_cwd, '') src = src + Glob(rela_path + '/*.c') # add all .c files if check_h_hpp_exist(current_path): # add .h and .hpp path inc = inc + [current_path] if GetDepend('LPKG_LVGL_USING_EXAMPLES'): lvgl_src_cwd = lvgl_cwd + 'examples/' inc = inc + [lvgl_src_cwd] for root, dirs, files in os.walk(lvgl_src_cwd): for dir in dirs: current_path = os.path.join(root, dir) rela_path = current_path.replace(lvgl_cwd, '') src = src + Glob(rela_path + '/*.c') if check_h_hpp_exist(current_path): inc = inc + [current_path] if GetDepend('LPKG_LVGL_USING_DEMOS'): lvgl_src_cwd = lvgl_cwd + 'demos/' inc = inc + [lvgl_src_cwd] for root, dirs, files in os.walk(lvgl_src_cwd): for dir in dirs: current_path = os.path.join(root, dir) rela_path = current_path.replace(lvgl_cwd, '') src = src + Glob(rela_path + '/*.c') if check_h_hpp_exist(current_path): inc = inc + [current_path] LOCAL_CFLAGS = '' if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6 LOCAL_CFLAGS += ' -std=c99' elif rtconfig.PLATFORM == 'armcc': # Keil AC5 LOCAL_CFLAGS += ' --c99 --gnu' group = DefineGroup('LVGL', src, depend = ['LPKG_USING_LVGL'], CPPPATH = inc, LOCAL_CFLAGS = LOCAL_CFLAGS) Return('group')