Android fixes
This commit is contained in:
parent
e5b3d58f77
commit
0a84dd9ca3
|
|
@ -390,11 +390,7 @@ cinf(double v) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float
|
||||
make_nan(float) {
|
||||
#ifndef _WIN32
|
||||
return nanf("");
|
||||
#else
|
||||
return std::numeric_limits<float>::quiet_NaN();
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -403,11 +399,7 @@ make_nan(float) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double
|
||||
make_nan(double) {
|
||||
#ifndef _WIN32
|
||||
return nan("");
|
||||
#else
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
struct AAssetManager;
|
||||
struct AAsset;
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
typedef unsigned char jboolean; /* unsigned 8 bits */
|
||||
typedef signed char jbyte; /* signed 8 bits */
|
||||
typedef unsigned short jchar; /* unsigned 16 bits */
|
||||
typedef short jshort; /* signed 16 bits */
|
||||
typedef int jint; /* signed 32 bits */
|
||||
typedef long long jlong; /* signed 64 bits */
|
||||
typedef float jfloat; /* 32-bit IEEE 754 */
|
||||
typedef double jdouble; /* 64-bit IEEE 754 */
|
||||
|
||||
typedef jint jsize;
|
||||
|
||||
typedef void* jobject;
|
||||
typedef jobject jclass;
|
||||
typedef jobject jstring;
|
||||
typedef jobject jarray;
|
||||
typedef jarray jobjectArray;
|
||||
typedef jarray jbooleanArray;
|
||||
typedef jarray jbyteArray;
|
||||
typedef jarray jcharArray;
|
||||
typedef jarray jshortArray;
|
||||
typedef jarray jintArray;
|
||||
typedef jarray jlongArray;
|
||||
typedef jarray jfloatArray;
|
||||
typedef jarray jdoubleArray;
|
||||
typedef jobject jthrowable;
|
||||
typedef jobject jweak;
|
||||
|
||||
struct _jfieldID; /* opaque structure */
|
||||
typedef struct _jfieldID* jfieldID; /* field IDs */
|
||||
|
||||
struct _jmethodID; /* opaque structure */
|
||||
typedef struct _jmethodID* jmethodID; /* method IDs */
|
||||
|
||||
struct JNIInvokeInterface;
|
||||
|
||||
struct _JNIEnv;
|
||||
struct _JavaVM;
|
||||
typedef _JNIEnv JNIEnv;
|
||||
typedef _JavaVM JavaVM;
|
||||
|
|
@ -663,21 +663,6 @@ if (COMPILER=="GCC"):
|
|||
IncDirectory("ALWAYS", "/usr/local/include")
|
||||
LibDirectory("ALWAYS", "/usr/local/lib")
|
||||
|
||||
if GetHost() != "darwin":
|
||||
# Workaround for an issue where pkg-config does not include this path
|
||||
if GetTargetArch() in ("x86_64", "amd64"):
|
||||
if (os.path.isdir("/usr/lib64/glib-2.0/include")):
|
||||
IncDirectory("GTK2", "/usr/lib64/glib-2.0/include")
|
||||
if (os.path.isdir("/usr/lib64/gtk-2.0/include")):
|
||||
IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include")
|
||||
|
||||
if (os.path.isdir("/usr/X11R6/lib64")):
|
||||
LibDirectory("ALWAYS", "/usr/X11R6/lib64")
|
||||
else:
|
||||
LibDirectory("ALWAYS", "/usr/X11R6/lib")
|
||||
else:
|
||||
LibDirectory("ALWAYS", "/usr/X11R6/lib")
|
||||
|
||||
fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
|
||||
# WARNING! The order of the ffmpeg libraries matters!
|
||||
ffmpeg_libs = ("libavformat", "libavcodec", "libavutil")
|
||||
|
|
@ -752,6 +737,22 @@ if (COMPILER=="GCC"):
|
|||
SmartPkgEnable("XF86DGA", "xxf86dga", "Xxf86dga", "X11/extensions/xf86dga.h")
|
||||
SmartPkgEnable("XCURSOR", "xcursor", "Xcursor", "X11/Xcursor/Xcursor.h")
|
||||
|
||||
if GetHost() != "darwin":
|
||||
# Workaround for an issue where pkg-config does not include this path
|
||||
if GetTargetArch() in ("x86_64", "amd64"):
|
||||
if (os.path.isdir("/usr/lib64/glib-2.0/include")):
|
||||
IncDirectory("GTK2", "/usr/lib64/glib-2.0/include")
|
||||
if (os.path.isdir("/usr/lib64/gtk-2.0/include")):
|
||||
IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include")
|
||||
|
||||
if not PkgSkip("X11"):
|
||||
if (os.path.isdir("/usr/X11R6/lib64")):
|
||||
LibDirectory("ALWAYS", "/usr/X11R6/lib64")
|
||||
else:
|
||||
LibDirectory("ALWAYS", "/usr/X11R6/lib")
|
||||
elif not PkgSkip("X11"):
|
||||
LibDirectory("ALWAYS", "/usr/X11R6/lib")
|
||||
|
||||
if (RUNTIME):
|
||||
# For the runtime, all packages are required
|
||||
for pkg in ["OPENSSL", "ZLIB", "NPAPI", "JPEG", "PNG"]:
|
||||
|
|
@ -1046,7 +1047,7 @@ def CompileCxx(obj,src,opts):
|
|||
|
||||
if (COMPILER=="GCC"):
|
||||
if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj
|
||||
else: cmd = GetCXX()+' -ftemplate-depth-30 -fPIC -c -o ' + obj
|
||||
else: cmd = GetCXX()+' -ftemplate-depth-50 -fPIC -c -o ' + obj
|
||||
for (opt, dir) in INCDIRECTORIES:
|
||||
if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir)
|
||||
for (opt,var,val) in DEFSYMBOLS:
|
||||
|
|
@ -1070,9 +1071,12 @@ def CompileCxx(obj,src,opts):
|
|||
cmd += ' --sysroot=%s -no-canonical-prefixes' % (SDK["SYSROOT"])
|
||||
|
||||
# Android-specific flags.
|
||||
arch = GetTargetArch()
|
||||
|
||||
if GetTarget() == "android":
|
||||
cmd += ' -I%s/include' % (SDK["ANDROID_STL"])
|
||||
cmd += ' -I%s/libs/%s/include' % (SDK["ANDROID_STL"], SDK["ANDROID_ABI"])
|
||||
cmd += ' -ffunction-sections -funwind-tables'
|
||||
arch = GetTargetArch()
|
||||
if arch == 'armv7a':
|
||||
cmd += ' -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__'
|
||||
cmd += ' -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16'
|
||||
|
|
@ -1111,7 +1115,7 @@ def CompileCxx(obj,src,opts):
|
|||
else:
|
||||
cmd += " -pthread"
|
||||
|
||||
if PkgSkip("SSE2") == 0:
|
||||
if PkgSkip("SSE2") == 0 and not arch.startswith("arm"):
|
||||
cmd += " -msse2"
|
||||
|
||||
if (optlevel==1): cmd += " -ggdb -D_DEBUG"
|
||||
|
|
@ -1217,7 +1221,7 @@ def CompileIgate(woutd,wsrc,opts):
|
|||
# NOTE: this 1600 value is the version number for VC2010.
|
||||
cmd += ' -D_MSC_VER=1600 -D"_declspec(param)=" -D_near -D_far -D__near -D__far -D__stdcall'
|
||||
if (COMPILER=="GCC"):
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const'
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__attribute__\(x\)='
|
||||
if GetTargetArch() in ("x86_64", "amd64"):
|
||||
cmd += ' -D_LP64'
|
||||
else:
|
||||
|
|
@ -1495,7 +1499,7 @@ def CompileLink(dll, obj, opts):
|
|||
|
||||
# Android-specific flags.
|
||||
if GetTarget() == 'android':
|
||||
cmd += " -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"
|
||||
cmd += " -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"
|
||||
if GetTargetArch() == 'armv7a':
|
||||
cmd += " -march=armv7-a -Wl,--fix-cortex-a8"
|
||||
cmd += ' -lc -lm'
|
||||
|
|
@ -3827,16 +3831,15 @@ if (PkgSkip("OPENSSL")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOL
|
|||
TargetAdd('build_patch.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('build_patch.exe', opts=OPTS)
|
||||
|
||||
if not PkgSkip("ZLIB"):
|
||||
TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx')
|
||||
TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj'])
|
||||
TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_adler.exe', opts=OPTS)
|
||||
TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx')
|
||||
TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj'])
|
||||
TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_adler.exe', opts=OPTS)
|
||||
|
||||
TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx')
|
||||
TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj'])
|
||||
TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_crc.exe', opts=OPTS)
|
||||
TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx')
|
||||
TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj'])
|
||||
TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_crc.exe', opts=OPTS)
|
||||
|
||||
TargetAdd('check_md5_check_md5.obj', opts=OPTS, input='check_md5.cxx')
|
||||
TargetAdd('check_md5.exe', input=['check_md5_check_md5.obj'])
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ HAS_TARGET_ARCH = False
|
|||
TOOLCHAIN_PREFIX = ""
|
||||
ANDROID_ABI = None
|
||||
SYS_LIB_DIRS = []
|
||||
DEBUG_DEPENDENCIES = False
|
||||
|
||||
# Is the current Python a 32-bit or 64-bit build? There doesn't
|
||||
# appear to be a universal test for this.
|
||||
|
|
@ -652,7 +653,10 @@ def NeedsBuild(files, others):
|
|||
for file in files:
|
||||
dates[file] = GetTimestamp(file)
|
||||
if not os.path.exists(file):
|
||||
if DEBUG_DEPENDENCIES:
|
||||
print("rebuilding %s because it does not exist" % (file))
|
||||
return True
|
||||
|
||||
for file in others:
|
||||
dates[file] = GetTimestamp(file)
|
||||
|
||||
|
|
@ -661,6 +665,16 @@ def NeedsBuild(files, others):
|
|||
cached = BUILTFROMCACHE[key]
|
||||
if cached == dates:
|
||||
return False
|
||||
elif DEBUG_DEPENDENCIES:
|
||||
print("rebuilding %s because:" % (key))
|
||||
for key in frozenset(cached.keys()) | frozenset(dates.keys()):
|
||||
if key not in cached:
|
||||
print(" new dependency: %s" % (key))
|
||||
elif key not in dates:
|
||||
print(" removed dependency: %s" % (key))
|
||||
elif cached[key] != dates[key]:
|
||||
print(" dependency changed: %s" % (key))
|
||||
|
||||
if VERBOSE and frozenset(cached) != frozenset(dates):
|
||||
print("%sWARNING:%s file dependencies changed: %s%s%s" % (GetColor("red"), GetColor(), GetColor("green"), files, GetColor()))
|
||||
|
||||
|
|
@ -1181,40 +1195,44 @@ def GetThirdpartyDir():
|
|||
########################################################################
|
||||
|
||||
def GetOutputDir():
|
||||
return OUTPUTDIR
|
||||
return OUTPUTDIR
|
||||
|
||||
def IsCustomOutputDir():
|
||||
return CUSTOM_OUTPUTDIR
|
||||
return CUSTOM_OUTPUTDIR
|
||||
|
||||
def SetOutputDir(outputdir):
|
||||
global OUTPUTDIR, CUSTOM_OUTPUTDIR
|
||||
OUTPUTDIR=outputdir
|
||||
CUSTOM_OUTPUTDIR=True
|
||||
global OUTPUTDIR, CUSTOM_OUTPUTDIR
|
||||
OUTPUTDIR = outputdir
|
||||
CUSTOM_OUTPUTDIR = True
|
||||
|
||||
def GetOptimize():
|
||||
return int(OPTIMIZE)
|
||||
return int(OPTIMIZE)
|
||||
|
||||
def SetOptimize(optimize):
|
||||
global OPTIMIZE
|
||||
OPTIMIZE=optimize
|
||||
global OPTIMIZE
|
||||
OPTIMIZE = optimize
|
||||
|
||||
def GetVerbose():
|
||||
return VERBOSE
|
||||
return VERBOSE
|
||||
|
||||
def SetVerbose(verbose):
|
||||
global VERBOSE
|
||||
VERBOSE=verbose
|
||||
global VERBOSE
|
||||
VERBOSE = verbose
|
||||
|
||||
def SetDebugDependencies(dd = True):
|
||||
global DEBUG_DEPENDENCIES
|
||||
DEBUG_DEPENDENCIES = dd
|
||||
|
||||
def GetLinkAllStatic():
|
||||
return LINK_ALL_STATIC
|
||||
return LINK_ALL_STATIC
|
||||
|
||||
def SetLinkAllStatic(val = True):
|
||||
global LINK_ALL_STATIC
|
||||
LINK_ALL_STATIC = val
|
||||
global LINK_ALL_STATIC
|
||||
LINK_ALL_STATIC = val
|
||||
|
||||
def UnsetLinkAllStatic():
|
||||
global LINK_ALL_STATIC
|
||||
LINK_ALL_STATIC = False
|
||||
global LINK_ALL_STATIC
|
||||
LINK_ALL_STATIC = False
|
||||
|
||||
########################################################################
|
||||
##
|
||||
|
|
@ -1292,7 +1310,7 @@ def OverrideValue(parameter, value):
|
|||
def PkgConfigHavePkg(pkgname, tool = "pkg-config"):
|
||||
"""Returns a bool whether the pkg-config package is installed."""
|
||||
|
||||
if (sys.platform == "win32" or not LocateBinary(tool)):
|
||||
if (sys.platform == "win32" or CrossCompiling() or not LocateBinary(tool)):
|
||||
return False
|
||||
if (tool == "pkg-config"):
|
||||
handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --modversion " + pkgname)
|
||||
|
|
@ -1307,7 +1325,7 @@ def PkgConfigHavePkg(pkgname, tool = "pkg-config"):
|
|||
def PkgConfigGetLibs(pkgname, tool = "pkg-config"):
|
||||
"""Returns a list of libs for the package, prefixed by -l."""
|
||||
|
||||
if (sys.platform == "win32" or not LocateBinary(tool)):
|
||||
if (sys.platform == "win32" or CrossCompiling() or not LocateBinary(tool)):
|
||||
return []
|
||||
if (tool == "pkg-config"):
|
||||
handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-l " + pkgname)
|
||||
|
|
@ -1338,7 +1356,7 @@ def PkgConfigGetLibs(pkgname, tool = "pkg-config"):
|
|||
def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"):
|
||||
"""Returns a list of includes for the package, NOT prefixed by -I."""
|
||||
|
||||
if (sys.platform == "win32" or not LocateBinary(tool)):
|
||||
if (sys.platform == "win32" or CrossCompiling() or not LocateBinary(tool)):
|
||||
return []
|
||||
if (tool == "pkg-config"):
|
||||
handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags-only-I " + pkgname)
|
||||
|
|
@ -1359,7 +1377,7 @@ def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"):
|
|||
def PkgConfigGetLibDirs(pkgname, tool = "pkg-config"):
|
||||
"""Returns a list of library paths for the package, NOT prefixed by -L."""
|
||||
|
||||
if (sys.platform == "win32" or not LocateBinary(tool)):
|
||||
if (sys.platform == "win32" or CrossCompiling() or not LocateBinary(tool)):
|
||||
return []
|
||||
if (tool == "pkg-config"):
|
||||
handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-L " + pkgname)
|
||||
|
|
@ -1379,7 +1397,7 @@ def PkgConfigGetLibDirs(pkgname, tool = "pkg-config"):
|
|||
def PkgConfigGetDefSymbols(pkgname, tool = "pkg-config"):
|
||||
"""Returns a dictionary of preprocessor definitions."""
|
||||
|
||||
if (sys.platform == "win32" or not LocateBinary(tool)):
|
||||
if (sys.platform == "win32" or CrossCompiling() or not LocateBinary(tool)):
|
||||
return []
|
||||
if (tool == "pkg-config"):
|
||||
handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags " + pkgname)
|
||||
|
|
@ -1411,7 +1429,6 @@ def PkgConfigEnable(opt, pkgname, tool = "pkg-config"):
|
|||
|
||||
def LibraryExists(lib, lpath=[]):
|
||||
""" Returns True if this library was found in the given search path, False otherwise. """
|
||||
|
||||
target = GetTarget()
|
||||
|
||||
for dir in lpath:
|
||||
|
|
@ -1517,6 +1534,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
|||
for d, v in defs.values():
|
||||
DefSymbol(target_pkg, d, v)
|
||||
return
|
||||
|
||||
elif (GetHost() == "darwin" and framework != None):
|
||||
if (os.path.isdir("/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir("/System/Library/Frameworks/%s.framework" % framework) or
|
||||
|
|
@ -1532,6 +1550,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
|||
print("%sERROR:%s Could not locate framework %s, aborting build" % (GetColor("red"), GetColor(), framework))
|
||||
exit()
|
||||
return
|
||||
|
||||
elif (LocateBinary(tool) != None and (tool != "pkg-config" or pkgconfig != None)):
|
||||
if (isinstance(pkgconfig, str) or tool != "pkg-config"):
|
||||
if (PkgConfigHavePkg(pkgconfig, tool)):
|
||||
|
|
@ -1553,6 +1572,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
|||
else:
|
||||
print("%sERROR:%s Could not locate pkg-config package %s, aborting build" % (GetColor("red"), GetColor(), pkgconfig))
|
||||
exit()
|
||||
|
||||
else:
|
||||
# Okay, our pkg-config attempts failed. Let's try locating the libs by ourselves.
|
||||
have_pkg = True
|
||||
|
|
@ -1825,56 +1845,82 @@ def SdkLocateMax():
|
|||
SDK[version+"CS"] = top + subdir
|
||||
|
||||
def SdkLocatePython(force_use_sys_executable = False):
|
||||
if (PkgSkip("PYTHON")==0):
|
||||
if GetTarget() != GetHost():
|
||||
exit('Use --no-python when cross-compiling until support has been added')
|
||||
if PkgSkip("PYTHON"):
|
||||
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
|
||||
return
|
||||
|
||||
if (GetTarget() == 'windows' and not force_use_sys_executable):
|
||||
SDK["PYTHON"] = GetThirdpartyBase()+"/win-python"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHON"] += "-dbg"
|
||||
if (GetTargetArch() == 'x64' and os.path.isdir(SDK["PYTHON"] + "-x64")):
|
||||
SDK["PYTHON"] += "-x64"
|
||||
if CrossCompiling():
|
||||
force_use_sys_executable = False
|
||||
|
||||
SDK["PYTHONEXEC"] = SDK["PYTHON"].replace('/', '\\') + "\\python"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHONEXEC"] += "_d.exe"
|
||||
else:
|
||||
SDK["PYTHONEXEC"] += ".exe"
|
||||
|
||||
if (not os.path.isfile(SDK["PYTHONEXEC"])):
|
||||
exit("Could not find %s!" % SDK["PYTHONEXEC"])
|
||||
|
||||
# Determine which version it is by checking which dll is in the directory.
|
||||
if (GetOptimize() <= 2):
|
||||
py_dlls = glob.glob(SDK["PYTHON"] + "/python[0-9][0-9]_d.dll")
|
||||
else:
|
||||
py_dlls = glob.glob(SDK["PYTHON"] + "/python[0-9][0-9].dll")
|
||||
|
||||
if len(py_dlls) == 0:
|
||||
exit("Could not find the Python dll in %s." % (SDK["PYTHON"]))
|
||||
elif len(py_dlls) > 1:
|
||||
exit("Found multiple Python dlls in %s." % (SDK["PYTHON"]))
|
||||
|
||||
py_dll = os.path.basename(py_dlls[0])
|
||||
SDK["PYTHONVERSION"] = "python" + py_dll[6] + "." + py_dll[7]
|
||||
|
||||
elif (GetTarget() == 'windows'):
|
||||
SDK["PYTHON"] = os.path.dirname(sysconfig.get_python_inc())
|
||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
||||
SDK["PYTHONEXEC"] = sys.executable
|
||||
if (GetTarget() == 'windows' and not force_use_sys_executable):
|
||||
SDK["PYTHON"] = GetThirdpartyBase()+"/win-python"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHON"] += "-dbg"
|
||||
if (GetTargetArch() == 'x64' and os.path.isdir(SDK["PYTHON"] + "-x64")):
|
||||
SDK["PYTHON"] += "-x64"
|
||||
|
||||
SDK["PYTHONEXEC"] = SDK["PYTHON"].replace('/', '\\') + "\\python"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHONEXEC"] += "_d.exe"
|
||||
else:
|
||||
SDK["PYTHON"] = sysconfig.get_python_inc()
|
||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
||||
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
|
||||
SDK["PYTHONEXEC"] += ".exe"
|
||||
|
||||
if GetVerbose():
|
||||
print("Using Python %s build located at %s" % (SDK["PYTHONVERSION"][6:9], SDK["PYTHON"]))
|
||||
if (not os.path.isfile(SDK["PYTHONEXEC"])):
|
||||
exit("Could not find %s!" % SDK["PYTHONEXEC"])
|
||||
|
||||
# Determine which version it is by checking which dll is in the directory.
|
||||
if (GetOptimize() <= 2):
|
||||
py_dlls = glob.glob(SDK["PYTHON"] + "/python[0-9][0-9]_d.dll")
|
||||
else:
|
||||
py_dlls = glob.glob(SDK["PYTHON"] + "/python[0-9][0-9].dll")
|
||||
|
||||
if len(py_dlls) == 0:
|
||||
exit("Could not find the Python dll in %s." % (SDK["PYTHON"]))
|
||||
elif len(py_dlls) > 1:
|
||||
exit("Found multiple Python dlls in %s." % (SDK["PYTHON"]))
|
||||
|
||||
py_dll = os.path.basename(py_dlls[0])
|
||||
SDK["PYTHONVERSION"] = "python" + py_dll[6] + "." + py_dll[7]
|
||||
|
||||
elif CrossCompiling():
|
||||
tp_python = os.path.join(GetThirdpartyDir(), "python")
|
||||
SDK["PYTHON"] = tp_python + "/include"
|
||||
|
||||
if GetTarget() == 'darwin':
|
||||
py_libs = glob.glob(tp_python + "/lib/libpython[0-9].[0-9].dylib")
|
||||
else:
|
||||
py_libs = glob.glob(tp_python + "/lib/libpython[0-9].[0-9].so")
|
||||
|
||||
if len(py_libs) == 0:
|
||||
py_libs = glob.glob(tp_python + "/lib/libpython[0-9].[0-9].a")
|
||||
|
||||
if len(py_libs) == 0:
|
||||
exit("Could not find the Python library in %s." % (tp_python))
|
||||
elif len(py_libs) > 1:
|
||||
exit("Found multiple Python libraries in %s." % (tp_python))
|
||||
|
||||
py_lib = os.path.basename(py_libs[0])
|
||||
SDK["PYTHONVERSION"] = "python" + py_lib[9] + "." + py_lib[11]
|
||||
|
||||
elif (GetTarget() == 'windows'):
|
||||
SDK["PYTHON"] = os.path.dirname(sysconfig.get_python_inc())
|
||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
||||
SDK["PYTHONEXEC"] = sys.executable
|
||||
|
||||
else:
|
||||
SDK["PYTHON"] = sysconfig.get_python_inc()
|
||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
||||
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
|
||||
|
||||
if CrossCompiling():
|
||||
SDK["PYTHONEXEC"] = sys.executable
|
||||
host_version = "python" + sysconfig.get_python_version()
|
||||
if SDK["PYTHONVERSION"] != host_version:
|
||||
exit("Host Python version (%s) must be the same as target Python version (%s)!" % (host_version, SDK["PYTHONVERSION"]))
|
||||
|
||||
if GetVerbose():
|
||||
print("Using Python %s build located at %s" % (SDK["PYTHONVERSION"][6:9], SDK["PYTHON"]))
|
||||
|
||||
def SdkLocateVisualStudio():
|
||||
if (GetHost() != "windows"): return
|
||||
vcdir = GetRegistryKey("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "10.0")
|
||||
|
|
@ -2025,9 +2071,9 @@ def SdkLocateAndroid():
|
|||
SDK["ANDROID_NDK"] = ndk_root
|
||||
|
||||
# Determine the toolchain location.
|
||||
gcc_ver = '4.7'
|
||||
gcc_ver = '4.8'
|
||||
arch = GetTargetArch()
|
||||
if arch == 'armv7' or arch == 'arm':
|
||||
if arch == 'armv7a' or arch == 'arm':
|
||||
arch = 'arm'
|
||||
toolchain = 'arm-linux-androideabi-' + gcc_ver
|
||||
elif arch == 'x86':
|
||||
|
|
@ -2045,8 +2091,10 @@ def SdkLocateAndroid():
|
|||
#IncDirectory("ALWAYS", os.path.join(SDK["SYSROOT"], 'usr', 'include'))
|
||||
|
||||
stdlibc = os.path.join(ndk_root, 'sources', 'cxx-stl', 'gnu-libstdc++', gcc_ver)
|
||||
IncDirectory("ALWAYS", os.path.join(stdlibc, 'include'))
|
||||
IncDirectory("ALWAYS", os.path.join(stdlibc, 'libs', abi, 'include'))
|
||||
SDK["ANDROID_STL"] = stdlibc
|
||||
|
||||
#IncDirectory("ALWAYS", os.path.join(stdlibc, 'include'))
|
||||
#IncDirectory("ALWAYS", os.path.join(stdlibc, 'libs', abi, 'include'))
|
||||
|
||||
stl_lib = os.path.join(stdlibc, 'libs', abi, 'libgnustl_shared.so')
|
||||
LibName("ALWAYS", stl_lib)
|
||||
|
|
@ -2231,7 +2279,9 @@ def SetupBuildEnvironment(compiler):
|
|||
global SYS_LIB_DIRS
|
||||
|
||||
# gcc doesn't add this one, but we do want it:
|
||||
SYS_LIB_DIRS.append('/usr/local/lib')
|
||||
local_lib = SDK.get("SYSROOT", "") + "/usr/local/lib"
|
||||
if os.path.isdir(local_lib):
|
||||
SYS_LIB_DIRS.append(local_lib)
|
||||
|
||||
cmd = GetCXX() + " -print-search-dirs"
|
||||
|
||||
|
|
@ -2253,7 +2303,8 @@ def SetupBuildEnvironment(compiler):
|
|||
returnval = handle.close()
|
||||
if returnval != None and returnval != 0:
|
||||
print("%sWARNING:%s %s failed" % (GetColor("red"), GetColor(), cmd))
|
||||
SYS_LIB_DIRS += ['/usr/lib']
|
||||
SYS_LIB_DIRS += [SDK.get("SYSROOT", "") + "/usr/lib"]
|
||||
|
||||
elif GetVerbose():
|
||||
print("System library search path: %s" % ':'.join(SYS_LIB_DIRS))
|
||||
|
||||
|
|
|
|||
|
|
@ -31,5 +31,5 @@ VirtualFileMountAndroidAsset(AAssetManager *mgr, const string &apk_path) :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE VirtualFileMountAndroidAsset::AssetStream::
|
||||
AssetStream(AAsset *asset) :
|
||||
istream(new AssetStreamBuf(asset)) {
|
||||
istream(new VirtualFileMountAndroidAsset::AssetStreamBuf(asset)) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#if defined(WIN32_VC) || defined(WIN64_VC)
|
||||
#include <winsock2.h> // For gethostname()
|
||||
#include <Iphlpapi.h> // For GetAdaptersAddresses()
|
||||
#elif defined(ANDROID)
|
||||
#include <net/if.h>
|
||||
#else
|
||||
#include <net/if.h>
|
||||
#include <ifaddrs.h>
|
||||
|
|
@ -540,14 +542,14 @@ scan_interfaces() {
|
|||
TextEncoder encoder;
|
||||
encoder.set_wtext(wstring(p->FriendlyName));
|
||||
string friendly_name = encoder.get_text();
|
||||
|
||||
|
||||
Interface iface;
|
||||
iface.set_name(friendly_name);
|
||||
|
||||
if (p->PhysicalAddressLength > 0) {
|
||||
iface.set_mac_address(format_mac_address((const unsigned char *)p->PhysicalAddress, p->PhysicalAddressLength));
|
||||
}
|
||||
|
||||
|
||||
if (p->OperStatus == IfOperStatusUp) {
|
||||
// Prefixes are a linked list, in the order Network IP,
|
||||
// Adapter IP, Broadcast IP (plus more).
|
||||
|
|
@ -584,6 +586,9 @@ scan_interfaces() {
|
|||
PANDA_FREE_ARRAY(addresses);
|
||||
}
|
||||
|
||||
#elif defined(ANDROID)
|
||||
// TODO: implementation using netlink_socket?
|
||||
|
||||
#else // WIN32_VC
|
||||
struct ifaddrs *ifa;
|
||||
if (getifaddrs(&ifa) != 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue