diff options
author | makise-homura <akemi_homura@kurisa.ch> | 2021-09-29 02:38:19 +0300 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-09-29 20:16:02 -0700 |
commit | 0021a219302101db01daca29017b1125a71f087f (patch) | |
tree | 591ce58388548601d0a20c10f8efa813992927ff /mesonbuild | |
parent | 0ed2d2719bb275a573ead6ca69be46206daea2bc (diff) | |
download | meson-0021a219302101db01daca29017b1125a71f087f.zip meson-0021a219302101db01daca29017b1125a71f087f.tar.gz meson-0021a219302101db01daca29017b1125a71f087f.tar.bz2 |
compilers/elbrus: Deal with C/C++/Fortran stds more correctly
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/c.py | 18 | ||||
-rw-r--r-- | mesonbuild/compilers/cpp.py | 21 | ||||
-rw-r--r-- | mesonbuild/compilers/fortran.py | 11 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/elbrus.py | 7 |
4 files changed, 43 insertions, 14 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index a096442..e56d29e 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -333,14 +333,19 @@ class ElbrusCCompiler(ElbrusCompiler, CCompiler): info, exe_wrapper, linker=linker, full_version=full_version) ElbrusCompiler.__init__(self) - # It does support some various ISO standards and c/gnu 90, 9x, 1x in addition to those which GNU CC supports. def get_options(self) -> 'KeyedOptionDictType': opts = CCompiler.get_options(self) - opts[OptionKey('std', machine=self.for_machine, lang=self.language)].choices = [ - 'none', 'c89', 'c90', 'c9x', 'c99', 'c1x', 'c11', - 'gnu89', 'gnu90', 'gnu9x', 'gnu99', 'gnu1x', 'gnu11', - 'iso9899:2011', 'iso9899:1990', 'iso9899:199409', 'iso9899:1999', - ] + stds = ['c89', 'c9x', 'c99', 'gnu89', 'gnu9x', 'gnu99'] + stds += ['iso9899:1990', 'iso9899:199409', 'iso9899:1999'] + if version_compare(self.version, '>=1.20.00'): + stds += ['c11', 'gnu11'] + if version_compare(self.version, '>=1.21.00') and version_compare(self.version, '<1.22.00'): + stds += ['c90', 'c1x', 'gnu90', 'gnu1x', 'iso9899:2011'] + if version_compare(self.version, '>=1.23.00'): + stds += ['c90', 'c1x', 'gnu90', 'gnu1x', 'iso9899:2011'] + if version_compare(self.version, '>=1.26.00'): + stds += ['c17', 'c18', 'iso9899:2017', 'iso9899:2018', 'gnu17', 'gnu18'] + opts[OptionKey('std', machine=self.for_machine, lang=self.language)].choices = ['none'] + stds return opts # Elbrus C compiler does not have lchmod, but there is only linker warning, not compiler error. @@ -355,6 +360,7 @@ class ElbrusCCompiler(ElbrusCompiler, CCompiler): extra_args=extra_args, dependencies=dependencies) + class IntelCCompiler(IntelGnuLikeCompiler, CCompiler): def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 50417ee..bd893b2 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -462,16 +462,21 @@ class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler): def get_options(self) -> 'KeyedOptionDictType': opts = CPPCompiler.get_options(self) - cpp_stds = [ - 'none', 'c++98', 'c++03', 'c++0x', 'c++11', 'c++14', 'c++1y', - 'gnu++98', 'gnu++03', 'gnu++0x', 'gnu++11', 'gnu++14', 'gnu++1y', - ] - + cpp_stds = ['none', 'c++98', 'gnu++98'] + if version_compare(self.version, '>=1.20.00'): + cpp_stds += ['c++03', 'c++0x', 'c++11', 'gnu++03', 'gnu++0x', 'gnu++11'] + if version_compare(self.version, '>=1.21.00') and version_compare(self.version, '<1.22.00'): + cpp_stds += ['c++14', 'gnu++14', 'c++1y', 'gnu++1y'] + if version_compare(self.version, '>=1.22.00'): + cpp_stds += ['c++14', 'gnu++14'] + if version_compare(self.version, '>=1.23.00'): + cpp_stds += ['c++1y', 'gnu++1y'] if version_compare(self.version, '>=1.24.00'): - cpp_stds += [ 'c++1z', 'c++17', 'gnu++1z', 'gnu++17' ] - + cpp_stds += ['c++1z', 'c++17', 'gnu++1z', 'gnu++17'] if version_compare(self.version, '>=1.25.00'): - cpp_stds += [ 'c++2a', 'gnu++2a' ] + cpp_stds += ['c++2a', 'gnu++2a'] + if version_compare(self.version, '>=1.26.00'): + cpp_stds += ['c++20', 'gnu++20'] key = OptionKey('std', machine=self.for_machine, lang=self.language) opts.update({ diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 9c435cd..24c41d5 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -247,6 +247,17 @@ class ElbrusFortranCompiler(ElbrusCompiler, FortranCompiler): info, exe_wrapper, linker=linker, full_version=full_version) ElbrusCompiler.__init__(self) + def get_options(self) -> 'KeyedOptionDictType': + opts = FortranCompiler.get_options(self) + fortran_stds = ['f95', 'f2003', 'f2008', 'gnu', 'legacy', 'f2008ts'] + key = OptionKey('std', machine=self.for_machine, lang=self.language) + opts[key].choices = ['none'] + fortran_stds + return opts + + def get_module_outdir_args(self, path: str) -> T.List[str]: + return ['-J' + path] + + class G95FortranCompiler(FortranCompiler): LINKER_PREFIX = '-Wl,' diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py index 2a065d5..77c7ecb 100644 --- a/mesonbuild/compilers/mixins/elbrus.py +++ b/mesonbuild/compilers/mixins/elbrus.py @@ -86,5 +86,12 @@ class ElbrusCompiler(GnuLikeCompiler): # Actually it's not supported for now, but probably will be supported in future return 'pch' + def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]: + args = [] + std = options[OptionKey('std', lang=self.language, machine=self.for_machine)] + if std.value != 'none': + args.append('-std=' + std.value) + return args + def openmp_flags(self) -> T.List[str]: return ['-fopenmp'] |