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
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')
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')
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')
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