|
|
|
@ -1121,7 +1121,7 @@ class CLikeCompiler(Compiler): |
|
|
|
|
''' |
|
|
|
|
return self.sizeof('void *', '', env)[0] == 8 |
|
|
|
|
|
|
|
|
|
def _find_library_real(self, libname: str, env: 'Environment', extra_dirs: T.List[str], code: str, libtype: LibType) -> T.Optional[T.List[str]]: |
|
|
|
|
def _find_library_real(self, libname: str, env: 'Environment', extra_dirs: T.List[str], code: str, libtype: LibType, lib_prefix_warning: bool) -> T.Optional[T.List[str]]: |
|
|
|
|
# First try if we can just add the library as -l. |
|
|
|
|
# Gcc + co seem to prefer builtin lib dirs to -L dirs. |
|
|
|
|
# Only try to find std libs if no extra dirs specified. |
|
|
|
@ -1160,13 +1160,13 @@ class CLikeCompiler(Compiler): |
|
|
|
|
trial = self._get_file_from_list(env, trials) |
|
|
|
|
if not trial: |
|
|
|
|
continue |
|
|
|
|
if libname.startswith('lib') and trial.name.startswith(libname): |
|
|
|
|
if libname.startswith('lib') and trial.name.startswith(libname) and lib_prefix_warning: |
|
|
|
|
mlog.warning(f'find_library({libname!r}) starting in "lib" only works by accident and is not portable') |
|
|
|
|
return [trial.as_posix()] |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
def _find_library_impl(self, libname: str, env: 'Environment', extra_dirs: T.List[str], |
|
|
|
|
code: str, libtype: LibType) -> T.Optional[T.List[str]]: |
|
|
|
|
code: str, libtype: LibType, lib_prefix_warning: bool) -> T.Optional[T.List[str]]: |
|
|
|
|
# These libraries are either built-in or invalid |
|
|
|
|
if libname in self.ignore_libs: |
|
|
|
|
return [] |
|
|
|
@ -1174,7 +1174,7 @@ class CLikeCompiler(Compiler): |
|
|
|
|
extra_dirs = [extra_dirs] |
|
|
|
|
key = (tuple(self.exelist), libname, tuple(extra_dirs), code, libtype) |
|
|
|
|
if key not in self.find_library_cache: |
|
|
|
|
value = self._find_library_real(libname, env, extra_dirs, code, libtype) |
|
|
|
|
value = self._find_library_real(libname, env, extra_dirs, code, libtype, lib_prefix_warning) |
|
|
|
|
self.find_library_cache[key] = value |
|
|
|
|
else: |
|
|
|
|
value = self.find_library_cache[key] |
|
|
|
@ -1183,9 +1183,9 @@ class CLikeCompiler(Compiler): |
|
|
|
|
return value.copy() |
|
|
|
|
|
|
|
|
|
def find_library(self, libname: str, env: 'Environment', extra_dirs: T.List[str], |
|
|
|
|
libtype: LibType = LibType.PREFER_SHARED) -> T.Optional[T.List[str]]: |
|
|
|
|
libtype: LibType = LibType.PREFER_SHARED, lib_prefix_warning: bool = True) -> T.Optional[T.List[str]]: |
|
|
|
|
code = 'int main(void) { return 0; }\n' |
|
|
|
|
return self._find_library_impl(libname, env, extra_dirs, code, libtype) |
|
|
|
|
return self._find_library_impl(libname, env, extra_dirs, code, libtype, lib_prefix_warning) |
|
|
|
|
|
|
|
|
|
def find_framework_paths(self, env: 'Environment') -> T.List[str]: |
|
|
|
|
''' |
|
|
|
|