Просмотр исходного кода

update: 整理rtt的SConscript文件

Wendal Chen 5 лет назад
Родитель
Сommit
7c5cf59951

+ 12 - 29
luat/SConscript

@@ -2,37 +2,20 @@ Import('RTT_ROOT')
 Import('rtconfig')
 from building import *
 
+
 cwd = GetCurrentDir()
-src	= Glob('modules/*.c') + Glob('rtt/*.c') + Glob('packages/lfs/*.c')
+#print("cwd" + cwd)
+#src	= Glob('modules/*.c') + Glob('rtt/*.c') + Glob('packages/lfs/*.c')
 CPPPATH = [cwd + "/include"]
-LIB_PATH = []
-LIB = []
-
-# json
-src += Glob('packages/lua-cjson/*.c')
-CPPPATH += [cwd + "/packages/lua-cjson/"]
-
-#vsprint
-src += Glob('packages/vsprintf/*.c')
-CPPPATH += [cwd + "/packages/vsprintf/"]
-
-#u8g2
-#src += Glob('packages/u8g2/*.c')
-CPPPATH += [cwd + "/packages/u8g2/"]
-
-#nmea
-src += Glob('packages/minmea/*.c')
-CPPPATH += [cwd + "/packages/minmea/"]
-
-if GetDepend(['BSP_USING_WM_LIBRARIES']):
-    src += Glob('w60x/*.c')
-    src += Glob('packages/airkiss/*.c')
-    CPPPATH += [cwd + "/packages/lfs/"]
-    CPPPATH += [cwd + "/packages/airkiss/"]
 
-    LIB_PATH += [cwd + '/packages/airkiss/']
-    LIB += ['libairkiss']
+objs = []
+list = os.listdir(cwd)
 
-group = DefineGroup('luat', src, depend = [''], CPPPATH = CPPPATH, LIBS = LIB, LIBPATH = LIB_PATH)
+for d in list:
+    path = os.path.join(cwd, d)
+    if not os.path.isdir(path) :
+        continue
+    if os.path.isfile(os.path.join(path, 'SConscript')):
+        objs = objs +  SConscript(os.path.join(d, 'SConscript'))
 
-Return('group')
+Return('objs')

+ 22 - 2
luat/modules/SConscript

@@ -4,8 +4,28 @@ from building import *
 
 cwd = GetCurrentDir()
 src	= Glob('*.c')
-CPPPATH = [cwd]
+CPPPATH = [cwd,  cwd + "/../include", 
+                 cwd + "/../packages/vsprintf", 
+                 cwd + "/../packages/minmea", 
+                 cwd + "/../packages/lua-cjson",
+                 ]
 
-group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+# remove some packages
+'''
+if not GetDepend(['RT_USING_PWM']):
+    src.remove('luat_lib_pwm.c')
+if not GetDepend(['RT_USING_I2C']):
+    src.remove('luat_lib_i2c.c')
+if not GetDepend(['RT_USING_SPI']):
+    src.remove('luat_lib_spi.c')
+if not GetDepend(['PKG_USING_WEBCLIENT']):
+    src.remove('luat_lib_http.c')
+if not GetDepend(['SAL_USING_POSIX']):
+    src.remove('luat_lib_socket.c')
+if not GetDepend(['RT_USING_ADC']):
+    src.remove('luat_lib_adc.c')
+'''
+
+group = DefineGroup('modules', src, depend = [''], CPPPATH = CPPPATH)
 
 Return('group')

+ 5 - 3
luat/packages/SConscript

@@ -1,15 +1,17 @@
 # for module compiling
 import os
 Import('RTT_ROOT')
+from building import *
 
-cwd = str(Dir('#'))
+cwd = GetCurrentDir()
 objs = []
 list = os.listdir(cwd)
 
 for d in list:
     path = os.path.join(cwd, d)
-    print("path=" + path)
     if os.path.isfile(os.path.join(path, 'SConscript')):
-        objs = objs + SConscript(os.path.join(d, 'SConscript'))
+        tmp = SConscript(os.path.join(d, 'SConscript'))
+        if tmp :
+            objs = objs + tmp
 
 Return('objs')

+ 13 - 0
luat/packages/airkiss/SConscript

@@ -0,0 +1,13 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+LIB_PATH = [cwd]
+LIB = ['libairkiss']
+
+group = DefineGroup('airkiss', src, depend = ['RT_WLAN_MANAGE_ENABLE'], CPPPATH = CPPPATH, LIBS = LIB, LIBPATH = LIB_PATH)
+
+Return('group')

+ 10 - 0
luat/packages/fatfs/SConscript

@@ -0,0 +1,10 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+group = DefineGroup('fatfs', src, depend = ['USE_FATFS'], CPPPATH = CPPPATH)
+
+Return('group')

+ 1 - 1
luat/packages/lfs/SConscript

@@ -6,6 +6,6 @@ cwd = GetCurrentDir()
 src	= Glob('*.c')
 CPPPATH = [cwd]
 
-group = DefineGroup('lfs', src, depend = [''], CPPPATH = CPPPATH)
+group = DefineGroup('lfs', src, depend = [], CPPPATH = CPPPATH)
 
 Return('group')

+ 10 - 0
luat/packages/lua-cjson/SConscript

@@ -0,0 +1,10 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+group = DefineGroup('cjson', src, depend = [], CPPPATH = CPPPATH)
+
+Return('group')

+ 10 - 0
luat/packages/minmea/SConscript

@@ -0,0 +1,10 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+group = DefineGroup('minmea', src, depend = [], CPPPATH = CPPPATH)
+
+Return('group')

+ 10 - 0
luat/packages/vsprintf/SConscript

@@ -0,0 +1,10 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+group = DefineGroup('printf', src, depend = [], CPPPATH = CPPPATH)
+
+Return('group')

+ 17 - 0
luat/rtt/SConscript

@@ -0,0 +1,17 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = GetCurrentDir()
+src	= Glob('*.c')
+CPPPATH = [cwd,  cwd + "/../include", 
+                 cwd + "/../packages/vsprintf", 
+                 cwd + "/../packages/lfs",
+                 cwd + "/../packages/airkiss",
+                 cwd + "/../packages/fatfs",
+                 cwd + "/../packages/u8g2",
+                 ]
+
+group = DefineGroup('rtt', src, depend = [], CPPPATH = CPPPATH)
+
+Return('group')

+ 5 - 2
luat/w60x/SConscript

@@ -4,8 +4,11 @@ from building import *
 
 cwd = GetCurrentDir()
 src	= Glob('*.c')
-CPPPATH = [cwd]
+CPPPATH = [cwd,  cwd + "/../include", 
+                 cwd + "/../packages/vsprintf", 
+                 cwd + "/../packages/lfs",
+                 ]
 
-group = DefineGroup('w60x', src, depend = [''], CPPPATH = CPPPATH)
+group = DefineGroup('w60x', src, depend = ['BSP_USING_WM_LIBRARIES'], CPPPATH = CPPPATH)
 
 Return('group')