Merge "Updated example program."
[platform/upstream/iotivity.git] / SConstruct
1 ##
2 # The main build script
3 #
4 ##
5 import os
6
7 SRC_TOP_DIR = os.path.abspath('.') + '/' #oic-resource project top directory
8
9 # Common build options
10 SConscript('build_common/SConscript')
11 Import('RELEASE_BUILD', 'BUILD_TARGET', 'TARGET_CPU_ARCH')
12
13 # Set build directory
14 if RELEASE_BUILD:
15         BUILD_DIR = SRC_TOP_DIR + '/out/' + BUILD_TARGET + '/' + TARGET_CPU_ARCH + '/release/'
16 else:
17         BUILD_DIR = SRC_TOP_DIR + '/out/' + BUILD_TARGET + '/' + TARGET_CPU_ARCH + '/debug/'
18 VariantDir(BUILD_DIR, SRC_TOP_DIR, duplicate=0)
19 Export('SRC_TOP_DIR', 'BUILD_DIR')
20
21 if BUILD_TARGET == 'arduino':
22         SConscript('arduino.scons')
23
24 # Build libcoap
25 SConscript(BUILD_DIR + 'csdk/libcoap/SConscript')
26
27 # Build liboctbstack
28 SConscript(BUILD_DIR + 'csdk/SConscript')
29
30 if BUILD_TARGET != 'arduino':
31         # Build liboc_logger
32         SConscript(BUILD_DIR + 'oc_logger/SConscript')
33
34         # Build liboc
35         SConscript(BUILD_DIR + 'src/SConscript')
36
37         # Build examples
38         SConscript(BUILD_DIR + 'examples/SConscript')
39
40 # Print targets
41 Import('env')
42
43 Help('''
44 ===============================================================================
45 Targets:\n    ''')
46 for t in env.get('TS'):
47         Help(t + ' ')
48 Help('''
49 \nDefault all targets will be built. You can specify the target to build:
50
51     #scons [options] [target]
52 ===============================================================================
53 ''')