2021-10-12 10:35:37 -05:00
|
|
|
from building import *
|
2021-10-18 07:55:20 -05:00
|
|
|
import rtconfig
|
|
|
|
import os
|
2021-10-12 10:35:37 -05:00
|
|
|
|
2021-10-18 07:55:20 -05:00
|
|
|
src = []
|
|
|
|
inc = []
|
2022-03-18 09:09:01 -04:00
|
|
|
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
|
2021-10-18 07:55:20 -05:00
|
|
|
|
2022-01-19 16:10:54 -05:00
|
|
|
lvgl_cwd = cwd + '/../../'
|
2021-10-18 07:55:20 -05:00
|
|
|
|
2021-12-20 03:52:07 -05:00
|
|
|
lvgl_src_cwd = lvgl_cwd + 'src/'
|
2021-10-18 07:55:20 -05:00
|
|
|
inc = inc + [lvgl_src_cwd]
|
|
|
|
for root, dirs, files in os.walk(lvgl_src_cwd):
|
|
|
|
for dir in dirs:
|
2022-03-18 09:09:01 -04:00
|
|
|
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]
|
|
|
|
|
2021-10-18 07:55:20 -05:00
|
|
|
|
2022-05-12 03:35:28 -04:00
|
|
|
if GetDepend('PKG_LVGL_USING_EXAMPLES'):
|
2021-12-20 03:52:07 -05:00
|
|
|
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:
|
2022-03-18 09:09:01 -04:00
|
|
|
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]
|
2021-12-20 03:52:07 -05:00
|
|
|
|
2022-05-12 03:35:28 -04:00
|
|
|
if GetDepend('PKG_LVGL_USING_DEMOS'):
|
2022-01-19 16:10:54 -05:00
|
|
|
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:
|
2022-03-18 09:09:01 -04:00
|
|
|
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]
|
2022-01-19 16:10:54 -05:00
|
|
|
|
2022-03-23 08:13:59 -04:00
|
|
|
LOCAL_CFLAGS = ''
|
2022-03-30 07:12:39 -04:00
|
|
|
if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6
|
2022-03-23 08:13:59 -04:00
|
|
|
LOCAL_CFLAGS += ' -std=c99'
|
2021-10-26 10:38:50 -04:00
|
|
|
elif rtconfig.PLATFORM == 'armcc': # Keil AC5
|
2022-03-30 07:12:39 -04:00
|
|
|
LOCAL_CFLAGS += ' --c99 --gnu'
|
2021-10-18 07:55:20 -05:00
|
|
|
|
2022-03-23 08:13:59 -04:00
|
|
|
group = group + DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CFLAGS = LOCAL_CFLAGS)
|
2021-10-22 05:13:39 -04:00
|
|
|
|
2021-10-18 07:55:20 -05:00
|
|
|
list = os.listdir(cwd)
|
2021-10-12 10:35:37 -05:00
|
|
|
for d in list:
|
|
|
|
path = os.path.join(cwd, d)
|
|
|
|
if os.path.isfile(os.path.join(path, 'SConscript')):
|
2021-10-18 07:55:20 -05:00
|
|
|
group = group + SConscript(os.path.join(d, 'SConscript'))
|
|
|
|
|
|
|
|
Return('group')
|