# Map of host os and allowed target os (host: allowed target os)
host_target_map = {
'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
- 'windows': ['windows', 'winrt', 'android', 'arduino'],
+ 'windows': ['windows', 'android', 'arduino'],
'darwin': ['darwin', 'ios', 'android', 'arduino'],
+ 'msys_nt' :['msys_nt'],
}
# Map of os and allowed archs (os: allowed archs)
os_arch_map = {
- 'linux': ['x86', 'x86_64', 'arm', 'arm64'],
- 'tizen': ['x86', 'x86_64', 'arm', 'arm64', 'armeabi-v7a'],
+ 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'arm64'],
+ 'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'],
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
'windows': ['x86', 'amd64', 'arm'],
- 'winrt': ['arm'],
+ 'msys_nt':['x86', 'x86_64'],
'darwin': ['i386', 'x86_64'],
'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
'arduino': ['avr', 'arm'],
host = platform.system().lower()
+# the host string contains version of windows. 6.3, 6.4, 10.0 which is 8.0, 8.1, and 10 respectively.
+# Let's canonicalize the msys_nt-XX.X system name by stripping version off.
+if 'msys_nt' in host:
+ host = 'msys_nt'
+
if not host_target_map.has_key(host):
print "\nError: Current system (%s) isn't supported\n" % host
Exit(1)
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(EnumVariable('WITH_RD', 'Build including Resource Directory', '0', allowed_values=('0', '1')))
+help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
+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',
tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'textfile']
)
else:
- env = Environment(variables = help_vars, tools = ['default', 'textfile'], TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix'))
-
+ env = Environment(variables = help_vars, tools = ['default', 'textfile'],
+ TARGET_ARCH = target_arch, TARGET_OS = target_os,
+ PREFIX = GetOption('prefix'),
+ LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR') #for 64bit build
+ )
Help(help_vars.GenerateHelpText(env))
tc_set_msg = '''
if prefix or tc_path:
print tc_set_msg
+# If cross-compiling, honor environment settings for toolchain to avoid picking up native tools
+if os.environ.get('PKG_CONFIG') != None:
+ env["ENV"]["PKG_CONFIG"] = os.environ.get("PKG_CONFIG")
+if os.environ.get('PKG_CONFIG_PATH') != None:
+ env["ENV"]["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH")
+if os.environ.get('PKG_CONFIG_SYSROOT_DIR') != None:
+ env["ENV"]["PKG_CONFIG_SYSROOT_DIR"] = os.environ.get("PKG_CONFIG_SYSROOT_DIR")
+
# Ensure scons be able to change its working directory
env.SConscriptChdir(1)
def __installlib(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
- i_n = ienv.Install(user_prefix + '/lib', targets)
+ user_lib = env.get('LIB_INSTALL_DIR')
+ if user_lib:
+ i_n = ienv.Install(user_lib, targets)
+ else:
+ i_n = ienv.Install(user_prefix + '/lib', targets)
ienv.Alias("install", i_n)
+ else:
+ i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+ ienv.Alias("install", i_n)
def __installbin(ienv, targets, name):
user_prefix = env.get('PREFIX')
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/include/' + dir ,targets)
- ienv.Alias("install", i_n)
+ else:
+ i_n = ienv.Install(os.path.join(env.get('BUILD_DIR'), 'include', dir), targets)
+ ienv.Alias("install", i_n)
def __installpcfile(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
- i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets)
- ienv.Alias("install", i_n)
+ user_lib = env.get('LIB_INSTALL_DIR')
+ if user_lib:
+ i_n = ienv.Install(user_lib + '/pkgconfig', targets)
+ else:
+ i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets)
+ else:
+ i_n = ienv.Install(env.get('BUILD_DIR') + 'lib/pkgconfig', targets)
+ ienv.Alias("install", i_n)
def __append_target(ienv, name, targets = None):
if targets:
######################################################################
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_lib:
+ user_lib = '$${prefix}/lib'
if user_prefix:
- pc_vars = {'\@PREFIX\@': user_prefix, '\@EXEC_PREFIX\@':user_prefix, '\@VERSION\@':'0.9.2'}
+ 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'), '\@EXEC_PREFIX\@': env.get('BUILD_DIR'), '\@VERSION\@':'0.9.2'}
+ 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
+ }
env.Substfile(pc_file, SUBST_DICT = pc_vars)
env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__linux__', '_GNU_SOURCE'])
env.AppendUnique(CFLAGS = ['-std=gnu99'])
env.AppendUnique(CCFLAGS = ['-Wall', '-Wextra', '-fPIC'])
- env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread'])
- env.AppendUnique(LIBS = ['uuid'])
+ env.AppendUnique(LIBS = ['dl', 'pthread', 'uuid'])
Export('env')
else:
'''
# POSIX_SUPPORTED, 1 if it is supported, 0 otherwise
conf.CheckPThreadsSupport()
+######################################################################
+# Generate macros for presence of headers
+######################################################################
+cxx_headers = ['arpa/inet.h',
+ 'fcntl.h',
+ 'grp.h',
+ 'in6addr.h',
+ 'linux/limits.h',
+ 'memory.h',
+ 'netdb.h',
+ 'netinet/in.h',
+ 'pthread.h',
+ 'pwd.h',
+ 'stdlib.h',
+ 'string.h',
+ 'strings.h',
+ 'sys/socket.h',
+ 'sys/stat.h',
+ 'sys/time.h',
+ 'sys/timeb.h',
+ 'sys/types.h',
+ 'sys/unistd.h',
+ 'syslog.h',
+ 'time.h',
+ 'unistd.h',
+ 'uuid/uuid.h',
+ 'windows.h',
+ 'winsock2.h',
+ 'ws2tcpip.h']
+
+if target_os == 'arduino':
+ # Detection of headers on the Arduino platform is currently broken.
+ cxx_headers = []
+
+if target_os == 'msys_nt':
+ # WinPThread provides a pthread.h, but we want to use native threads.
+ cxx_headers.remove('pthread.h')
+
+def get_define_from_header_file(header_file):
+ header_file_converted = header_file.replace("/","_").replace(".","_").upper()
+ return "HAVE_" + header_file_converted
+
+for header_file_name in cxx_headers:
+ if conf.CheckCXXHeader(header_file_name):
+ conf.env.AppendUnique(CPPDEFINES = [get_define_from_header_file(header_file_name)])
+
env = conf.Finish()
######################################################################