acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

SConscript (2215B)

      1 from building import *
      2 import rtconfig
      3 import os
      4 
      5 src = []
      6 inc = []
      7 group = []
      8 
      9 cwd = GetCurrentDir() # get current dir path
     10 
     11 port_src = Glob('*.c')
     12 port_inc = [cwd]
     13 group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc)
     14 
     15 # check if .h or .hpp files exsit
     16 def check_h_hpp_exsit(path):
     17     file_dirs = os.listdir(path)
     18     for file_dir in file_dirs:
     19         if os.path.splitext(file_dir)[1] in ['.h', '.hpp']:
     20             return True
     21     return False
     22 
     23 lvgl_cwd = cwd + '/../../'
     24 
     25 lvgl_src_cwd = lvgl_cwd + 'src/'
     26 inc = inc + [lvgl_src_cwd]
     27 for root, dirs, files in os.walk(lvgl_src_cwd):
     28     for dir in dirs:
     29         current_path = os.path.join(root, dir)
     30         src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files
     31         if check_h_hpp_exsit(current_path): # add .h and .hpp path
     32             inc = inc + [current_path]
     33 
     34 
     35 if GetDepend('PKG_USING_LVGL_EXAMPLES'):
     36     lvgl_src_cwd = lvgl_cwd + 'examples/'
     37     inc = inc + [lvgl_src_cwd]
     38     for root, dirs, files in os.walk(lvgl_src_cwd):
     39         for dir in dirs:
     40             current_path = os.path.join(root, dir)
     41             src = src + Glob(os.path.join(current_path,'*.c'))
     42             if check_h_hpp_exsit(current_path):
     43                 inc = inc + [current_path]
     44 
     45 if GetDepend('PKG_USING_LVGL_DEMOS'):
     46     lvgl_src_cwd = lvgl_cwd + 'demos/'
     47     inc = inc + [lvgl_src_cwd]
     48     for root, dirs, files in os.walk(lvgl_src_cwd):
     49         for dir in dirs:
     50             current_path = os.path.join(root, dir)
     51             src = src + Glob(os.path.join(current_path,'*.c'))
     52             if check_h_hpp_exsit(current_path):
     53                 inc = inc + [current_path]
     54 
     55 LOCAL_CFLAGS = ''
     56 if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6
     57     LOCAL_CFLAGS += ' -std=c99'
     58 elif rtconfig.PLATFORM == 'armcc': # Keil AC5
     59     LOCAL_CFLAGS += ' --c99 --gnu'
     60 
     61 group = group + DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CFLAGS = LOCAL_CFLAGS)
     62 
     63 list = os.listdir(cwd)
     64 for d in list:
     65     path = os.path.join(cwd, d)
     66     if os.path.isfile(os.path.join(path, 'SConscript')):
     67         group = group + SConscript(os.path.join(d, 'SConscript'))
     68 
     69 Return('group')