makepanda: detect public system libraries when building on Android

This commit is contained in:
rdb 2018-02-11 00:56:25 +01:00
parent b4ad0a69a0
commit c41b694eb3
2 changed files with 19 additions and 8 deletions

View File

@ -821,6 +821,9 @@ if (COMPILER=="GCC"):
SmartPkgEnable("FREETYPE", "freetype2", ("freetype"), ("freetype2", "freetype2/freetype/freetype.h"))
SmartPkgEnable("HARFBUZZ", "harfbuzz", ("harfbuzz"), ("harfbuzz", "harfbuzz/hb-ft.h"))
SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h"), framework = "OpenGL")
SmartPkgEnable("GLES", "glesv1_cm", ("GLESv1_CM"), ("GLES/gl.h"), framework = "OpenGLES")
SmartPkgEnable("GLES2", "glesv2", ("GLESv2"), ("GLES2/gl2.h")) #framework = "OpenGLES"?
SmartPkgEnable("EGL", "egl", ("EGL"), ("EGL/egl.h"))
SmartPkgEnable("NVIDIACG", "", ("Cg"), "Cg/cg.h", framework = "Cg")
SmartPkgEnable("ODE", "", ("ode"), "ode/ode.h", tool = "ode-config")
SmartPkgEnable("OPENAL", "openal", ("openal"), "AL/al.h", framework = "OpenAL")
@ -830,16 +833,10 @@ if (COMPILER=="GCC"):
SmartPkgEnable("VRPN", "", ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
SmartPkgEnable("VORBIS", "vorbisfile",("vorbisfile", "vorbis", "ogg"), ("ogg/ogg.h", "vorbis/vorbisfile.h"))
SmartPkgEnable("OPUS", "opusfile", ("opusfile", "opus", "ogg"), ("ogg/ogg.h", "opus/opusfile.h"))
SmartPkgEnable("OPUS", "opusfile", ("opusfile", "opus", "ogg"), ("ogg/ogg.h", "opus/opusfile.h", "opus"))
SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config")
# On Android, these are system libraries.
if GetHost() != "android":
SmartPkgEnable("GLES", "glesv1_cm", (), ("GLES/gl.h"), framework = "OpenGLES")
SmartPkgEnable("GLES2", "glesv2", (), ("GLES2/gl2.h")) #framework = "OpenGLES"?
SmartPkgEnable("EGL", "egl", (), ("EGL/egl.h"))
if not PkgSkip("FFMPEG"):
if GetTarget() == "darwin":
LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")

View File

@ -59,6 +59,13 @@ else:
# case.
host_64 = (platform.architecture()[0] == '64bit')
# On Android, get a list of all the public system libraries.
ANDROID_SYS_LIBS = []
if os.path.exists("/etc/public.libraries.txt"):
for line in open("/etc/public.libraries.txt", "r"):
line = line.strip()
ANDROID_SYS_LIBS.append(line)
########################################################################
##
## Visual C++ Version (MSVC) and Visual Studio Information Map
@ -1568,7 +1575,14 @@ def LocateLibrary(lib, lpath=[], prefer_static=False):
return None
def SystemLibraryExists(lib):
return LocateLibrary(lib, SYS_LIB_DIRS) is not None
result = LocateLibrary(lib, SYS_LIB_DIRS)
if result is not None:
return True
if GetHost() == "android" and GetTarget() == "android":
return ('lib%s.so' % lib) in ANDROID_SYS_LIBS
return False
def ChooseLib(libs, thirdparty=None):
""" Chooses a library from the parameters, in order of preference. Returns the first if none of them were found. """