Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / resource / csdk / connectivity / build / android / SConscript
index 3c7cd74..90551ce 100644 (file)
@@ -14,13 +14,13 @@ Help(help_vars.GenerateHelpText(env))
 
 android_ndk = env.get('ANDROID_NDK')
 if not android_ndk:
-       print '''
+       print('''
 *************************************** Error *********************************
 *    Android NDK path isn't set, you can set enviornment variable ANDROID_NDK *
 * or add it in command line as:                                               *
 *      # scons ANDROID_NDK=<path to android NDK> ...                          *
 *******************************************************************************
-'''
+''')
        Exit(1)
 
 # Overwrite suffixes and prefixes
@@ -58,12 +58,12 @@ if env['HOST_OS'] == 'win32':
                ndk_build_cmd += '.cmd'
 
 if not os.path.isfile(ndk_build_cmd):
-       print '''
+       print('''
 *************************************** Error *********************************
 *   It seems android ndk path is not set properly, please check if "%s"
 * is the root directory of android ndk.                                       *
 *******************************************************************************
-''' % android_ndk
+''' % android_ndk)
        Exit(1)
 
 ANDROID_HOME = os.environ.get('ANDROID_HOME')
@@ -71,12 +71,12 @@ if ANDROID_HOME is not None:
        ANDROID_HOME = os.path.abspath(ANDROID_HOME)
 
 if ANDROID_HOME is None or not os.path.exists(ANDROID_HOME):
-       print '''
+       print('''
 *************************************** Warning *******************************
 *   Enviornment variable ANDROID_HOME is not set properly. It should be the   *
 * root directory of android sdk. If you'd like build Java code, it's required.*
 *******************************************************************************
-'''
+''')
 
 target_arch = env.get('TARGET_ARCH')
 
@@ -96,12 +96,12 @@ else:
 if tc_ver != '':
        cmd.append('NDK_TOOLCHAIN_VERSION=' + tc_ver)
 else:
-       print '''
+       print('''
 *************************************** Warning *******************************
 *   To support C++11, the toolchain should be >= 4.7, please make sure your   *
 * android NDK is at least r8e!                                                *
 *******************************************************************************
-'''
+''')
 
 cmd.append('-n')
 
@@ -164,17 +164,17 @@ else:
        env.AppendUnique(CCFLAGS = ['-g'])
 
 if env.get('LOGGING'):
-        env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
+        env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
 env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__ANDROID__'])
 env.AppendUnique(CCFLAGS = ['-Wall', '-fPIC'])
-#env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread'])
 
 env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+src_dir = env.get('SRC_DIR')
 env.AppendUnique(LIBPATH = [src_dir + '/lib/android'])
 env.AppendUnique(LIBS = ['log', 'coap'])
 if env.get('SECURED') == '1':
-       env.AppendUnique(LIBS = ['tinydtls'])
+       env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
 
 # From android-5 (API > 20), all application must be built with flags '-fPIE' '-pie'.
 # Due to the limitation of Scons, it's required to added it into the command line