1import sys
2import os
3from building import *
4Import('rtconfig')
5
6cwd = GetCurrentDir()
7src = ['board.c', 'uart_console.c']
8LIBS = []
9LIBPATH = []
10CPPPATH = [cwd]
11CPPDEFINES = ['RT_USING_LIBC']
12
13if rtconfig.CROSS_TOOL == 'msvc':
14    CPPDEFINES += \
15    [
16        # avoid to conflict with the inherent STDC in VS
17        '_CRT_DECLARE_NONSTDC_NAMES=0',
18        # errno macro redefinition
19        '_CRT_ERRNO_DEFINED',
20        # avoid time.h conflicts, such as struct timespec, ctime, difftime...
21        '_CRT_NO_TIME_T',
22        # disable deprecation of unsafe functions, such as strncpy
23        '_CRT_SECURE_NO_WARNINGS',
24        # lean and mean for Windows.h, exclude winsock.h when include Windows.h
25        # avoid conlicts between sys/select.h, time.h, and winsock.h
26        # such as fd_set related, struct timeval...
27        'WIN32_LEAN_AND_MEAN'
28    ]
29
30# remove no need file.
31if GetDepend('PKG_USING_GUIENGINE') == True:
32    src += ['sdl_fb.c']
33else:
34    LIBS.append('SDL2')
35
36if GetDepend('RT_USING_DFS') == True:
37    if GetDepend('RT_USING_DFS_ELMFAT') == True:
38        src += ['sd_sim.c']
39
40    if GetDepend('RT_USING_MTD_NAND') == True:
41        src += ['nanddrv_file.c']
42
43    if GetDepend('RT_USING_MTD_NOR') == True:
44        src += ['sst25vfxx_mtd_sim.c']
45
46    if sys.platform == "win32":
47        if  GetDepend('RT_USING_DFS_WINSHAREDIR') == True:
48            src += ['dfs_win32.c']
49        if  GetDepend('RT_USING_MODULE') == True:
50            src += ['module_win32.c']
51
52if GetDepend('BSP_USING_RTC') == True:
53    src += ['drv_rtc.c']
54
55if GetDepend('BSP_USING_SOCKET') == True:
56    src += [cwd + '/winsock/drv_win_eth.c']
57    src += [cwd + '/winsock/sal_winsock.c']
58
59group = DefineGroup('Drivers', src, depend = [''],
60            CPPPATH = CPPPATH, LIBS=LIBS, LIBPATH=LIBPATH, CPPDEFINES=CPPDEFINES)
61
62list = os.listdir(cwd)
63for item in list:
64    if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
65        group = group + SConscript(os.path.join(item, 'SConscript'))
66
67Return('group')
68