diff options
author | Paulo Antonio Alvarez <pauloaalvarez@gmail.com> | 2016-11-11 07:26:51 -0200 |
---|---|---|
committer | Paulo Antonio Alvarez <pauloaalvarez@gmail.com> | 2016-11-11 07:26:51 -0200 |
commit | 582e1ede806bb6e540eb9d87ac86c06f88f67d12 (patch) | |
tree | 01d71984f49c1cbe3ce15bb82a015b848b6fa186 | |
parent | e02aaad63286169aebf63109363fed648a185b05 (diff) | |
download | meson-582e1ede806bb6e540eb9d87ac86c06f88f67d12.zip meson-582e1ede806bb6e540eb9d87ac86c06f88f67d12.tar.gz meson-582e1ede806bb6e540eb9d87ac86c06f88f67d12.tar.bz2 |
environment: Static method to get gcc version from compiler defines
The method takes a dictionary with defines names as keys and the defines
values as values. From it, we assemble the gcc version, using 0 as a
default value if the define we want is not defined.
-rw-r--r-- | mesonbuild/environment.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index f7045f4..6d9a3a4 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -331,6 +331,13 @@ class Environment(): if len(rest) == 2: defines[rest[0]] = rest[1] return defines + @staticmethod + def get_gnu_version_from_defines(defines): + dot = '.' + major = defines.get('__GNUC__', '0') + minor = defines.get('__GNUC_MINOR__', '0') + patch = defines.get('__GNUC_PATCHLEVEL__', '0') + return dot.join((major, minor, patch)) @staticmethod def get_gnu_compiler_type(defines): |