1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # The main build script
27 # Load common build config
28 SConscript('build_common/SConscript')
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.
40 if os.environ.get('TERM') is not None:
41 env['ENV']['TERM'] = os.environ['TERM']
44 SConscript('extra_options.scons')
46 target_os = env.get('TARGET_OS')
47 if target_os == 'arduino':
48 SConscript('arduino.scons')
50 # By default, src_dir is the current dir, build_dir is:
51 # ./out/<target_os>/<target_arch>/<release or debug>/
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
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')
63 # Build 'resource' sub-project
64 SConscript(build_dir + 'resource/SConscript')
66 if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows']:
67 SConscript(build_dir + 'examples/OICMiddle/SConscript')
70 if (env.get('BUILD_JAVA') and env.get('JAVA_HOME')) or target_os == 'android':
71 java_build = SConscript(build_dir + 'java/SConscript')
73 # Build 'service' sub-project
74 service_build = SConscript(build_dir + 'service/SConscript')
77 Depends(service_build, java_build)
79 # Build other sub-projects
82 build_dir + 'plugins',
83 build_dir + 'bridging',
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
92 # This is not really needed unless requesting help, consider adding check:
93 #if env.GetOption('help'):
96 # Print bin upload command line (arduino only)
97 if target_os == 'arduino':
100 # to install the generated pc file into custom prefix location
101 env.UserInstallTargetPCFile('iotivity.pc', 'iotivity.pc')