Locate fcollada lib in thirdparty dir correctly

This commit is contained in:
rdb 2013-08-13 17:45:16 +00:00
parent 037d803ae8
commit 6cf523c4de
2 changed files with 16 additions and 7 deletions

View File

@ -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"))

View File

@ -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: