diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 0d71babf99..db31e57a59 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -643,7 +643,7 @@ if (COMPILER=="GCC"): if (not RUNTIME): SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS') SmartPkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h") - SmartPkgEnable("FCOLLADA", "", ChooseLib(*fcollada_libs), ("FCollada", "FCollada.h")) + SmartPkgEnable("FCOLLADA", "", ChooseLib(fcollada_libs, "FCOLLADA"), ("FCollada", "FCollada.h")) SmartPkgEnable("FFMPEG", ffmpeg_libs, ffmpeg_libs, ffmpeg_libs) SmartPkgEnable("SWSCALE", "libswscale", "libswscale", ("libswscale", "libswscale/swscale.h"), target_pkg = "FFMPEG") SmartPkgEnable("FFTW", "", ("fftw", "rfftw"), ("fftw.h", "rfftw.h")) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index cc6f44e157..d08039591b 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1398,12 +1398,12 @@ def PkgConfigEnable(opt, pkgname, tool = "pkg-config"): for i, j in PkgConfigGetDefSymbols(pkgname, tool).items(): DefSymbol(opt, i, j) -def SystemLibraryExists(lib): - """ Returns True if this library was found in the system library search path, False otherwise. """ +def LibraryExists(lib, lpath=[]): + """ Returns True if this library was found in the given search path, False otherwise. """ target = GetTarget() - for dir in SYS_LIB_DIRS: + for dir in lpath: if target == 'darwin' and os.path.isfile(os.path.join(dir, 'lib%s.dylib' % lib)): return True elif target != 'darwin' and os.path.isfile(os.path.join(dir, 'lib%s.so' % lib)): @@ -1413,13 +1413,22 @@ def SystemLibraryExists(lib): return False -def ChooseLib(*libs): - # Chooses a library from the parameters, in order of preference. Returns the first if none of them were found. +def SystemLibraryExists(lib): + return LibraryExists(lib, SYS_LIB_DIRS) + +def ChooseLib(libs, thirdparty=None): + """ Chooses a library from the parameters, in order of preference. Returns the first if none of them were found. """ + + lpath = [] + if thirdparty is not None: + lpath.append(os.path.join(GetThirdpartyDir(), thirdparty.lower(), "lib")) + lpath += SYS_LIB_DIRS + for l in libs: libname = l if l.startswith("lib"): libname = l[3:] - if SystemLibraryExists(libname): + if LibraryExists(libname, lpath): return libname if len(libs) > 0: