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/compilers/c.py | 12 ++++++------ mesonbuild/compilers/compilers.py | 6 +++++- mesonbuild/compilers/cpp.py | 16 ++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 9c1d1fc..3b931b5 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -42,11 +42,11 @@ from .compilers import ( class CCompiler(Compiler): - def __init__(self, exelist, version, is_cross, exe_wrapper=None): + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs): # If a child ObjC or CPP class has already set it, don't set it ourselves if not hasattr(self, 'language'): self.language = 'c' - super().__init__(exelist, version) + super().__init__(exelist, version, **kwargs) self.id = 'unknown' self.is_cross = is_cross self.can_compile_suffixes.add('h') @@ -798,8 +798,8 @@ class CCompiler(Compiler): class ClangCCompiler(ClangCompiler, CCompiler): - def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None): - CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None, **kwargs): + CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) ClangCompiler.__init__(self, clang_type) default_warn_args = ['-Wall', '-Winvalid-pch'] self.warn_args = {'1': default_warn_args, @@ -830,7 +830,7 @@ class ClangCCompiler(ClangCompiler, CCompiler): class GnuCCompiler(GnuCompiler, CCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None): + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) GnuCompiler.__init__(self, gcc_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] @@ -869,7 +869,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): class IntelCCompiler(IntelCompiler, CCompiler): - def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None): + def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None, **kwargs): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) IntelCompiler.__init__(self, icc_type) self.lang_header = 'c-header' diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 011c222..6941649 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -598,7 +598,7 @@ class Compiler: # compiler or the C library. Currently only used for MSVC. ignore_libs = () - def __init__(self, exelist, version): + def __init__(self, exelist, version, **kwargs): if isinstance(exelist, str): self.exelist = [exelist] elif isinstance(exelist, list): @@ -612,6 +612,10 @@ class Compiler: self.can_compile_suffixes = set(self.file_suffixes) self.default_suffix = self.file_suffixes[0] self.version = version + if 'full_version' in kwargs: + self.full_version = kwargs['full_version'] + else: + self.full_version = None self.base_options = [] def __repr__(self): diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index cb4b055..5e32ace 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -28,11 +28,11 @@ from .compilers import ( ) class CPPCompiler(CCompiler): - def __init__(self, exelist, version, is_cross, exe_wrap): + def __init__(self, exelist, version, is_cross, exe_wrap, **kwargs): # If a child ObjCPP class has already set it, don't set it ourselves if not hasattr(self, 'language'): self.language = 'cpp' - CCompiler.__init__(self, exelist, version, is_cross, exe_wrap) + CCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) def get_display_language(self): return 'C++' @@ -66,8 +66,8 @@ class CPPCompiler(CCompiler): class ClangCPPCompiler(ClangCompiler, CPPCompiler): - def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): - CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None, **kwargs): + CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) ClangCompiler.__init__(self, cltype) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, @@ -92,8 +92,8 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): class GnuCPPCompiler(GnuCompiler, CPPCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrap, defines): - CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap) + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrap, defines, **kwargs): + CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) GnuCompiler.__init__(self, gcc_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, @@ -133,8 +133,8 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): class IntelCPPCompiler(IntelCompiler, CPPCompiler): - def __init__(self, exelist, version, icc_type, is_cross, exe_wrap): - CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap) + def __init__(self, exelist, version, icc_type, is_cross, exe_wrap, **kwargs): + CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) IntelCompiler.__init__(self, icc_type) self.lang_header = 'c++-header' default_warn_args = ['-Wall', '-w3', '-diag-disable:remark', -- 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/compilers/cs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index b8a4d13..dd7a433 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -19,9 +19,9 @@ from ..mesonlib import EnvironmentException from .compilers import Compiler, mono_buildtype_args class MonoCompiler(Compiler): - def __init__(self, exelist, version): + def __init__(self, exelist, version, **kwargs): self.language = 'cs' - super().__init__(exelist, version) + super().__init__(exelist, version, **kwargs) self.id = 'mono' self.monorunner = 'mono' -- 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/compilers/d.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 9739f28..9681a9f 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -42,9 +42,9 @@ d_feature_args = {'gcc': {'unittest': '-funittest', } class DCompiler(Compiler): - def __init__(self, exelist, version, is_cross): + def __init__(self, exelist, version, is_cross, **kwargs): self.language = 'd' - super().__init__(exelist, version) + super().__init__(exelist, version, **kwargs) self.id = 'unknown' self.is_cross = is_cross @@ -224,8 +224,8 @@ class DCompiler(Compiler): class GnuDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross): - DCompiler.__init__(self, exelist, version, is_cross) + def __init__(self, exelist, version, is_cross, **kwargs): + DCompiler.__init__(self, exelist, version, is_cross, **kwargs) self.id = 'gcc' default_warn_args = ['-Wall', '-Wdeprecated'] self.warn_args = {'1': default_warn_args, @@ -267,8 +267,8 @@ class GnuDCompiler(DCompiler): class LLVMDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross): - DCompiler.__init__(self, exelist, version, is_cross) + def __init__(self, exelist, version, is_cross, **kwargs): + DCompiler.__init__(self, exelist, version, is_cross, **kwargs) self.id = 'llvm' self.base_options = ['b_coverage', 'b_colorout'] @@ -321,8 +321,8 @@ class LLVMDCompiler(DCompiler): class DmdDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross): - DCompiler.__init__(self, exelist, version, is_cross) + def __init__(self, exelist, version, is_cross, **kwargs): + DCompiler.__init__(self, exelist, version, is_cross, **kwargs) self.id = 'dmd' self.base_options = ['b_coverage', 'b_colorout'] -- 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/compilers/fortran.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 2957a7c..5101676 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -31,9 +31,9 @@ from .compilers import ( ) class FortranCompiler(Compiler): - def __init__(self, exelist, version, is_cross, exe_wrapper=None): + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs): self.language = 'fortran' - super().__init__(exelist, version) + super().__init__(exelist, version, **kwargs) self.is_cross = is_cross self.exe_wrapper = exe_wrapper # Not really correct but I don't have Fortran compilers to test with. Sorry. @@ -149,8 +149,8 @@ end program prog class GnuFortranCompiler(FortranCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwargs) self.gcc_type = gcc_type self.defines = defines or {} self.id = 'gcc' @@ -181,8 +181,8 @@ class GnuFortranCompiler(FortranCompiler): class G95FortranCompiler(FortranCompiler): - def __init__(self, exelist, version, is_cross, exe_wrapper=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) self.id = 'g95' def get_module_outdir_args(self, path): @@ -205,8 +205,8 @@ class G95FortranCompiler(FortranCompiler): class SunFortranCompiler(FortranCompiler): - def __init__(self, exelist, version, is_cross, exe_wrapper=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) self.id = 'sun' def get_dependency_gen_args(self, outtarget, outfile): @@ -228,9 +228,9 @@ class SunFortranCompiler(FortranCompiler): class IntelFortranCompiler(IntelCompiler, FortranCompiler): std_warn_args = ['-warn', 'all'] - def __init__(self, exelist, version, is_cross, exe_wrapper=None): + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): self.file_suffixes = ('f90', 'f', 'for', 'ftn', 'fpp') - FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwags) # FIXME: Add support for OS X and Windows in detect_fortran_compiler so # we are sent the type of compiler IntelCompiler.__init__(self, ICC_STANDARD) @@ -246,8 +246,8 @@ class IntelFortranCompiler(IntelCompiler, FortranCompiler): class PathScaleFortranCompiler(FortranCompiler): std_warn_args = ['-fullwarn'] - def __init__(self, exelist, version, is_cross, exe_wrapper=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) self.id = 'pathscale' def get_module_outdir_args(self, path): @@ -259,8 +259,8 @@ class PathScaleFortranCompiler(FortranCompiler): class PGIFortranCompiler(FortranCompiler): std_warn_args = ['-Minform=inform'] - def __init__(self, exelist, version, is_cross, exe_wrapper=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) self.id = 'pgi' def get_module_incdir_args(self): @@ -279,8 +279,8 @@ class PGIFortranCompiler(FortranCompiler): class Open64FortranCompiler(FortranCompiler): std_warn_args = ['-fullwarn'] - def __init__(self, exelist, version, is_cross, exe_wrapper=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) self.id = 'open64' def get_module_outdir_args(self, path): @@ -293,8 +293,8 @@ class Open64FortranCompiler(FortranCompiler): class NAGFortranCompiler(FortranCompiler): std_warn_args = [] - def __init__(self, exelist, version, is_cross, exe_wrapper=None): - super().__init__(exelist, version, is_cross, exe_wrapper=None) + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): + super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) self.id = 'nagfor' def get_module_outdir_args(self, path): -- cgit v1.1 From c772841af700676151e5e9616b7896e9a04f8e65 Mon Sep 17 00:00:00 2001 From: Christoph Behle Date: Tue, 19 Dec 2017 19:58:19 +0100 Subject: Fix: More information for C compilers. Add full version to gnu and icc C compiler. --- mesonbuild/compilers/c.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 3b931b5..c1982d6 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -831,7 +831,7 @@ class ClangCCompiler(ClangCompiler, CCompiler): class GnuCCompiler(GnuCompiler, CCompiler): def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): - CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) GnuCompiler.__init__(self, gcc_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] self.warn_args = {'1': default_warn_args, @@ -870,7 +870,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): class IntelCCompiler(IntelCompiler, CCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None, **kwargs): - CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) IntelCompiler.__init__(self, icc_type) self.lang_header = 'c-header' default_warn_args = ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages'] -- cgit v1.1