1 # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
3 # This script includes generic build options:
4 # release/debug, target os, target arch, cross toolchain, build environment etc
9 project_version = '1.3.0'
11 # Map of host os and allowed target os (host: allowed target os)
13 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
14 'windows': ['windows', 'android', 'arduino'],
15 'darwin': ['darwin', 'ios', 'android', 'arduino'],
16 'msys_nt' :['msys_nt'],
19 # Map of os and allowed archs (os: allowed archs)
21 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
22 'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'],
23 'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
24 'windows': ['x86', 'amd64', 'arm'],
25 'msys_nt':['x86', 'x86_64'],
26 'darwin': ['i386', 'x86_64'],
27 'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
28 'arduino': ['avr', 'arm'],
29 'yocto': ['i586', 'i686', 'x86_64', 'arm', 'aarch64', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
32 host = platform.system().lower()
34 # the host string contains version of windows. 6.3, 6.4, 10.0 which is 8.0, 8.1, and 10 respectively.
35 # Let's canonicalize the msys_nt-XX.X system name by stripping version off.
39 if not host_target_map.has_key(host):
40 print "\nError: Current system (%s) isn't supported\n" % host
43 ######################################################################
44 # Get build options (the optins from command line)
45 ######################################################################
46 target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os
48 if target_os not in host_target_map[host]:
49 print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])
52 if target_os == 'android':
55 default_arch = platform.machine()
56 if target_os == 'windows':
57 default_arch = default_arch.lower()
59 target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
61 # True if binary needs to be installed on board. (Might need root permissions)
62 # set to 'no', 'false' or 0 for only compilation
63 require_upload = ARGUMENTS.get('UPLOAD', False)
65 # Get the device name. This name can be used as network display name wherever possible
66 device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE")
68 default_with_upstream_libcoap = 0
70 if ARGUMENTS.get('TEST'):
71 logging_default = False
74 if ARGUMENTS.get('RELEASE', True) in ['y', 'yes', 'true', 't', '1', 'on', 'all', True]:
76 logging_default = (release_mode == False)
78 # targets that do not support the DTLS build (SECURED=1 build option)
79 targets_without_dtls_support = ['arduino'];
80 if ARGUMENTS.get('SECURED') == '1' and target_os in targets_without_dtls_support:
81 print "\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os)
84 ######################################################################
85 # Common build options (release, target os, target arch)
86 ######################################################################
87 targets_disallow_multitransport = ['arduino']
89 help_vars = Variables()
91 help_vars.Add('PROJECT_VERSION', 'The version of IoTivity', project_version)
93 help_vars.Add(BoolVariable('VERBOSE', 'Show compilation', False))
94 help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
95 help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
98 help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False))
99 help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
100 help_vars.Add(BoolVariable('WITH_PROXY', 'Build with CoAP-HTTP Proxy', False))
101 help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
102 help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
103 help_vars.Add(ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT', ['CLIENT', 'SERVER']))
105 help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False))
107 help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)', False))
110 if target_os in targets_disallow_multitransport:
111 help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP', 'NFC']))
113 help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'NFC']))
115 help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
116 if target_os in targets_without_dtls_support:
117 help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
119 help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '1', allowed_values=('0', '1')))
120 help_vars.Add(EnumVariable('MULTIPLE_OWNER', 'Enable multiple owner', '0', allowed_values=('0', '1')))
121 help_vars.Add(EnumVariable('EXC_PROV_SUPPORT', 'Except OCPMAPI library(libocpmapi.so)', '0', allowed_values=('0', '1')))
122 help_vars.Add(EnumVariable('TEST', 'Run unit tests', '0', allowed_values=('0', '1')))
123 help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', logging_default))
124 help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
125 help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
126 help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
127 help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device (For Arduino)', device_name, None, None),)
128 help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable.PathAccept))
129 help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
130 help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
131 help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1')))
133 if target_os == 'windows':
134 # For VS2013, MSVC_VERSION is '12.0'. For VS2015, MSVC_VERSION is '14.0'.
135 # Default value is None, meaning that SCons has to choose automatically a VS version.
136 help_vars.Add(EnumVariable('MSVC_VERSION', 'MSVC compiler version - Windows', None, allowed_values=('12.0', '14.0')))
138 help_vars.Add(BoolVariable('BUILD_JAVA', 'Build Java bindings', False))
139 help_vars.Add(PathVariable('JAVA_HOME', 'JDK directory', os.environ.get('JAVA_HOME'), PathVariable.PathAccept))
141 AddOption('--prefix',
147 help='installation prefix')
149 ######################################################################
150 # Platform(build target) specific options: SDK/NDK & toolchain
151 ######################################################################
152 targets_support_cc = ['linux', 'arduino', 'tizen']
154 if target_os in targets_support_cc:
155 # Set cross compile toolchain
156 help_vars.Add('TC_PREFIX', "Toolchain prefix (Generally only be required for cross-compiling)", os.environ.get('TC_PREFIX'))
157 help_vars.Add(PathVariable('TC_PATH',
158 'Toolchain path (Generally only be required for cross-compiling)',
159 os.environ.get('TC_PATH')))
161 if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host
162 env = Environment(variables = help_vars,
163 tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'textfile']
166 env = Environment(variables = help_vars, tools = ['default', 'textfile'],
167 TARGET_ARCH = target_arch, TARGET_OS = target_os,
168 PREFIX = GetOption('prefix'),
169 LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR') #for 64bit build
171 Help(help_vars.GenerateHelpText(env))
174 ************************************ Warning **********************************
175 * Environment variable TC_PREFIX/TC_PATH is set. It will change the default *
176 * toolchain, if it isn't what you expect you should unset it, otherwise it may*
177 * cause inexplicable errors. *
178 *******************************************************************************
180 if env.get('VERBOSE') == False:
181 env['CCCOMSTR'] = "Compiling $TARGET"
182 env['SHCCCOMSTR'] = "Compiling $TARGET"
183 env['CXXCOMSTR'] = "Compiling $TARGET"
184 env['SHCXXCOMSTR'] = "Compiling $TARGET"
185 env['LINKCOMSTR'] = "Linking $TARGET"
186 env['SHLINKCOMSTR'] = "Linking $TARGET"
187 env['ARCOMSTR'] = "Archiving $TARGET"
188 env['RANLIBCOMSTR'] = "Indexing Archive $TARGET"
190 if target_os in targets_support_cc:
191 prefix = env.get('TC_PREFIX')
192 tc_path = env.get('TC_PATH')
194 env.Replace(CC = prefix + env.get('CC', 'gcc'))
195 env.Replace(CXX = prefix + env.get('CXX', 'g++'))
196 env.Replace(AR = prefix + env.get('AR', 'ar'))
197 env.Replace(AS = prefix + env.get('AS', 'as'))
198 env.Replace(RANLIB = prefix + env.get('RANLIB', 'ranlib'))
201 env.PrependENVPath('PATH', tc_path)
202 sys_root = os.path.abspath(tc_path + '/../')
203 env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root])
204 env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root])
206 if prefix or tc_path:
209 # Import env variables only if reproductibility is ensured
210 if target_os in ['yocto']:
211 env['CONFIG_ENVIRONMENT_IMPORT'] = True
213 env['CONFIG_ENVIRONMENT_IMPORT'] = False
215 if env['CONFIG_ENVIRONMENT_IMPORT'] == True:
216 print "warning: importing some environment variables for OS: %s" % target_os
217 for ev in ['PATH', 'PKG_CONFIG', 'PKG_CONFIG_PATH', 'PKG_CONFIG_SYSROOT_DIR']:
218 if os.environ.get(ev) != None:
219 env['ENV'][ev] = os.environ.get(ev)
220 if os.environ['LDFLAGS'] != None:
221 env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS']))
223 # Ensure scons be able to change its working directory
224 env.SConscriptChdir(1)
226 # Set the source directory and build directory
227 # Source directory: 'dir'
228 # Build directory: 'dir'/out/<target_os>/<target_arch>/<release or debug>/
230 # You can get the directory as following:
232 # env.get('BUILD_DIR')
234 def __set_dir(env, dir):
235 if not os.path.exists(dir + '/SConstruct'):
237 *************************************** Error *********************************
238 * The directory(%s) seems isn't a source code directory, no SConstruct file is
240 *******************************************************************************
244 if env.get('RELEASE'):
245 build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
247 build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
248 env.VariantDir(build_dir, dir, duplicate=0)
250 env.Replace(BUILD_DIR = build_dir)
251 env.Replace(SRC_DIR = dir)
253 def __src_to_obj(env, src, home = ''):
254 obj = env.get('BUILD_DIR') + src.replace(home, '')
255 if env.get('OBJSUFFIX'):
256 obj += env.get('OBJSUFFIX')
257 return env.Object(obj, src)
259 def __install(ienv, targets, name):
260 i_n = ienv.Install(env.get('BUILD_DIR'), targets)
262 env.AppendUnique(TS = [name])
264 def __installlib(ienv, targets, name):
265 user_prefix = env.get('PREFIX')
267 user_lib = env.get('LIB_INSTALL_DIR')
269 i_n = ienv.Install(user_lib, targets)
271 i_n = ienv.Install(user_prefix + '/lib', targets)
272 ienv.Alias("install", i_n)
274 i_n = ienv.Install(env.get('BUILD_DIR'), targets)
275 ienv.Alias("install", i_n)
277 def __installbin(ienv, targets, name):
278 user_prefix = env.get('PREFIX')
280 i_n = ienv.Install(user_prefix + '/bin', targets)
281 ienv.Alias("install", i_n)
283 def __installheader(ienv, targets, dir, name):
284 user_prefix = env.get('PREFIX')
286 i_n = ienv.Install(user_prefix + '/include/' + dir ,targets)
288 i_n = ienv.Install(os.path.join(env.get('BUILD_DIR'), 'include', dir), targets)
289 ienv.Alias("install", i_n)
291 def __installpcfile(ienv, targets, name):
292 user_prefix = env.get('PREFIX')
294 user_lib = env.get('LIB_INSTALL_DIR')
296 i_n = ienv.Install(user_lib + '/pkgconfig', targets)
298 i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets)
300 i_n = ienv.Install(env.get('BUILD_DIR') + 'lib/pkgconfig', targets)
301 ienv.Alias("install", i_n)
303 def __append_target(ienv, name, targets = None):
305 env.Alias(name, targets)
306 env.AppendUnique(TS = [name])
308 def __print_targets(env):
310 ===============================================================================
312 for t in env.get('TS'):
315 \nDefault all targets will be built. You can specify the target to build:
317 $ scons [options] [target]
318 ===============================================================================
321 env.AddMethod(__set_dir, 'SetDir')
322 env.AddMethod(__print_targets, 'PrintTargets')
323 env.AddMethod(__src_to_obj, 'SrcToObj')
324 env.AddMethod(__append_target, 'AppendTarget')
325 env.AddMethod(__install, 'InstallTarget')
326 env.AddMethod(__installlib, 'UserInstallTargetLib')
327 env.AddMethod(__installbin, 'UserInstallTargetBin')
328 env.AddMethod(__installheader, 'UserInstallTargetHeader')
329 env.AddMethod(__installpcfile, 'UserInstallTargetPCFile')
330 env.SetDir(env.GetLaunchDir())
331 env['ROOT_DIR']=env.GetLaunchDir()+'/..'
335 ######################################################################
336 # Scons to generate the iotivity.pc file from iotivity.pc.in file
337 ######################################################################
338 pc_file = env.get('SRC_DIR') + '/iotivity.pc.in'
340 user_prefix = env.get('PREFIX')
341 user_lib = env.get('LIB_INSTALL_DIR')
344 user_prefix = env.get('BUILD_DIR').encode('string_escape')
347 user_lib = '$${prefix}/lib'
350 if env.get('LOGGING'):
351 defines.append('-DTB_LOG=1')
353 if env.get('ROUTING') == 'GW':
354 defines.append('-DROUTING_GATEWAY=1')
355 elif env.get('ROUTING') == 'EP':
356 defines.append('-DROUTING_EP=1')
359 if env.get('WITH_TCP'):
360 defines.append('-DTCP_ADAPTER=1')
361 if env.get('SECURED') == '1':
362 defines.append('-D__WITH_TLS__=1')
364 if env.get('SECURED') == '1':
365 defines.append('-D__WITH_DTLS__=1')
366 if env.get('EXC_PROV_SUPPORT') == '0':
367 libs.append('-locpmapi')
370 '\@VERSION\@': project_version,
371 '\@PREFIX\@': user_prefix,
372 '\@EXEC_PREFIX\@': user_prefix,
373 '\@LIB_INSTALL_DIR\@': user_lib,
374 '\@DEFINES\@': " ".join(defines),
375 '\@LIBS\@': " ".join(libs)
378 env.Substfile(pc_file, SUBST_DICT = pc_vars)
380 ######################################################################
381 # Setting global compiler flags
382 ######################################################################
383 target_transport = env.get('TARGET_TRANSPORT')
384 with_mq = env.get('WITH_MQ')
385 with_ra = env.get('WITH_RA')
386 with_tcp = env.get('WITH_TCP')
387 rd_mode = env.get('RD_MODE')
388 with_ra_ibb = env.get('WITH_RA_IBB')
390 env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
392 if (env.get('WITH_UPSTREAM_LIBCOAP') == '1'):
393 env.AppendUnique(CPPDEFINES = ['WITH_UPSTREAM_LIBCOAP'])
395 if (target_os not in ['arduino', 'windows']):
396 env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
398 if (target_os in ['darwin','ios']):
399 env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
401 if (env.get('SECURED') == '1'):
402 env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
404 if ((env.get('SECURED') == '1') and with_tcp):
405 env.AppendUnique(CPPDEFINES = ['__WITH_TLS__'])
407 if (env.get('MULTIPLE_OWNER') == '1'):
408 env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
410 if (env.get('ROUTING') == 'GW'):
411 env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
412 elif (env.get('ROUTING') == 'EP'):
413 env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
415 if (target_os == 'arduino'):
416 env.AppendUnique(CPPDEFINES = ['SINGLE_THREAD'])
417 env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO'])
418 elif (('IP' in target_transport) or ('ALL' in target_transport)):
419 env.AppendUnique(CPPDEFINES = ['WITH_BWT'])
421 if (target_os in ['linux', 'tizen', 'android'] and with_tcp):
422 env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
424 if (target_os in ['linux', 'tizen', 'android', 'arduino', 'ios']):
425 if (('BLE' in target_transport) or ('BT' in target_transport) or ('ALL' in target_transport)):
426 env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
428 if 'ALL' in target_transport:
430 env.AppendUnique(CPPDEFINES = ['RA_ADAPTER'])
432 env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER'])
433 if (target_os in ['linux', 'yocto']):
434 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'NO_EDR_ADAPTER', 'LE_ADAPTER'])
435 elif (target_os == 'android'):
436 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER', 'NFC_ADAPTER'])
437 elif (target_os in['darwin', 'ios', 'msys_nt', 'windows']):
438 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'NO_EDR_ADAPTER', 'NO_LE_ADAPTER'])
440 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER'])
442 if ('BT' in target_transport):
443 if (target_os == 'linux'):
444 print "CA Transport BT is not supported "
447 env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER'])
449 env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
451 if ('BLE' in target_transport):
452 env.AppendUnique(CPPDEFINES = ['LE_ADAPTER'])
454 env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
456 if ('IP' in target_transport):
457 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER'])
459 env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
462 if (target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'windows']):
463 env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
465 print "CA Transport TCP is not supported "
468 env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
470 if ('NFC' in target_transport):
471 if (target_os == 'android'):
472 env.AppendUnique(CPPDEFINES = ['NFC_ADAPTER'])
474 print "CA Transport NFC is not supported "
477 env.AppendUnique(CPPDEFINES = ['NO_NFC_ADAPTER'])
479 if ('SUB' in with_mq):
480 env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
482 if ('PUB' in with_mq):
483 env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
485 if ('BROKER' in with_mq):
486 env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
488 if env.get('LOGGING'):
489 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
491 if env.get('WITH_CLOUD') and with_tcp:
492 env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
494 if 'CLIENT' in rd_mode:
495 env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
497 if 'SERVER' in rd_mode:
498 env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
501 env.AppendUnique(CPPDEFINES = ['RA_ADAPTER_IBB'])
502 ######################################################################
503 # Link scons to Yocto cross-toolchain ONLY when target_os is yocto
504 ######################################################################
505 if target_os == "yocto":
507 This code injects Yocto cross-compilation tools+flags into scons'
508 build environment in order to invoke the relevant tools while
513 CC = os.environ['CC']
514 target_prefix = CC.split()[0]
515 target_prefix = target_prefix[:len(target_prefix)-3]
516 tools = {"CC" : target_prefix+"gcc",
517 "CXX" : target_prefix+"g++",
518 "AS" : target_prefix+"as",
519 "LD" : target_prefix+"ld",
520 "GDB" : target_prefix+"gdb",
521 "STRIP" : target_prefix+"strip",
522 "RANLIB" : target_prefix+"ranlib",
523 "OBJCOPY" : target_prefix+"objcopy",
524 "OBJDUMP" : target_prefix+"objdump",
525 "AR" : target_prefix+"ar",
526 "NM" : target_prefix+"nm",
528 "STRINGS": target_prefix+"strings"}
529 PATH = os.environ['PATH'].split(os.pathsep)
531 if tool in os.environ:
533 if os.path.isfile(os.path.join(path, tools[tool])):
534 env[tool] = os.path.join(path, os.environ[tool])
536 env['CROSS_COMPILE'] = target_prefix[:len(target_prefix) - 1]
538 print "ERROR in Yocto cross-toolchain environment"
541 Now reset TARGET_OS to linux so that all linux specific build configurations
542 hereupon apply for the entirety of the build process.
544 env['TARGET_OS'] = 'linux'
546 We want to preserve debug symbols to allow BitBake to generate both DEBUG and
547 RELEASE packages for OIC.
549 env.AppendUnique(CCFLAGS = ['-g'])
551 Additional flags to pass to the Yocto toolchain.
553 if env.get('RELEASE'):
554 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
555 env.AppendUnique(CPPDEFINES = ['__linux__', '_GNU_SOURCE'])
556 env.AppendUnique(CFLAGS = ['-std=gnu99'])
557 env.AppendUnique(CCFLAGS = ['-Wall', '-Wextra', '-fPIC'])
558 env.AppendUnique(LIBS = ['dl', 'pthread', 'uuid'])
562 If target_os is not Yocto, continue with the regular build process
564 # Load config of target os
565 env.SConscript(target_os + '/SConscript')
567 # Delete the temp files of configuration
568 if env.GetOption('clean'):
569 dir = env.get('SRC_DIR')
571 if os.path.exists(dir + '/config.log'):
572 Execute(Delete(dir + '/config.log'))
573 if os.path.exists(dir + '/.sconsign.dblite'):
574 Execute(Delete(dir + '/.sconsign.dblite'))
575 if os.path.exists(dir + '/.sconf_temp'):
576 Execute(Delete(dir + '/.sconf_temp'))
578 ######################################################################
579 # Check for PThreads support
580 ######################################################################
581 import iotivityconfig
582 from iotivityconfig import *
584 conf = Configure(env,
587 'CheckPThreadsSupport' : iotivityconfig.check_pthreads
590 # Identify whether we have pthreads support, which is necessary for
591 # threading and mutexes. This will set the environment variable
592 # POSIX_SUPPORTED, 1 if it is supported, 0 otherwise
593 conf.CheckPThreadsSupport()
596 ######################################################################
598 env.SConscript('external_libs.scons')