summaryrefslogtreecommitdiff
path: root/platform/android/detect.py
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/detect.py')
-rw-r--r--platform/android/detect.py43
1 files changed, 20 insertions, 23 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py
index d4038f6584..ba6b73a89f 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -5,7 +5,7 @@ import platform
def is_active():
return True
-
+
def get_name():
return "Android"
@@ -21,7 +21,6 @@ def get_opts():
return [
('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
- ('NDK_TOOLCHAIN', 'toolchain to use for the NDK',"arm-eabi-4.4.0"),
('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")),
('ndk_platform', 'compile for platform: (android-<api> , example: android-15)',"android-15"),
@@ -56,9 +55,9 @@ def configure(env):
# http://www.scons.org/wiki/LongCmdLinesOnWin32
import os
if (os.name=="nt"):
-
+
import subprocess
-
+
def mySubProcess(cmdline,env):
#print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO()
@@ -72,26 +71,26 @@ def configure(env):
print err
print "====="
return rv
-
+
def mySpawn(sh, escape, cmd, args, env):
-
+
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
-
+
rv=0
if len(cmdline) > 32000 and cmd.endswith("ar") :
cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3,len(args)) :
rv = mySubProcess( cmdline + args[i], env )
if rv :
- break
- else:
+ break
+ else:
rv = mySubProcess( cmdline, env )
-
+
return rv
-
+
env['SPAWN'] = mySpawn
-
+
ndk_platform=env['ndk_platform']
if env['android_arch'] not in ['armv7','armv6','x86']:
@@ -102,9 +101,7 @@ def configure(env):
env["x86_opt_gcc"]=True
if env['PLATFORM'] == 'win32':
- import methods
env.Tool('gcc')
- #env['SPAWN'] = methods.win32_spawn
env['SHLIBSUFFIX'] = '.so'
@@ -114,7 +111,7 @@ def configure(env):
print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text)
env.Append(CPPPATH=['#platform/android'])
-
+
if env['android_arch']=='x86':
env.extra_suffix=".x86"+env.extra_suffix
elif env['android_arch']=='armv6':
@@ -126,8 +123,7 @@ def configure(env):
env.extra_suffix=".armv7"+env.extra_suffix
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
-
- import os
+
if (sys.platform.find("linux")==0):
if (platform.architecture()[0]=='64bit' or os.path.isdir(gcc_path+"linux-x86_64/bin")): # check was not working
gcc_path=gcc_path+"/linux-x86_64/bin"
@@ -136,10 +132,11 @@ def configure(env):
elif (sys.platform=="darwin"):
gcc_path=gcc_path+"/darwin-x86_64/bin" #this may be wrong
env['SHLINKFLAGS'][1] = '-shared'
+ env['SHLIBSUFFIX'] = '.so'
elif (os.name=="nt"):
gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong
-
-
+
+
env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
if env['android_arch']=='x86':
@@ -171,11 +168,11 @@ def configure(env):
env['neon_enabled']=False
if env['android_arch']=='x86':
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
+ env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
elif env["android_arch"]=="armv6":
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
+ env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
elif env["android_arch"]=="armv7":
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
+ env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
if env['android_neon']=='yes':
env['neon_enabled']=True
env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__'])
@@ -224,7 +221,7 @@ def configure(env):
elif env["android_arch"]=="armv7":
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"])
-
+
env.Append(LIBS=["gnustl_static","supc++"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])