[Tizen]change flag which used for detect ip changed
[platform/upstream/iotivity.git] / build_common / SConscript
index 85a5eb1..e00a628 100644 (file)
@@ -6,7 +6,7 @@
 import os
 import platform
 
-project_version = '1.2.0'
+project_version = '1.2.1'
 
 # Map of host os and allowed target os (host: allowed target os)
 host_target_map = {
@@ -18,7 +18,7 @@ host_target_map = {
 
 # Map of os and allowed archs (os: allowed archs)
 os_arch_map = {
-               'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'arm64'],
+               'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-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'],
@@ -26,7 +26,7 @@ os_arch_map = {
                'darwin': ['i386', 'x86_64'],
                'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
                'arduino': ['avr', 'arm'],
-               'yocto': ['i586', 'i686', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
+               'yocto': ['i586', 'i686', 'x86_64', 'arm', 'aarch64', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
                }
 
 host = platform.system().lower()
@@ -76,6 +76,11 @@ else:
                release_mode = True
        logging_default = (release_mode == False)
 
+# targets that do not support the DTLS build (SECURED=1 build option)
+targets_without_dtls_support = ['arduino'];
+if ARGUMENTS.get('SECURED') == '1' and target_os in targets_without_dtls_support:
+       print "\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os)
+       Exit(1)
 
 ######################################################################
 # Common build options (release, target os, target arch)
@@ -107,7 +112,7 @@ else:
 
 help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
 help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
-help_vars.Add(EnumVariable('DTLS_WITH_X509', 'DTLS with X.509 support', '0', allowed_values=('0', '1')))
+help_vars.Add(EnumVariable('MULTIPLE_OWNER', 'Enable multiple owner', '0', allowed_values=('0', '1')))
 help_vars.Add(EnumVariable('TEST', 'Run unit tests', '0', allowed_values=('0', '1')))
 help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', logging_default))
 help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
@@ -187,19 +192,13 @@ if target_os in targets_support_cc:
        if prefix or tc_path:
                print tc_set_msg
 
-# Import env variables only if reproductibility is ensured
-if target_os in ['yocto']:
-    env['CONFIG_ENVIRONMENT_IMPORT'] = True
-else:
-    env['CONFIG_ENVIRONMENT_IMPORT'] = False
-
-if env['CONFIG_ENVIRONMENT_IMPORT'] == True:
-    print "warning: importing some environment variables for OS: %s" % target_os
-    for ev in ['PATH', 'PKG_CONFIG', 'PKG_CONFIG_PATH', 'PKG_CONFIG_SYSROOT_DIR']:
-        if os.environ.get(ev) != None:
-            env['ENV'][ev] = os.environ.get(ev)
-    if os.environ['LDFLAGS'] != None:
-        env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS']))
+# 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)
@@ -336,12 +335,23 @@ if env.get('ROUTING') == 'GW':
 elif env.get('ROUTING') == 'EP':
     defines.append('-DROUTING_EP=1')
 
+libs = []
+if env.get('WITH_TCP'):
+    defines.append('-DTCP_ADAPTER=1')
+    if env.get('SECURED') == '1':
+        defines.append('-D__WITH_TLS__=1')
+
+if env.get('SECURED') == '1':
+    libs.append('-locpmapi')
+    defines.append('-D_WITH_DTLS_=1')
+
 pc_vars = {
     '\@VERSION\@': project_version,
     '\@PREFIX\@': user_prefix,
     '\@EXEC_PREFIX\@': user_prefix,
     '\@LIB_INSTALL_DIR\@': user_lib,
-    '\@DEFINES\@': " ".join(defines)
+    '\@DEFINES\@': " ".join(defines),
+    '\@LIBS\@': " ".join(libs)
 }
 
 env.Substfile(pc_file, SUBST_DICT = pc_vars)
@@ -381,6 +391,8 @@ if target_os == "yocto":
                         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)