summaryrefslogtreecommitdiffstats
path: root/lib/libUPnP/Platinum/Build/Targets/arm-android-linux/Config.scons
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libUPnP/Platinum/Build/Targets/arm-android-linux/Config.scons')
-rw-r--r--lib/libUPnP/Platinum/Build/Targets/arm-android-linux/Config.scons107
1 files changed, 107 insertions, 0 deletions
diff --git a/lib/libUPnP/Platinum/Build/Targets/arm-android-linux/Config.scons b/lib/libUPnP/Platinum/Build/Targets/arm-android-linux/Config.scons
new file mode 100644
index 0000000..bdbf08d
--- /dev/null
+++ b/lib/libUPnP/Platinum/Build/Targets/arm-android-linux/Config.scons
@@ -0,0 +1,107 @@
+#################################################################
+# Important: this build file has been tested with Android NDK r6, r7 and r8
+# It may or may not work with other releases of the NDK. Please notify
+# us if you find a newer NDK for which this does not work.
+#################################################################
+
+import os
+import re
+import sys
+import platform
+
+# we need to know when the NDK is
+ANDROID_NDK_ROOT=os.getenv('ANDROID_NDK_ROOT')
+if not ANDROID_NDK_ROOT:
+ raise Exception('ANDROID_NDK_ROOT environment variable not set')
+
+# detect the host system on which we're running
+if env.has_key('android_host_system') and env['android_host_system']:
+ ANDROID_HOST_SYSTEM = env['android_host_system']
+else:
+ PLATFORM_TO_TARGET_MAP = {
+ 'linux-i386' : 'linux-x86',
+ 'linux2' : 'linux-x86',
+ 'win32' : 'windows',
+ 'cygwin' : 'windows',
+ 'darwin' : 'darwin-x86'
+ }
+ if sys.platform in PLATFORM_TO_TARGET_MAP:
+ ANDROID_HOST_SYSTEM = PLATFORM_TO_TARGET_MAP[sys.platform]
+ else:
+ raise Exception('Android Host Platform cannot be determined')
+
+# set defaults
+ANDROID_ARCH = 'arm'
+ANDROID_PLATFORM = 'android-9'
+ANDROID_TOOLCHAIN = 'arm-linux-androideabi-4.4.3'
+ANDROID_CROSS_PREFIX = 'arm-linux-androideabi'
+
+if not os.path.exists(os.path.join(ANDROID_NDK_ROOT, 'toolchains', ANDROID_TOOLCHAIN)):
+ toolchain_dirs = os.listdir(ANDROID_NDK_ROOT+'/toolchains')
+ for toolchain_dir in toolchain_dirs:
+ if os.path.exists(os.path.join(ANDROID_NDK_ROOT, 'toolchains', toolchain_dir, 'prebuilt', ANDROID_HOST_SYSTEM)):
+ ANDROID_TOOLCHAIN=toolchain_dir
+ suffix_pos = toolchain_dir.rfind('-')
+ if (suffix_pos >= 0):
+ ANDROID_CROSS_PREFIX = ANDROID_TOOLCHAIN[:suffix_pos]
+ print "Auto-selecting toolchain:", ANDROID_TOOLCHAIN
+ break
+
+# override defaults from command line args
+if ARGUMENTS.get('android_toolchain'):
+ ANDROID_TOOLCHAIN=ARGUMENTS.get('android_toolchain')
+
+if ARGUMENTS.get('android_cross_prefix'):
+ ANDROID_CROSS_PREFIX=ARGUMENTS.get('android_cross_prefix')
+
+if ARGUMENTS.get('android_platform'):
+ ANDROID_PLATFORM=ARGUMENTS.get('android_platform')
+
+if ARGUMENTS.get('android_arch'):
+ ANDROID_ARCH=ARGUMENTS.get('android_arch')
+
+print 'Building for Android: '
+print 'ANDROID_HOST_SYSTEM =', ANDROID_HOST_SYSTEM
+print 'ANDROID_TOOLCHAIN =', ANDROID_TOOLCHAIN
+print 'ANDROID_PLATFORM =', ANDROID_PLATFORM
+print 'ANDROID_ARCH =', ANDROID_ARCH
+
+ANDROID_TOOLCHAIN_BIN = ANDROID_NDK_ROOT+'/toolchains/'+ANDROID_TOOLCHAIN+'/prebuilt/'+ANDROID_HOST_SYSTEM+'/bin'
+ANDROID_SYSROOT = ANDROID_NDK_ROOT+'/platforms/'+ANDROID_PLATFORM+'/arch-'+ANDROID_ARCH
+
+### add the tools to the path
+env.PrependENVPath('PATH', ANDROID_TOOLCHAIN_BIN)
+
+### special C Runtime startup for executables
+env['NPT_EXTRA_EXECUTABLE_OBJECTS'] = []
+env['NPT_EXTRA_LIBS'] = ['gcc']
+
+### Load the tools
+LoadTool('gcc-generic', env, gcc_cross_prefix=ANDROID_CROSS_PREFIX, gcc_strict=False)
+env.AppendUnique(CCFLAGS = ['-I'+ANDROID_NDK_ROOT+'/sources/cxx-stl/system/include' ,
+ '--sysroot', ANDROID_SYSROOT,
+ '-msoft-float',
+ '-fpic',
+ '-mthumb-interwork',
+ '-ffunction-sections',
+ '-funwind-tables',
+ '-fstack-protector',
+ '-fno-short-enums'])
+env.AppendUnique(CXXFLAGS = ['-fno-exceptions', '-fno-rtti'])
+env.AppendUnique(CPPDEFINES = ['ANDROID', 'NPT_CONFIG_HAVE_SYSTEM_LOG_CONFIG'])
+env.AppendUnique(LINKFLAGS = ['--sysroot', ANDROID_SYSROOT,
+ '-Wl,--no-undefined',
+ '-Wl,-z,noexecstack',
+ '-L'+ANDROID_SYSROOT+'/usr/lib',
+ '-lc',
+ '-lstdc++',
+ '-lm',
+ '-llog',
+ '-ldl'])
+
+### Specific System choices
+env['NPT_SYSTEM_SOURCES']={'System/StdC':'NptStdc[!D]*.cpp',
+ 'System/Bsd':'*.cpp',
+ 'System/Posix':'*.cpp',
+ 'System/Null':['NptNullSerialPort.cpp', 'NptNullAutoreleasePool.cpp'],
+ 'System/Android':'*.cpp'}