[IOT-2334][IOT-2335] Fixed presence sample app crash issue
[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 # By default, src_dir is current dir, the build_dir is:
43 #     ./out/<target_os>/<target_arch>/<release or debug>/
44 #
45 # The build_dir is a variant directory of the source directory(You can
46 # consider build_dir as a soft link to src_dir, for detail please refer to:
47 #     http://www.scons.org/doc/production/HTML/scons-user.html#f-VariantDir
48 #
49 # Any way, to make the output is in build_dir, when load scripts, the path should
50 # be relevant to build_dir.
51 build_dir = env.get('BUILD_DIR')
52
53 # Build 'resource' sub-project
54 SConscript(build_dir + 'resource/SConscript')
55
56 if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows']:
57         SConscript(build_dir + 'examples/OICMiddle/SConscript')
58
59 java_build = None
60 if (env.get('BUILD_JAVA') == True  and env.get('JAVA_HOME') != None) or target_os == 'android':
61         java_build = SConscript(build_dir + 'java/SConscript')
62
63 # Build 'service' sub-project
64 service_build = SConscript(build_dir + 'service/SConscript')
65
66 if (env.get('BUILD_JAVA') == True and env.get('JAVA_HOME') != None) or target_os == 'android':
67         Depends(service_build, java_build)
68
69 # Build "cloud" sub-project
70 SConscript(build_dir + 'cloud/SConscript')
71
72 # Build "plugin interface" sub-project
73 SConscript(build_dir + 'plugins/SConscript')
74
75 # Build "bridging" sub-project
76 SConscript(build_dir + 'bridging/SConscript')
77
78 # Append targets information to the help information, to see help info, execute command line:
79 #     $ scon [options] -h
80 env.PrintTargets()
81
82 # Print bin upload command line (arduino only)
83 if target_os == 'arduino':
84         env.UploadHelp()
85
86 # to install the generated pc file into custom prefix location
87 env.UserInstallTargetPCFile('iotivity.pc', 'iotivity.pc')
88