diff options
author | John Ericson <git@JohnEricson.me> | 2018-10-05 11:40:45 -0400 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2018-10-05 23:31:16 -0400 |
commit | 68d0adf4d268e15a35a5ce706f7a31b127a7fba7 (patch) | |
tree | c6b44edbfd15b9c10a6eca46b5a863fa3a3efcec /mesonbuild/environment.py | |
parent | 0b1fb51b66f9cccfbd645534434df65270fba606 (diff) | |
download | meson-68d0adf4d268e15a35a5ce706f7a31b127a7fba7.zip meson-68d0adf4d268e15a35a5ce706f7a31b127a7fba7.tar.gz meson-68d0adf4d268e15a35a5ce706f7a31b127a7fba7.tar.bz2 |
Rewrite `for_*` machine checks in terms of MachineInfo and phase out
It's much better to directly query the machine in question rather than
do some roundabout "is_cross" thing. This is the first step for much
natve- and cross- code path deduplication.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 9e010d7..2106c5d 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -1161,6 +1161,68 @@ class MachineInfo: literal['cpu'], literal['endian']) + def is_windows(self): + """ + Machine is windows? + """ + return self.system == 'windows' + + def is_cygwin(self): + """ + Machine is cygwin? + """ + return self.system == 'cygwin' + + def is_linux(self): + """ + Machine is linux? + """ + return self.system == 'linux' + + def is_darwin(self): + """ + Machine is Darwin (iOS/OS X)? + """ + return self.system in ('darwin', 'ios') + + def is_android(self): + """ + Machine is Android? + """ + return self.system == 'android' + + def is_haiku(self): + """ + Machine is Haiku? + """ + return self.system == 'haiku' + + def is_openbsd(self): + """ + Machine is OpenBSD? + """ + return self.system == 'openbsd' + + # Various prefixes and suffixes for import libraries, shared libraries, + # static libraries, and executables. + # Versioning is added to these names in the backends as-needed. + + def get_exe_suffix(self): + if self.is_windows() or self.is_cygwin(): + return 'exe' + else: + return '' + + def get_object_suffix(self): + if self.is_windows(): + return 'obj' + else: + return 'o' + + def libdir_layout_is_win(self): + return self.is_windows() \ + or self.is_cygwin() + class MachineInfos(PerMachine): def __init__(self): super().__init__(None, None, None) |