Can specify custom search directories in find_library.

pull/121/head
Jussi Pakkanen 10 years ago
parent 07825428cf
commit d83de3ee56
  1. 5
      environment.py
  2. 13
      interpreter.py

@ -547,8 +547,9 @@ class Environment():
def get_datadir(self): def get_datadir(self):
return self.coredata.datadir return self.coredata.datadir
def find_library(self, libname): def find_library(self, libname, dirs):
dirs = mesonlib.get_library_dirs() if dirs is None:
dirs = mesonlib.get_library_dirs()
suffixes = [self.get_shared_lib_suffix(), self.get_static_lib_suffix()] suffixes = [self.get_shared_lib_suffix(), self.get_static_lib_suffix()]
prefix = self.get_shared_lib_prefix() prefix = self.get_shared_lib_prefix()
for d in dirs: for d in dirs:

@ -1228,7 +1228,18 @@ class Interpreter():
if libname in self.coredata.ext_libs and\ if libname in self.coredata.ext_libs and\
self.coredata.ext_libs[libname].found(): self.coredata.ext_libs[libname].found():
return ExternalLibraryHolder(self.coredata.ext_libs[libname]) return ExternalLibraryHolder(self.coredata.ext_libs[libname])
result = self.environment.find_library(libname) if 'dirs' in kwargs:
search_dirs = kwargs['dirs']
if not isinstance(search_dirs, list):
search_dirs = [search_dirs]
for i in search_dirs:
if not isinstance(i, str):
raise InvalidCode('Directory entry is not a string.')
if not os.path.isabs(i):
raise InvalidCode('Search directory %s is not an absolute path.' % i)
else:
search_dirs = None
result = self.environment.find_library(libname, search_dirs)
extlib = dependencies.ExternalLibrary(libname, result) extlib = dependencies.ExternalLibrary(libname, result)
libobj = ExternalLibraryHolder(extlib) libobj = ExternalLibraryHolder(extlib)
self.coredata.ext_libs[libname] = extlib self.coredata.ext_libs[libname] = extlib

Loading…
Cancel
Save