changes to build csdk for os x(darwin)
[platform/upstream/iotivity.git] / SConstruct
1 ##
2 # The main build script
3 #
4 ##
5
6 import os
7
8 # List of targets that only support the IoTivity C SDK.
9 targets_csdk_only = ['arduino','darwin']
10
11 # Load common build config
12 SConscript('build_common/SConscript', exports = 'targets_csdk_only')
13
14 Import('env')
15
16 target_os = env.get('TARGET_OS')
17
18 if target_os not in targets_csdk_only:
19         # Prepare libraries
20         env.PrepareLib('cereal')
21         env.PrepareLib('expat')
22         env.PrepareLib('boost', 'boost_thread', os.path.join(env.get('SRC_DIR'), 'extlibs', 'boost'))
23         env.PrepareLib('boost', 'boost_system', os.path.join(env.get('SRC_DIR'), 'extlibs', 'boost'))
24 else:
25         if target_os == 'arduino':
26                 SConscript('arduino.scons')
27
28 # By default, src_dir is current dir, the build_dir is:
29 #     ./out/<target_os>/<target_arch>/<release or debug>/
30 #
31 # The build_dir is a variant directory of the source directory(You can
32 # consider build_dir as a soft link to src_dir, for detail please refer to:
33 #     http://www.scons.org/doc/production/HTML/scons-user.html#f-VariantDir
34 #
35 # Any way, to make the output is in build_dir, when load scripts, the path should
36 # be relevant to build_dir.
37 build_dir = env.get('BUILD_DIR')
38
39 # Build 'resource' sub-project
40 SConscript(os.path.join(build_dir, 'resource', 'SConscript'),
41            exports = 'targets_csdk_only')
42
43 # Build 'service' sub-project
44 SConscript(os.path.join(build_dir, 'service', 'SConscript'),
45            exports = 'targets_csdk_only')
46
47 # Append targets information to the help information, to see help info, execute command line:
48 #     $ scon [options] -h
49 env.PrintTargets()
50
51 # Print bin upload command line (arduino only)
52 if target_os == 'arduino':
53         env.UploadHelp()