1from building import * 2import rtconfig 3import os 4import shutil 5 6# get current dir path 7cwd = GetCurrentDir() 8 9src = [] 10inc = [] 11 12lvgl_cwd = cwd + '/../../' 13 14lvgl_src_cwd = lvgl_cwd + 'src/' 15inc = inc + [lvgl_src_cwd] 16for root, dirs, files in os.walk(lvgl_src_cwd): 17 for dir in dirs: 18 src = src + Glob(os.path.join(root,dir,'*.c')) 19 inc = inc + [os.path.join(root,dir)] 20 21if GetDepend('PKG_USING_LVGL_EXAMPLES'): 22 lvgl_src_cwd = lvgl_cwd + 'examples/' 23 inc = inc + [lvgl_src_cwd] 24 for root, dirs, files in os.walk(lvgl_src_cwd): 25 for dir in dirs: 26 src = src + Glob(os.path.join(root,dir,'*.c')) 27 inc = inc + [os.path.join(root,dir)] 28 29if GetDepend('PKG_USING_LVGL_DEMOS'): 30 lvgl_src_cwd = lvgl_cwd + 'demos/' 31 inc = inc + [lvgl_src_cwd] 32 for root, dirs, files in os.walk(lvgl_src_cwd): 33 for dir in dirs: 34 src = src + Glob(os.path.join(root,dir,'*.c')) 35 inc = inc + [os.path.join(root,dir)] 36 37LOCAL_CCFLAGS = '' 38if rtconfig.PLATFORM == 'gcc': # GCC 39 LOCAL_CCFLAGS += ' -std=c99' 40elif rtconfig.PLATFORM == 'armcc': # Keil AC5 41 LOCAL_CCFLAGS += ' --c99 --gnu -g -W' 42elif rtconfig.PLATFORM == 'armclang': # Keil AC6 43 LOCAL_CCFLAGS += ' -std=c99 -g -w' 44 45group = DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS) 46 47port_src = Glob('*.c') 48port_inc = [cwd] 49group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc) 50 51list = os.listdir(cwd) 52for d in list: 53 path = os.path.join(cwd, d) 54 if os.path.isfile(os.path.join(path, 'SConscript')): 55 group = group + SConscript(os.path.join(d, 'SConscript')) 56 57# 58# try: 59# shutil.rmtree(os.path.join(lvgl_cwd, '.github')) 60# shutil.rmtree(os.path.join(lvgl_cwd, 'docs')) 61# shutil.rmtree(os.path.join(lvgl_cwd, 'scripts')) 62# shutil.rmtree(os.path.join(lvgl_cwd, 'tests')) 63# shutil.rmtree(os.path.join(lvgl_cwd, 'zephyr')) 64# os.remove(os.path.join(lvgl_cwd, '.codecov.yml')) 65# os.remove(os.path.join(lvgl_cwd, '.editorconfig')) 66# os.remove(os.path.join(lvgl_cwd, '.gitignore')) 67# os.remove(os.path.join(lvgl_cwd, '.gitmodules')) 68# os.remove(os.path.join(lvgl_cwd, 'CMakeLists.txt')) 69# os.remove(os.path.join(lvgl_cwd, 'component.mk')) 70# os.remove(os.path.join(lvgl_cwd, 'idf_component.yml')) 71# os.remove(os.path.join(lvgl_cwd, 'Kconfig')) 72# os.remove(os.path.join(lvgl_cwd, 'library.json')) 73# os.remove(os.path.join(lvgl_cwd, 'library.properties')) 74# os.remove(os.path.join(lvgl_cwd, 'lv_conf_template.h')) 75# os.remove(os.path.join(lvgl_cwd, 'lvgl.mk')) 76# except: 77# pass 78# 79 80Return('group') 81