compilers: Fix missing functions in Compiler base class

pull/8859/head
Daniel Mensinger 3 years ago
parent 2263a84d07
commit 9c40b33cf6
  1. 2
      mesonbuild/compilers/__init__.py
  2. 19
      mesonbuild/compilers/compilers.py
  3. 3
      mesonbuild/compilers/mixins/clike.py
  4. 2
      mesonbuild/dependencies/cuda.py
  5. 3
      mesonbuild/dependencies/dev.py
  6. 4
      mesonbuild/dependencies/framework.py
  7. 2
      mesonbuild/dependencies/misc.py
  8. 2
      mesonbuild/dependencies/platform.py

@ -106,7 +106,6 @@ __all__ = [
'VisualStudioLikeCompiler',
'VisualStudioCCompiler',
'VisualStudioCPPCompiler',
'CLikeCompiler',
'CythonCompiler',
]
@ -213,5 +212,4 @@ from .mixins.visualstudio import VisualStudioLikeCompiler
from .mixins.gnu import GnuCompiler, GnuLikeCompiler
from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler
from .mixins.clang import ClangCompiler
from .mixins.clike import CLikeCompiler
from .cython import CythonCompiler

@ -586,6 +586,9 @@ class Compiler(metaclass=abc.ABCMeta):
def get_linker_output_args(self, outputname: str) -> T.List[str]:
return self.linker.get_output_args(outputname)
def get_linker_search_args(self, dirname: str) -> T.List[str]:
return self.linker.get_search_args(dirname)
def get_builtin_define(self, define: str) -> T.Optional[str]:
raise EnvironmentException('%s does not support get_builtin_define.' % self.id)
@ -1051,6 +1054,22 @@ class Compiler(metaclass=abc.ABCMeta):
elf_class: T.Optional[int] = None) -> T.List[str]:
return []
def get_return_value(self,
fname: str,
rtype: str,
prefix: str,
env: 'Environment',
extra_args: T.Optional[T.List[str]],
dependencies: T.Optional[T.List['Dependency']]) -> T.Union[str, int]:
raise EnvironmentException(f'{self.id} does not support get_return_value')
def find_framework(self,
name: str,
env: 'Environment',
extra_dirs: T.List[str],
allow_system: bool = True) -> T.Optional[T.List[str]]:
raise EnvironmentException(f'{self.id} does not support find_framework')
def find_framework_paths(self, env: 'Environment') -> T.List[str]:
raise EnvironmentException(f'{self.id} does not support find_framework_paths')

@ -273,9 +273,6 @@ class CLikeCompiler(Compiler):
def get_pch_name(self, header_name: str) -> str:
return os.path.basename(header_name) + '.' + self.get_pch_suffix()
def get_linker_search_args(self, dirname: str) -> T.List[str]:
return self.linker.get_search_args(dirname)
def get_default_include_dirs(self) -> T.List[str]:
return []

@ -285,8 +285,6 @@ class CudaDependency(ExternalDependency):
def get_link_args(self, language: T.Optional[str] = None, raw: bool = False) -> T.List[str]:
args = []
if self.libdir:
from ..compilers import CLikeCompiler
assert isinstance(self.clib_compiler, CLikeCompiler)
args += self.clib_compiler.get_linker_search_args(self.libdir)
for lib in self.requested_modules:
args += self.lib_modules[lib]

@ -31,7 +31,7 @@ from .configtool import ConfigToolDependency
from .pkgconfig import PkgConfigDependency
from .factory import DependencyFactory
from .misc import threads_factory
from ..compilers import AppleClangCCompiler, AppleClangCPPCompiler, CLikeCompiler
from ..compilers import AppleClangCCompiler, AppleClangCPPCompiler
if T.TYPE_CHECKING:
from ..envconfig import MachineInfo
@ -261,7 +261,6 @@ class LLVMDependencyConfigTool(ConfigToolDependency):
new_args.append(arg.lstrip('-l'))
elif arg.startswith('-LIBPATH:'):
cpp = self.env.coredata.compilers[self.for_machine]['cpp']
assert isinstance(cpp, CLikeCompiler)
new_args.extend(cpp.get_linker_search_args(arg.lstrip('-LIBPATH:')))
else:
new_args.append(arg)

@ -14,7 +14,6 @@
from .base import ExternalDependency, DependencyException, DependencyMethods
from ..mesonlib import MesonException, Version, stringlistify
from ..compilers import CLikeCompiler
from .. import mlog
from pathlib import Path
import typing as T
@ -31,7 +30,7 @@ class ExtraFrameworkDependency(ExternalDependency):
self.name = name
# Full path to framework directory
self.framework_path: T.Optional[str] = None
if not isinstance(self.clib_compiler, CLikeCompiler):
if not self.clib_compiler:
raise DependencyException('No C-like compilers are available')
if self.system_framework_paths is None:
try:
@ -64,7 +63,6 @@ class ExtraFrameworkDependency(ExternalDependency):
# Python.framework. We need to know for sure that the framework was
# found in the path we expect.
allow_system = p in self.system_framework_paths
assert isinstance(self.clib_compiler, CLikeCompiler)
args = self.clib_compiler.find_framework(name, self.env, [p], allow_system)
if args is None:
continue

@ -23,7 +23,6 @@ import typing as T
from .. import mlog
from .. import mesonlib
from ..environment import detect_cpu_family
from ..compilers import CLikeCompiler
from .base import DependencyException, DependencyMethods, ExternalDependency
from .cmake import CMakeDependency
@ -300,7 +299,6 @@ class PcapDependencyConfigTool(ConfigToolDependency):
if not self.env.machines.matches_build_machine(self.for_machine):
return None
assert isinstance(self.clib_compiler, CLikeCompiler)
v = self.clib_compiler.get_return_value('pcap_lib_version', 'string',
'#include <pcap.h>', self.env, [], [self])
v = re.sub(r'libpcap version ', '', str(v))

@ -17,7 +17,6 @@
from .base import ExternalDependency, DependencyException
from ..mesonlib import MesonException
from ..compilers import CLikeCompiler
import typing as T
if T.TYPE_CHECKING:
@ -37,7 +36,6 @@ class AppleFrameworks(ExternalDependency):
self.is_found = True
for f in self.frameworks:
try:
assert isinstance(self.clib_compiler, CLikeCompiler)
args = self.clib_compiler.find_framework(f, env, [])
except MesonException as e:
if 'non-clang' in str(e):

Loading…
Cancel
Save