List child resource eps instead of parent.
[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 # The construction environment named 'env' is set up in build_common
31 # and should be imported by all other scripts which need access to it.
32 # Scripts which do not need to modify the global construction environment
33 # should Clone() this environment and modify the clone.
34 # Scripts which need to modify the global environment should not
35 # work on a clone, since those changes will not propagate.
36 # Normally global changes should be limited to build_common and
37 # the extlibs scripts.
38 Import('env')
39
40 if os.environ.get('TERM') is not None:
41     env['ENV']['TERM'] = os.environ['TERM']
42
43 # Load extra options
44 SConscript('extra_options.scons')
45
46 target_os = env.get('TARGET_OS')
47 if target_os == 'arduino':
48     SConscript('arduino.scons')
49
50 # By default, src_dir is the current dir, build_dir is:
51 #     ./out/<target_os>/<target_arch>/<release or debug>/
52 #
53 # The build_dir is a Variant directory of the source directory.
54 # iotivity variant directories are set up with argument "duplicate=0",
55 # which means build_dir files will behave like soft links to src_dir files.
56 # For more reading on this:
57 #     http://www.scons.org/doc/production/HTML/scons-user.html#f-VariantDir
58 #
59 # Any way, to make the output is in build_dir, when load scripts, the path should
60 # be relevant to build_dir.
61 build_dir = env.get('BUILD_DIR')
62
63 # Build 'resource' sub-project
64 SConscript(build_dir + 'resource/SConscript')
65
66 if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows']:
67     SConscript(build_dir + 'examples/OICMiddle/SConscript')
68
69 java_build = None
70 if (env.get('BUILD_JAVA') and env.get('JAVA_HOME')) or target_os == 'android':
71     java_build = SConscript(build_dir + 'java/SConscript')
72
73 # Build 'service' sub-project
74 service_build = SConscript(build_dir + 'service/SConscript')
75
76 if java_build:
77     Depends(service_build, java_build)
78
79 # Build other sub-projects
80 SConscript(dirs=[
81     build_dir + 'cloud',
82     build_dir + 'plugins',
83     build_dir + 'bridging',
84 ])
85
86 # Append target information to the help information (if needed)
87 # To see help info, execute:
88 #     $ scons [options] -h
89 # Note some help is option-dependent, e.g. java-related options are
90 # not added to the help unless BUILD_JAVA is seen
91 #
92 # This is not really needed unless requesting help, consider adding check:
93 #if env.GetOption('help'):
94 env.PrintTargets()
95
96 # Print bin upload command line (arduino only)
97 if target_os == 'arduino':
98     env.UploadHelp()
99
100 # to install the generated pc file into custom prefix location
101 env.UserInstallTargetPCFile('iotivity.pc', 'iotivity.pc')