summaryrefslogtreecommitdiff
path: root/components/vbus/SConscript
blob: e9097d19ffd422df89b68323576328c3a69b737c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# RT-Thread building script for component

import SCons, os
from building import *

group = []
if not GetDepend(['RT_USING_VBUS']):
    Return('group')

cwd = GetCurrentDir()
src = Glob('*.c')

for c, f in [['RT_USING_VBUS_RFS', 'utilities/rfs.c'],
             ['RT_USING_VBUS_RSHELL', 'utilities/rshell.c'],
             ]:
    if GetDepend(c):
        src += Glob(f)

with open(os.path.join(Dir('#').get_abspath(), 'vbus_local_conf.h'), 'r') as f:
    cpp = SCons.cpp.PreProcessor()
    cpp.process_contents(f.read())
    if 'RT_VBUS_USING_TESTS' in cpp.cpp_namespace:
        src += Glob('tests/*.c')

CPPPATH = [cwd, os.path.join(cwd, 'share_hdr')]

group = DefineGroup('VBus', src, depend = ['RT_USING_VBUS'], CPPPATH = CPPPATH)

Return('group')