From c6acf75617a8c200f8c8cbe11c3342228842be05 Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Sat, 16 Dec 2017 14:52:08 +0100 Subject: More version information for compilers. See issue #2762 Adds full_version to class Compiler. If set full_version will be printed additionally. Added support for CCompiler and CPPCompiler Added support for gcc/g++, clang/clang++, icc. --- mesonbuild/environment.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mesonbuild/environment.py') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 0cb1450..1d1cb82 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -496,6 +496,7 @@ class Environment: popen_exceptions[' '.join(compiler + [arg])] = e continue version = search_version(out) + full_version = out.split('\n', 1)[0] if 'Free Software Foundation' in out: defines = self.get_gnu_compiler_defines(compiler) if not defines: @@ -504,7 +505,7 @@ class Environment: gtype = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler - return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines) + return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version ) if 'clang' in out: if 'Apple' in out or mesonlib.for_darwin(want_cross, self): cltype = CLANG_OSX @@ -513,7 +514,7 @@ class Environment: else: cltype = CLANG_STANDARD cls = ClangCCompiler if lang == 'c' else ClangCPPCompiler - return cls(ccache + compiler, version, cltype, is_cross, exe_wrap) + return cls(ccache + compiler, version, cltype, is_cross, exe_wrap, full_version=full_version) if 'Microsoft' in out or 'Microsoft' in err: # Latest versions of Visual Studio print version # number to stderr but earlier ones print version @@ -532,7 +533,7 @@ class Environment: # TODO: add microsoft add check OSX inteltype = ICC_STANDARD cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler - return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap) + return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap, full_version=full_version) self._handle_exceptions(popen_exceptions, compilers) def detect_c_compiler(self, want_cross): -- cgit v1.1 From 783263b9f4626f7267264e507d55e9fb2ba66943 Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Sat, 16 Dec 2017 15:05:09 +0100 Subject: More version information for C# --- mesonbuild/environment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mesonbuild/environment.py') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 1d1cb82..8597cf0 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -666,8 +666,9 @@ class Environment: except OSError: raise EnvironmentException('Could not execute C# compiler "%s"' % ' '.join(exelist)) version = search_version(out) + full_version = out.split('\n', 1)[0] if 'Mono' in out: - return MonoCompiler(exelist, version) + return MonoCompiler(exelist, version, full_version=full_version) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_vala_compiler(self): -- cgit v1.1 From 5b83894b77d4946b66eea18f5bb44e53127869f5 Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Sat, 16 Dec 2017 15:07:08 +0100 Subject: More version information for D --- mesonbuild/environment.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mesonbuild/environment.py') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 8597cf0..ea4a54e 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -723,12 +723,13 @@ class Environment: except OSError: raise EnvironmentException('Could not execute D compiler "%s"' % ' '.join(exelist)) version = search_version(out) + full_version = out.split('\n', 1)[0] if 'LLVM D compiler' in out: - return compilers.LLVMDCompiler(exelist, version, is_cross) + return compilers.LLVMDCompiler(exelist, version, is_cross, full_version=full_version) elif 'gdc' in out: - return compilers.GnuDCompiler(exelist, version, is_cross) + return compilers.GnuDCompiler(exelist, version, is_cross, full_version=full_version) elif 'Digital Mars' in out: - return compilers.DmdDCompiler(exelist, version, is_cross) + return compilers.DmdDCompiler(exelist, version, is_cross, full_version=full_version) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_swift_compiler(self): -- cgit v1.1 From 1f3b41021d22b90e92e762a9b0230968957f5ba6 Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Sat, 16 Dec 2017 15:38:31 +0100 Subject: More version information for Fortran. --- mesonbuild/environment.py | 1 + 1 file changed, 1 insertion(+) (limited to 'mesonbuild/environment.py') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index ea4a54e..af660e9 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -556,6 +556,7 @@ class Environment: continue version = search_version(out) + full_version = out.split('\n', 1)[0] if 'GNU Fortran' in out: defines = self.get_gnu_compiler_defines(compiler) -- cgit v1.1 From 7bd30c522bf720fa51995d93277cb1946444afdd Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Sat, 16 Dec 2017 16:12:46 +0100 Subject: Fix flake8 issues. --- mesonbuild/environment.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'mesonbuild/environment.py') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index af660e9..858d31d 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -505,7 +505,7 @@ class Environment: gtype = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler - return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version ) + return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) if 'clang' in out: if 'Apple' in out or mesonlib.for_darwin(want_cross, self): cltype = CLANG_OSX @@ -565,29 +565,29 @@ class Environment: continue gtype = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) - return GnuFortranCompiler(compiler, version, gtype, is_cross, exe_wrap, defines) + return GnuFortranCompiler(compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) if 'G95' in out: - return G95FortranCompiler(compiler, version, is_cross, exe_wrap) + return G95FortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) if 'Sun Fortran' in err: version = search_version(err) - return SunFortranCompiler(compiler, version, is_cross, exe_wrap) + return SunFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) if 'ifort (IFORT)' in out: - return IntelFortranCompiler(compiler, version, is_cross, exe_wrap) + return IntelFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) if 'PathScale EKOPath(tm)' in err: - return PathScaleFortranCompiler(compiler, version, is_cross, exe_wrap) + return PathScaleFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) if 'PGI Compilers' in out: - return PGIFortranCompiler(compiler, version, is_cross, exe_wrap) + return PGIFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) if 'Open64 Compiler Suite' in err: - return Open64FortranCompiler(compiler, version, is_cross, exe_wrap) + return Open64FortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) if 'NAG Fortran' in err: - return NAGFortranCompiler(compiler, version, is_cross, exe_wrap) + return NAGFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) self._handle_exceptions(popen_exceptions, compilers) def get_scratch_dir(self): -- cgit v1.1