|
@@ -7,7 +7,7 @@ import sys
|
|
# http://www.scons.org/wiki/LongCmdLinesOnWin32
|
|
# http://www.scons.org/wiki/LongCmdLinesOnWin32
|
|
if (os.name=="nt"):
|
|
if (os.name=="nt"):
|
|
import subprocess
|
|
import subprocess
|
|
-
|
|
|
|
|
|
+
|
|
def mySubProcess(cmdline,env):
|
|
def mySubProcess(cmdline,env):
|
|
#print "SPAWNED : " + cmdline
|
|
#print "SPAWNED : " + cmdline
|
|
startupinfo = subprocess.STARTUPINFO()
|
|
startupinfo = subprocess.STARTUPINFO()
|
|
@@ -21,22 +21,22 @@ if (os.name=="nt"):
|
|
print(err.decode("utf-8"))
|
|
print(err.decode("utf-8"))
|
|
print("=====")
|
|
print("=====")
|
|
return rv
|
|
return rv
|
|
-
|
|
|
|
|
|
+
|
|
def mySpawn(sh, escape, cmd, args, env):
|
|
def mySpawn(sh, escape, cmd, args, env):
|
|
-
|
|
|
|
|
|
+
|
|
newargs = ' '.join(args[1:])
|
|
newargs = ' '.join(args[1:])
|
|
cmdline = cmd + " " + newargs
|
|
cmdline = cmd + " " + newargs
|
|
-
|
|
|
|
|
|
+
|
|
rv=0
|
|
rv=0
|
|
if len(cmdline) > 32000 and cmd.endswith("ar") :
|
|
if len(cmdline) > 32000 and cmd.endswith("ar") :
|
|
cmdline = cmd + " " + args[1] + " " + args[2] + " "
|
|
cmdline = cmd + " " + args[1] + " " + args[2] + " "
|
|
for i in range(3,len(args)) :
|
|
for i in range(3,len(args)) :
|
|
rv = mySubProcess( cmdline + args[i], env )
|
|
rv = mySubProcess( cmdline + args[i], env )
|
|
if rv :
|
|
if rv :
|
|
- break
|
|
|
|
- else:
|
|
|
|
|
|
+ break
|
|
|
|
+ else:
|
|
rv = mySubProcess( cmdline, env )
|
|
rv = mySubProcess( cmdline, env )
|
|
-
|
|
|
|
|
|
+
|
|
return rv
|
|
return rv
|
|
|
|
|
|
def add_sources(sources, dir, extension):
|
|
def add_sources(sources, dir, extension):
|
|
@@ -215,6 +215,9 @@ elif env['platform'] == 'windows':
|
|
env['AR'] = "i686-w64-mingw32-ar"
|
|
env['AR'] = "i686-w64-mingw32-ar"
|
|
env['RANLIB'] = "i686-w64-mingw32-ranlib"
|
|
env['RANLIB'] = "i686-w64-mingw32-ranlib"
|
|
env['LINK'] = "i686-w64-mingw32-g++"
|
|
env['LINK'] = "i686-w64-mingw32-g++"
|
|
|
|
+ elif host_platform == 'windows' and env['use_mingw']:
|
|
|
|
+ env = env.Clone(tools=['mingw'])
|
|
|
|
+ env["SPAWN"] = mySpawn
|
|
|
|
|
|
# Native or cross-compilation using MinGW
|
|
# Native or cross-compilation using MinGW
|
|
if host_platform == 'linux' or host_platform == 'osx' or env['use_mingw']:
|
|
if host_platform == 'linux' or host_platform == 'osx' or env['use_mingw']:
|
|
@@ -229,18 +232,18 @@ elif env['platform'] == 'android':
|
|
if host_platform == 'windows':
|
|
if host_platform == 'windows':
|
|
env = env.Clone(tools=['mingw'])
|
|
env = env.Clone(tools=['mingw'])
|
|
env["SPAWN"] = mySpawn
|
|
env["SPAWN"] = mySpawn
|
|
-
|
|
|
|
|
|
+
|
|
# Verify NDK root
|
|
# Verify NDK root
|
|
if not 'ANDROID_NDK_ROOT' in env:
|
|
if not 'ANDROID_NDK_ROOT' in env:
|
|
raise ValueError("To build for Android, ANDROID_NDK_ROOT must be defined. Please set ANDROID_NDK_ROOT to the root folder of your Android NDK installation.")
|
|
raise ValueError("To build for Android, ANDROID_NDK_ROOT must be defined. Please set ANDROID_NDK_ROOT to the root folder of your Android NDK installation.")
|
|
-
|
|
|
|
|
|
+
|
|
# Validate API level
|
|
# Validate API level
|
|
api_level = int(env['android_api_level'])
|
|
api_level = int(env['android_api_level'])
|
|
if env['android_arch'] in ['x86_64', 'arm64v8'] and api_level < 21:
|
|
if env['android_arch'] in ['x86_64', 'arm64v8'] and api_level < 21:
|
|
print("WARN: 64-bit Android architectures require an API level of at least 21; setting android_api_level=21")
|
|
print("WARN: 64-bit Android architectures require an API level of at least 21; setting android_api_level=21")
|
|
env['android_api_level'] = '21'
|
|
env['android_api_level'] = '21'
|
|
api_level = 21
|
|
api_level = 21
|
|
-
|
|
|
|
|
|
+
|
|
# Setup toolchain
|
|
# Setup toolchain
|
|
toolchain = env['ANDROID_NDK_ROOT'] + "/toolchains/llvm/prebuilt/"
|
|
toolchain = env['ANDROID_NDK_ROOT'] + "/toolchains/llvm/prebuilt/"
|
|
if host_platform == "windows":
|
|
if host_platform == "windows":
|