Files
luban-lite-t3e-pro/packages/artinchip/lvgl-ui/aic_demo/SConscript
2024-11-26 13:23:39 +08:00

41 lines
1.2 KiB
Python

from building import *
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()
if GetDepend(['AIC_LVGL_UI_BUILDER']):
ui_path = 'ui_builder/'
src = Glob(ui_path + '*.c')
lvgl_cwd = cwd + '/'
lvgl_src_cwd = lvgl_cwd + ui_path
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]
else:
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
group = group + SConscript(os.path.join(d, 'SConscript'))
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = inc)
Return('group')