aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azure-pipelines.yml3
-rw-r--r--ci/azure-steps.yml4
-rw-r--r--mesonbuild/compilers/compilers.py6
-rw-r--r--mesonbuild/environment.py68
-rw-r--r--mesonbuild/interpreter.py9
-rwxr-xr-xrun_project_tests.py27
-rwxr-xr-xrun_tests.py6
7 files changed, 60 insertions, 63 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 3ec142e..3d04ffc 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -96,6 +96,7 @@ jobs:
- script: |
%CYGWIN_ROOT%\cygwinsetup.exe -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -g -P ^
cmake,^
+ gcc-fortran,^
gcc-objc++,^
gcc-objc,^
git,^
@@ -177,7 +178,7 @@ jobs:
set BOOST_ROOT=
set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
set PATHEXT=%PATHEXT%;.py
- if %compiler%==clang ( set CC=clang && set CXX=clang++ )
+ if %compiler%==clang ( set CC=clang && set CXX=clang++ && set OBJC=clang && set OBJCXX=clang++ )
%MSYS2_ROOT%\usr\bin\bash -lc "MSYSTEM= python3 run_tests.py --backend=ninja"
env:
CHERE_INVOKING: yes
diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml
index 87ab337..abbed65 100644
--- a/ci/azure-steps.yml
+++ b/ci/azure-steps.yml
@@ -5,8 +5,8 @@ steps:
exit 0
}
- # remove MinGW from path, so we don't find gfortran and try to use it
- $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notlike '*mingw*' }) -join ';'
+ # remove Chocolately, MinGW, Strawberry Perl from path, so we don't find gcc/gfortran and try to use it
+ $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notmatch 'mingw|Strawberry|Chocolatey' }) -join ';'
# download and install prerequisites
function DownloadFile([String] $Source, [String] $Destination) {
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 3459a8f..2239aa8 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -914,6 +914,12 @@ class Compiler:
def get_id(self):
return self.id
+ def get_version_string(self):
+ details = [self.id, self.version]
+ if self.full_version:
+ details += ['"%s"' % (self.full_version)]
+ return '(%s)' % (' '.join(details))
+
def get_language(self):
return self.language
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 2241089..f85decd 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -921,6 +921,8 @@ class Environment:
return GnuObjCCompiler(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines)
if out.startswith('Apple LLVM'):
return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, is_cross, exe_wrap)
+ if 'windows' in out:
+ return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_MINGW, is_cross, exe_wrap)
if out.startswith(('clang', 'OpenBSD clang')):
return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_STANDARD, is_cross, exe_wrap)
self._handle_exceptions(popen_exceptions, compilers)
@@ -948,6 +950,8 @@ class Environment:
return GnuObjCPPCompiler(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines)
if out.startswith('Apple LLVM'):
return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, is_cross, exe_wrap)
+ if 'windows' in out:
+ return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_MINGW, is_cross, exe_wrap)
if out.startswith(('clang', 'OpenBSD clang')):
return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_STANDARD, is_cross, exe_wrap)
self._handle_exceptions(popen_exceptions, compilers)
@@ -1084,65 +1088,43 @@ class Environment:
return compilers.SwiftCompiler(exelist, version)
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
- def compilers_from_language(self, lang: str, need_cross_compiler: bool):
- comp = None
- cross_comp = None
+ def compiler_from_language(self, lang: str, want_cross: bool):
if lang == 'c':
- comp = self.detect_c_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_c_compiler(True)
+ comp = self.detect_c_compiler(want_cross)
elif lang == 'cpp':
- comp = self.detect_cpp_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_cpp_compiler(True)
+ comp = self.detect_cpp_compiler(want_cross)
elif lang == 'objc':
- comp = self.detect_objc_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_objc_compiler(True)
+ comp = self.detect_objc_compiler(want_cross)
elif lang == 'cuda':
- comp = self.detect_cuda_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_cuda_compiler(True)
+ comp = self.detect_cuda_compiler(want_cross)
elif lang == 'objcpp':
- comp = self.detect_objcpp_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_objcpp_compiler(True)
+ comp = self.detect_objcpp_compiler(want_cross)
elif lang == 'java':
- comp = self.detect_java_compiler()
- if need_cross_compiler:
- cross_comp = comp # Java is platform independent.
+ comp = self.detect_java_compiler() # Java is platform independent.
elif lang == 'cs':
- comp = self.detect_cs_compiler()
- if need_cross_compiler:
- cross_comp = comp # C# is platform independent.
+ comp = self.detect_cs_compiler() # C# is platform independent.
elif lang == 'vala':
- comp = self.detect_vala_compiler()
- if need_cross_compiler:
- cross_comp = comp # Vala compiles to platform-independent C
+ comp = self.detect_vala_compiler() # Vala compiles to platform-independent C
elif lang == 'd':
- comp = self.detect_d_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_d_compiler(True)
+ comp = self.detect_d_compiler(want_cross)
elif lang == 'rust':
- comp = self.detect_rust_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_rust_compiler(True)
+ comp = self.detect_rust_compiler(want_cross)
elif lang == 'fortran':
- comp = self.detect_fortran_compiler(False)
- if need_cross_compiler:
- cross_comp = self.detect_fortran_compiler(True)
+ comp = self.detect_fortran_compiler(want_cross)
elif lang == 'swift':
- comp = self.detect_swift_compiler()
- if need_cross_compiler:
+ if want_cross:
raise EnvironmentException('Cross compilation with Swift is not working yet.')
- # cross_comp = self.environment.detect_fortran_compiler(True)
+ comp = self.detect_swift_compiler()
else:
- return None, None
-
- return comp, cross_comp
+ comp = None
+ return comp
def detect_compilers(self, lang: str, need_cross_compiler: bool):
- (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler)
+ comp = self.compiler_from_language(lang, False)
+ if need_cross_compiler:
+ cross_comp = self.compiler_from_language(lang, True)
+ else:
+ cross_comp = None
if comp is not None:
self.coredata.process_new_compilers(lang, comp, cross_comp, self)
return comp, cross_comp
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 8f33935..3a3fb81 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2713,17 +2713,12 @@ external dependencies (including libraries) must go to "dependencies".''')
continue
else:
raise
- if comp.full_version is not None:
- version_string = '(%s %s "%s")' % (comp.id, comp.version, comp.full_version)
- else:
- version_string = '(%s %s)' % (comp.id, comp.version)
mlog.log('Native', comp.get_display_language(), 'compiler:',
- mlog.bold(' '.join(comp.get_exelist())), version_string)
+ mlog.bold(' '.join(comp.get_exelist())), comp.get_version_string())
self.build.ensure_static_linker(comp)
if need_cross_compiler:
- version_string = '(%s %s)' % (cross_comp.id, cross_comp.version)
mlog.log('Cross', cross_comp.get_display_language(), 'compiler:',
- mlog.bold(' '.join(cross_comp.get_exelist())), version_string)
+ mlog.bold(' '.join(cross_comp.get_exelist())), cross_comp.get_version_string())
self.build.ensure_static_cross_linker(cross_comp)
langs = self.coredata.compilers.keys()
diff --git a/run_project_tests.py b/run_project_tests.py
index fdb5f48..c1d42fc 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -27,6 +27,7 @@ import tempfile
from pathlib import Path, PurePath
from mesonbuild import build
from mesonbuild import environment
+from mesonbuild import compilers
from mesonbuild import mesonlib
from mesonbuild import mlog
from mesonbuild import mtest
@@ -564,8 +565,8 @@ def detect_tests_to_run():
('vala', 'vala', backend is not Backend.ninja or not shutil.which('valac')),
('rust', 'rust', backend is not Backend.ninja or not shutil.which('rustc')),
('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
- ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objc_compiler()),
- ('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objcpp_compiler()),
+ ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or not have_objc_compiler()),
+ ('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or not have_objcpp_compiler()),
('fortran', 'fortran', backend is not Backend.ninja or not shutil.which('gfortran')),
('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')),
('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('nvcc')),
@@ -768,11 +769,23 @@ def detect_system_compiler():
with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir:
env = environment.Environment(None, build_dir, get_fake_options('/'))
- try:
- comp = env.detect_c_compiler(env.is_cross_build())
- except:
- raise RuntimeError("Could not find C compiler.")
- system_compiler = comp.get_id()
+ print()
+ for lang in sorted(compilers.all_languages):
+ try:
+ comp = env.compiler_from_language(lang, env.is_cross_build())
+ details = '%s %s' % (' '.join(comp.get_exelist()), comp.get_version_string())
+ except:
+ comp = None
+ details = 'not found'
+ print('%-7s: %s' % (lang, details))
+
+ # note C compiler for later use by platform_fix_name()
+ if lang == 'c':
+ if comp:
+ system_compiler = comp.get_id()
+ else:
+ raise RuntimeError("Could not find C compiler.")
+ print()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Run the test suite of Meson.")
diff --git a/run_tests.py b/run_tests.py
index d72546b..fb3bc28 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -292,7 +292,7 @@ def main():
os.environ.pop('platform')
# Run tests
print(mlog.bold('Running unittests.').get_text(mlog.colorize_console))
- print()
+ print(flush=True)
# Can't pass arguments to unit tests, so set the backend to use in the environment
env = os.environ.copy()
env['MESON_UNIT_TEST_BACKEND'] = backend.name
@@ -325,7 +325,7 @@ def main():
else:
cross_test_args = mesonlib.python_command + ['run_cross_test.py']
print(mlog.bold('Running armhf cross tests.').get_text(mlog.colorize_console))
- print()
+ print(flush=True)
cmd = cross_test_args + ['cross/ubuntu-armhf.txt']
if options.failfast:
cmd += ['--failfast']
@@ -334,7 +334,7 @@ def main():
return returncode
print(mlog.bold('Running mingw-w64 64-bit cross tests.')
.get_text(mlog.colorize_console))
- print()
+ print(flush=True)
cmd = cross_test_args + ['cross/linux-mingw-w64-64bit.txt']
if options.failfast:
cmd += ['--failfast']