doc(rt-thread): add more BSP supports (#3178)

* doc(rt-thread): add more BSP supports

* improve sconscript
This commit is contained in:
Man, Jianting (Meco)
2022-03-18 09:09:01 -04:00
committed by GitHub
parent c76a3d206e
commit ca17c204d0
2 changed files with 40 additions and 43 deletions

View File

@@ -1,13 +1,24 @@
from building import *
import rtconfig
import os
import shutil
# get current dir path
cwd = GetCurrentDir()
src = []
inc = []
group = []
cwd = GetCurrentDir() # get current dir path
port_src = Glob('*.c')
port_inc = [cwd]
group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc)
# 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
lvgl_cwd = cwd + '/../../'
@@ -15,24 +26,31 @@ 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:
src = src + Glob(os.path.join(root,dir,'*.c'))
inc = inc + [os.path.join(root,dir)]
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]
if GetDepend('PKG_USING_LVGL_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:
src = src + Glob(os.path.join(root,dir,'*.c'))
inc = inc + [os.path.join(root,dir)]
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c'))
if check_h_hpp_exsit(current_path):
inc = inc + [current_path]
if GetDepend('PKG_USING_LVGL_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:
src = src + Glob(os.path.join(root,dir,'*.c'))
inc = inc + [os.path.join(root,dir)]
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c'))
if check_h_hpp_exsit(current_path):
inc = inc + [current_path]
LOCAL_CCFLAGS = ''
if rtconfig.PLATFORM == 'gcc': # GCC
@@ -42,11 +60,7 @@ elif rtconfig.PLATFORM == 'armcc': # Keil AC5
elif rtconfig.PLATFORM == 'armclang': # Keil AC6
LOCAL_CCFLAGS += ' -std=c99 -g -w'
group = DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
port_src = Glob('*.c')
port_inc = [cwd]
group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc)
group = group + DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
list = os.listdir(cwd)
for d in list:
@@ -54,27 +68,4 @@ for d in list:
if os.path.isfile(os.path.join(path, 'SConscript')):
group = group + SConscript(os.path.join(d, 'SConscript'))
#
# try:
# shutil.rmtree(os.path.join(lvgl_cwd, '.github'))
# shutil.rmtree(os.path.join(lvgl_cwd, 'docs'))
# shutil.rmtree(os.path.join(lvgl_cwd, 'scripts'))
# shutil.rmtree(os.path.join(lvgl_cwd, 'tests'))
# shutil.rmtree(os.path.join(lvgl_cwd, 'zephyr'))
# os.remove(os.path.join(lvgl_cwd, '.codecov.yml'))
# os.remove(os.path.join(lvgl_cwd, '.editorconfig'))
# os.remove(os.path.join(lvgl_cwd, '.gitignore'))
# os.remove(os.path.join(lvgl_cwd, '.gitmodules'))
# os.remove(os.path.join(lvgl_cwd, 'CMakeLists.txt'))
# os.remove(os.path.join(lvgl_cwd, 'component.mk'))
# os.remove(os.path.join(lvgl_cwd, 'idf_component.yml'))
# os.remove(os.path.join(lvgl_cwd, 'Kconfig'))
# os.remove(os.path.join(lvgl_cwd, 'library.json'))
# os.remove(os.path.join(lvgl_cwd, 'library.properties'))
# os.remove(os.path.join(lvgl_cwd, 'lv_conf_template.h'))
# os.remove(os.path.join(lvgl_cwd, 'lvgl.mk'))
# except:
# pass
#
Return('group')