summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2023-03-13 09:14:54 -0400
committerEli Schwartz <eschwartz93@gmail.com>2023-03-16 08:27:06 -0400
commita5a7b29a665d1ef82fc606b5ee920e284e3ef1b7 (patch)
tree446030a9ab828091fb17cf53fb97be53b01d9acf /mesonbuild/compilers
parentef5da765af7c5687228ed6e77a19d20bc474c4a4 (diff)
downloadmeson-a5a7b29a665d1ef82fc606b5ee920e284e3ef1b7.tar.gz
prevent lib prefix warning from pkg-config
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py2
-rw-r--r--mesonbuild/compilers/cuda.py2
-rw-r--r--mesonbuild/compilers/fortran.py4
-rw-r--r--mesonbuild/compilers/mixins/clike.py12
-rw-r--r--mesonbuild/compilers/mixins/emscripten.py4
-rw-r--r--mesonbuild/compilers/vala.py2
6 files changed, 13 insertions, 13 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index f17ae223f..a1b389bdc 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -752,7 +752,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
return args.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]]:
raise EnvironmentException(f'Language {self.get_display_language()} does not support library finding.')
def get_library_naming(self, env: 'Environment', libtype: LibType,
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index d008d0c59..9bf263cc3 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -749,7 +749,7 @@ class CudaCompiler(Compiler):
return self._to_host_flags(self.host_compiler.get_std_exe_link_args(), _Phase.LINKER)
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]]:
return ['-l' + libname] # FIXME
def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]:
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 90ca01059..e767dcd97 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -117,9 +117,9 @@ class FortranCompiler(CLikeCompiler, Compiler):
return filename
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 = 'stop; end program'
- 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 has_multi_arguments(self, args: T.List[str], env: 'Environment') -> T.Tuple[bool, bool]:
return self._has_multi_arguments(args, env, 'stop; end program')
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 200f4a2fd..d41c27407 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -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]:
'''
diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py
index 77b1c3386..22b76559b 100644
--- a/mesonbuild/compilers/mixins/emscripten.py
+++ b/mesonbuild/compilers/mixins/emscripten.py
@@ -86,9 +86,9 @@ class EmscriptenMixin(Compiler):
return wrap_js_includes(super().get_dependency_link_args(dep))
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]]:
if not libname.endswith('.js'):
- return super().find_library(libname, env, extra_dirs, libtype)
+ return super().find_library(libname, env, extra_dirs, libtype, lib_prefix_warning)
if os.path.isabs(libname):
if os.path.exists(libname):
return [libname]
diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py
index e56a9fc4b..23b01a3f1 100644
--- a/mesonbuild/compilers/vala.py
+++ b/mesonbuild/compilers/vala.py
@@ -111,7 +111,7 @@ class ValaCompiler(Compiler):
return []
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]]:
if extra_dirs and isinstance(extra_dirs, str):
extra_dirs = [extra_dirs]
# Valac always looks in the default vapi dir, so only search there if