Update Snapshot(2018-12-12)
[platform/upstream/iotivity.git] / SConstruct
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ##
22 # The main build script
23 #
24 ##
25 import os
26
27 # Load common build config
28 SConscript('build_common/SConscript')
29
30 Import('env')
31
32 if os.environ.get('TERM') != None:
33         env['ENV']['TERM'] = os.environ['TERM']
34
35 # Load extra options
36 SConscript('extra_options.scons')
37
38 target_os = env.get('TARGET_OS')
39 if target_os == 'arduino':
40         SConscript('arduino.scons')
41
42 if target_os == 'android':
43         SConscript('android/android_api/SConscript')
44
45 # By default, src_dir is current dir, the build_dir is:
46 #     ./out/<target_os>/<target_arch>/<release or debug>/
47 #
48 # The build_dir is a variant directory of the source directory(You can
49 # consider build_dir as a soft link to src_dir, for detail please refer to:
50 #     http://www.scons.org/doc/production/HTML/scons-user.html#f-VariantDir
51 #
52 # Any way, to make the output is in build_dir, when load scripts, the path should
53 # be relevant to build_dir.
54 build_dir = env.get('BUILD_DIR')
55
56 # Build 'resource' sub-project
57 SConscript(build_dir + 'resource/SConscript')
58
59 if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows', 'tizenrt']:
60         SConscript(build_dir + 'examples/OICMiddle/SConscript')
61
62 # Build 'service' sub-project
63 if target_os not in ['tizenrt']:
64         SConscript(build_dir + 'service/SConscript')
65
66 # Build "cloud" sub-project
67 SConscript(build_dir + 'cloud/SConscript')
68
69 # Build "plugin interface" sub-project
70 if target_os not in ['tizenrt']:
71         SConscript(build_dir + 'plugins/SConscript')
72
73 if target_os == 'tizenrt':
74         SConscript('../apps' + '/SConscript')
75
76 # Append targets information to the help information, to see help info, execute command line:
77 #     $ scon [options] -h
78 env.PrintTargets()
79
80 # Print bin upload command line (arduino only)
81 if target_os == 'arduino':
82         env.UploadHelp()
83
84 # to install the generated pc file into custom prefix location
85 env.UserInstallTargetPCFile('iotivity.pc', 'iotivity.pc')
86