|
|
|
@ -52,6 +52,7 @@ from mesonbuild.mesonlib import MachineChoice, Popen_safe, TemporaryDirectoryWin |
|
|
|
|
from mesonbuild.mlog import blue, bold, cyan, green, red, yellow, normal_green |
|
|
|
|
from mesonbuild.coredata import backendlist, version as meson_version |
|
|
|
|
from mesonbuild.mesonmain import setup_vsenv |
|
|
|
|
from mesonbuild.modules.python import PythonExternalProgram |
|
|
|
|
from run_tests import get_fake_options, run_configure, get_meson_script |
|
|
|
|
from run_tests import get_backend_commands, get_backend_args_for_dir, Backend |
|
|
|
|
from run_tests import ensure_backend_detects_changes |
|
|
|
@ -62,6 +63,7 @@ if T.TYPE_CHECKING: |
|
|
|
|
from mesonbuild.environment import Environment |
|
|
|
|
from mesonbuild._typing import Protocol |
|
|
|
|
from concurrent.futures import Future |
|
|
|
|
from mesonbuild.modules.python import PythonIntrospectionDict |
|
|
|
|
|
|
|
|
|
class CompilerArgumentType(Protocol): |
|
|
|
|
cross_file: str |
|
|
|
@ -122,6 +124,9 @@ class TestResult(BaseException): |
|
|
|
|
def fail(self, msg: str) -> None: |
|
|
|
|
self.msg = msg |
|
|
|
|
|
|
|
|
|
python = PythonExternalProgram(sys.executable) |
|
|
|
|
python.sanity() |
|
|
|
|
|
|
|
|
|
class InstalledFile: |
|
|
|
|
def __init__(self, raw: T.Dict[str, str]): |
|
|
|
|
self.path = raw['file'] |
|
|
|
@ -143,6 +148,9 @@ class InstalledFile: |
|
|
|
|
(env.machines.host.is_windows() and compiler in {'pgi', 'dmd', 'ldc'})): |
|
|
|
|
canonical_compiler = 'msvc' |
|
|
|
|
|
|
|
|
|
python_paths = python.info['install_paths'] |
|
|
|
|
python_suffix = python.info['suffix'] |
|
|
|
|
|
|
|
|
|
has_pdb = False |
|
|
|
|
if self.language in {'c', 'cpp'}: |
|
|
|
|
has_pdb = canonical_compiler == 'msvc' |
|
|
|
@ -161,6 +169,15 @@ class InstalledFile: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
# Handle the different types |
|
|
|
|
if self.typ in {'py_implib', 'python_lib', 'python_file'}: |
|
|
|
|
val = p.as_posix() |
|
|
|
|
val = val.replace('@PYTHON_PLATLIB@', python_paths['platlib']) |
|
|
|
|
val = val.replace('@PYTHON_PURELIB@', python_paths['purelib']) |
|
|
|
|
p = Path(val) |
|
|
|
|
if self.typ == 'python_file': |
|
|
|
|
return p |
|
|
|
|
if self.typ == 'python_lib': |
|
|
|
|
return p.with_suffix(python_suffix) |
|
|
|
|
if self.typ in ['file', 'dir']: |
|
|
|
|
return p |
|
|
|
|
elif self.typ == 'shared_lib': |
|
|
|
@ -195,13 +212,15 @@ class InstalledFile: |
|
|
|
|
if self.version: |
|
|
|
|
p = p.with_name('{}-{}'.format(p.name, self.version[0])) |
|
|
|
|
return p.with_suffix('.pdb') if has_pdb else None |
|
|
|
|
elif self.typ == 'implib' or self.typ == 'implibempty': |
|
|
|
|
elif self.typ in {'implib', 'implibempty', 'py_implib'}: |
|
|
|
|
if env.machines.host.is_windows() and canonical_compiler == 'msvc': |
|
|
|
|
# only MSVC doesn't generate empty implibs |
|
|
|
|
if self.typ == 'implibempty' and compiler == 'msvc': |
|
|
|
|
return None |
|
|
|
|
return p.parent / (re.sub(r'^lib', '', p.name) + '.lib') |
|
|
|
|
elif env.machines.host.is_windows() or env.machines.host.is_cygwin(): |
|
|
|
|
if self.typ == 'py_implib': |
|
|
|
|
p = p.with_suffix(python_suffix) |
|
|
|
|
return p.with_suffix('.dll.a') |
|
|
|
|
else: |
|
|
|
|
return None |
|
|
|
|