+# -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
##
# This script includes generic build options:
# release/debug, target os, target arch, cross toolchain, build environment etc
import os
import platform
+project_version = '1.2.0'
+
# Map of host os and allowed target os (host: allowed target os)
host_target_map = {
'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
logging_default = (release_mode == False)
-
######################################################################
# Common build options (release, target os, target arch)
######################################################################
help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False))
help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
+help_vars.Add(BoolVariable('WITH_PROXY', 'Build with CoAP-HTTP Proxy', False))
help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
-help_vars.Add(EnumVariable('WITH_RD', 'Build including Resource Directory', '0', allowed_values=('0', '1')))
-help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including Cloud client sample', False))
+help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
+help_vars.Add(ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT', ['CLIENT', 'SERVER']))
help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False))
help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
-#ES_TARGET_ENROLLEE is for specifying what is our target enrollee (Arduino or rest of platforms which support Multicast)
-help_vars.Add(EnumVariable('ES_TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
-#ES_ROLE is for specifying the role (Enrollee or Mediator) for which scons is being executed
-help_vars.Add(EnumVariable('ES_ROLE', 'Target build mode', 'mediator', allowed_values=('mediator', 'enrollee')))
-#ES_SOFT_MODE is for specifying MODE (Mode 1 : Enrollee with Soft AP or Mode 2 : Mediator with Soft AP)
-help_vars.Add(EnumVariable('ES_SOFTAP_MODE', 'Target build mode', 'ENROLLEE_SOFTAP', allowed_values=('ENROLLEE_SOFTAP', 'MEDIATOR_SOFTAP')))
AddOption('--prefix',
dest='prefix',
######################################################################
pc_file = env.get('SRC_DIR') + '/iotivity.pc.in'
-if env.get('ROUTING') == 'GW':
- routing_define = 'ROUTING_GATEWAY'
-elif env.get('ROUTING') == 'EP':
- routing_define = 'ROUTING_EP'
-
user_prefix = env.get('PREFIX')
user_lib = env.get('LIB_INSTALL_DIR')
+
+if not user_prefix:
+ user_prefix = env.get('BUILD_DIR').encode('string_escape')
+
if not user_lib:
- user_lib = '$${prefix}/lib'
-
-if user_prefix:
- pc_vars = {'\@PREFIX\@': user_prefix,
- '\@EXEC_PREFIX\@':user_prefix,
- '\@VERSION\@': '1.1.1',
- '\@LIB_INSTALL_DIR\@': user_lib,
- '\@ROUTING_DEFINE\@': routing_define
- }
-else:
- pc_vars = {'\@PREFIX\@': env.get('BUILD_DIR').encode('string_escape'),
- '\@EXEC_PREFIX\@': env.get('BUILD_DIR').encode('string_escape'),
- '\@VERSION\@': '1.1.1',
- '\@LIB_INSTALL_DIR\@': user_lib,
- '\@ROUTING_DEFINE\@': routing_define
- }
+ user_lib = '$${prefix}/lib'
+
+defines = []
+if env.get('LOGGING'):
+ defines.append('-DTB_LOG=1')
+
+if env.get('ROUTING') == 'GW':
+ defines.append('-DROUTING_GATEWAY=1')
+elif env.get('ROUTING') == 'EP':
+ defines.append('-DROUTING_EP=1')
+
+pc_vars = {
+ '\@VERSION\@': project_version,
+ '\@PREFIX\@': user_prefix,
+ '\@EXEC_PREFIX\@': user_prefix,
+ '\@LIB_INSTALL_DIR\@': user_lib,
+ '\@DEFINES\@': " ".join(defines)
+}
env.Substfile(pc_file, SUBST_DICT = pc_vars)
env[tool] = os.path.join(path, os.environ[tool])
break
env['CROSS_COMPILE'] = target_prefix[:len(target_prefix) - 1]
+ if os.environ['LDFLAGS'] != None:
+ env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS']))
except:
print "ERROR in Yocto cross-toolchain environment"
Exit(1)