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')
32 if os.environ.get('TERM') != None:
33 env['ENV']['TERM'] = os.environ['TERM']
36 SConscript('extra_options.scons')
38 target_os = env.get('TARGET_OS')
39 if target_os == 'arduino':
40 SConscript('arduino.scons')
42 # By default, src_dir is current dir, the build_dir is:
43 # ./out/<target_os>/<target_arch>/<release or debug>/
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
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')
53 # Build 'resource' sub-project
54 SConscript(build_dir + 'resource/SConscript')
56 if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows']:
57 SConscript(build_dir + 'examples/OICMiddle/SConscript')
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')
63 # Build 'service' sub-project
64 service_build = SConscript(build_dir + 'service/SConscript')
66 if (env.get('BUILD_JAVA') == True and env.get('JAVA_HOME') != None) or target_os == 'android':
67 Depends(service_build, java_build)
69 # Build "cloud" sub-project
70 SConscript(build_dir + 'cloud/SConscript')
72 # Build "plugin interface" sub-project
73 SConscript(build_dir + 'plugins/SConscript')
75 # Append targets information to the help information, to see help info, execute command line:
79 # Print bin upload command line (arduino only)
80 if target_os == 'arduino':
83 # to install the generated pc file into custom prefix location
84 env.UserInstallTargetPCFile('iotivity.pc', 'iotivity.pc')