def detect(self): trial_dirs = mesonlib.get_library_dirs() glib_found = False gmain_found = False for d in trial_dirs: if os.path.isfile(os.path.join(d, self.libname)): glib_found = True if os.path.isfile(os.path.join(d, self.libmain_name)): gmain_found = True if glib_found and gmain_found: self.is_found = True self.compile_args = [] self.link_args = ['-lgtest'] if self.main: self.link_args.append('-lgtest_main') self.sources = [] mlog.log('Dependency GTest found:', mlog.green('YES'), '(prebuilt)') elif os.path.exists(self.src_dir): self.is_found = True self.compile_args = ['-I' + self.src_include_dir] self.link_args = [] if self.main: self.sources = [self.all_src, self.main_src] else: self.sources = [self.all_src] mlog.log('Dependency GTest found:', mlog.green('YES'), '(building self)') else: mlog.log('Dependency GTest found:', mlog.red('NO')) self.is_found = False return self.is_found
def detect(self): trial_dirs = mesonlib.get_library_dirs() glib_found = False gmain_found = False for d in trial_dirs: if os.path.isfile(os.path.join(d, self.libname)): glib_found = True if os.path.isfile(os.path.join(d, self.libmain_name)): gmain_found = True if glib_found and gmain_found: self.is_found = True self.compile_args = [] self.link_args = ["-lgtest"] if self.main: self.link_args.append("-lgtest_main") self.sources = [] mlog.log("Dependency GTest found:", mlog.green("YES"), "(prebuilt)") elif os.path.exists(self.src_dir): self.is_found = True self.compile_args = ["-I" + self.src_include_dir] self.link_args = [] if self.main: self.sources = [self.all_src, self.main_src] else: self.sources = [self.all_src] mlog.log("Dependency GTest found:", mlog.green("YES"), "(building self)") else: mlog.log("Dependency GTest found:", mlog.red("NO")) self.is_found = False return self.is_found
def find_library(self, libname, dirs): if dirs is None: dirs = mesonlib.get_library_dirs() suffixes = [self.get_shared_lib_suffix(), self.get_static_lib_suffix()] prefix = self.get_shared_lib_prefix() for d in dirs: for suffix in suffixes: trial = os.path.join(d, prefix + libname + '.' + suffix) if os.path.isfile(trial): return trial
def detect_lib_modules(self): globber = 'libboost_*.so' # FIXME, make platform independent. if self.boost_root is None: libdirs = mesonlib.get_library_dirs() else: libdirs = [os.path.join(self.boost_root, 'lib')] for libdir in libdirs: for entry in glob.glob(os.path.join(libdir, globber)): lib = os.path.basename(entry) name = lib.split('.')[0].split('_', 1)[-1] # I'm not 100% sure what to do here. Some distros # have modules such as thread only as -mt versions. if entry.endswith('-mt.so'): self.lib_modules_mt[name] = True else: self.lib_modules[name] = True
def detect_lib_modules(self): globber = "libboost_*.so" # FIXME, make platform independent. if self.boost_root is None: libdirs = mesonlib.get_library_dirs() else: libdirs = [os.path.join(self.boost_root, "lib")] for libdir in libdirs: for entry in glob.glob(os.path.join(libdir, globber)): lib = os.path.basename(entry) name = lib.split(".")[0].split("_", 1)[-1] # I'm not 100% sure what to do here. Some distros # have modules such as thread only as -mt versions. if entry.endswith("-mt.so"): self.lib_modules_mt[name] = True else: self.lib_modules[name] = True
def __init__(self, environment, kwargs): Dependency.__init__(self) # GMock may be a library or just source. # Work with both. self.name = 'gmock' self.libname = 'libgmock.so' trial_dirs = mesonlib.get_library_dirs() gmock_found = False for d in trial_dirs: if os.path.isfile(os.path.join(d, self.libname)): gmock_found = True if gmock_found: self.is_found = True self.compile_args = [] self.link_args = ['-lgmock'] self.sources = [] mlog.log('Dependency GMock found:', mlog.green('YES'), '(prebuilt)') return for d in ['/usr/src/gmock/src', '/usr/src/gmock']: if os.path.exists(d): self.is_found = True # Yes, we need both because there are multiple # versions of gmock that do different things. self.compile_args = [ '-I/usr/src/gmock', '-I/usr/src/gmock/src' ] self.link_args = [] all_src = mesonlib.File.from_absolute_file( os.path.join(d, 'gmock-all.cc')) main_src = mesonlib.File.from_absolute_file( os.path.join(d, 'gmock_main.cc')) if kwargs.get('main', False): self.sources = [all_src, main_src] else: self.sources = [all_src] mlog.log('Dependency GMock found:', mlog.green('YES'), '(building self)') return mlog.log('Dependency GMock found:', mlog.red('NO')) self.is_found = False
def detect_lib_modules_nix(self): libsuffix = None if mesonlib.is_osx(): libsuffix = 'dylib' else: libsuffix = 'so' globber = 'libboost_*.{}'.format(libsuffix) if self.boost_root is None: libdirs = mesonlib.get_library_dirs() else: libdirs = [os.path.join(self.boost_root, 'lib')] for libdir in libdirs: for entry in glob.glob(os.path.join(libdir, globber)): lib = os.path.basename(entry) name = lib.split('.')[0].split('_', 1)[-1] # I'm not 100% sure what to do here. Some distros # have modules such as thread only as -mt versions. if entry.endswith('-mt.so'): self.lib_modules_mt[name] = True else: self.lib_modules[name] = True
def __init__(self, environment, kwargs): Dependency.__init__(self) # GMock may be a library or just source. # Work with both. self.name = "gmock" self.libname = "libgmock.so" trial_dirs = mesonlib.get_library_dirs() gmock_found = False for d in trial_dirs: if os.path.isfile(os.path.join(d, self.libname)): gmock_found = True if gmock_found: self.is_found = True self.compile_args = [] self.link_args = ["-lgmock"] self.sources = [] mlog.log("Dependency GMock found:", mlog.green("YES"), "(prebuilt)") return for d in ["/usr/src/gmock/src", "/usr/src/gmock"]: if os.path.exists(d): self.is_found = True # Yes, we need both because there are multiple # versions of gmock that do different things. self.compile_args = ["-I/usr/src/gmock", "-I/usr/src/gmock/src"] self.link_args = [] all_src = mesonlib.File.from_absolute_file(os.path.join(d, "gmock-all.cc")) main_src = mesonlib.File.from_absolute_file(os.path.join(d, "gmock_main.cc")) if kwargs.get("main", False): self.sources = [all_src, main_src] else: self.sources = [all_src] mlog.log("Dependency GMock found:", mlog.green("YES"), "(building self)") return mlog.log("Dependency GMock found:", mlog.red("NO")) self.is_found = False
def __init__(self, environment, kwargs): Dependency.__init__(self) # GMock may be a library or just source. # Work with both. self.name = 'gmock' self.libname = 'libgmock.so' trial_dirs = mesonlib.get_library_dirs() gmock_found = False for d in trial_dirs: if os.path.isfile(os.path.join(d, self.libname)): gmock_found = True if gmock_found: self.is_found = True self.compile_args = [] self.link_args = ['-lgmock'] self.sources = [] mlog.log('Dependency GMock found:', mlog.green('YES'), '(prebuilt)') return for d in ['/usr/src/gmock/src', '/usr/src/gmock']: if os.path.exists(d): self.is_found = True # Yes, we need both because there are multiple # versions of gmock that do different things. self.compile_args = ['-I/usr/src/gmock', '-I/usr/src/gmock/src'] self.link_args = [] all_src = mesonlib.File.from_absolute_file(os.path.join(d, 'gmock-all.cc')) main_src = mesonlib.File.from_absolute_file(os.path.join(d, 'gmock_main.cc')) if kwargs.get('main', False): self.sources = [all_src, main_src] else: self.sources = [all_src] mlog.log('Dependency GMock found:', mlog.green('YES'), '(building self)') return mlog.log('Dependency GMock found:', mlog.red('NO')) self.is_found = False