diff options
-rw-r--r-- | mesonbuild/compilers.py | 7 | ||||
-rw-r--r-- | mesonbuild/environment.py | 3 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 4 |
4 files changed, 13 insertions, 5 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 6f08d98..e6be8b1 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -2309,6 +2309,7 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): GCC_STANDARD = 0 GCC_OSX = 1 GCC_MINGW = 2 +GCC_CYGWIN = 3 CLANG_STANDARD = 0 CLANG_OSX = 1 @@ -2324,7 +2325,7 @@ def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, i sostr = '' else: sostr = '.' + soversion - if gcc_type == GCC_STANDARD or gcc_type == GCC_MINGW: + if gcc_type in (GCC_STANDARD, GCC_MINGW, GCC_CYGWIN): # Might not be correct for mingw but seems to work. return ['-Wl,-soname,%s%s.%s%s' % (prefix, shlib_name, suffix, sostr)] elif gcc_type == GCC_OSX: @@ -2398,7 +2399,7 @@ class GnuCompiler: return self.defines[define] def get_pic_args(self): - if self.gcc_type in (GCC_MINGW, GCC_OSX): + if self.gcc_type in (GCC_CYGWIN, GCC_MINGW, GCC_OSX): return [] # On Window and OS X, pic is always on. return ['-fPIC'] @@ -2796,7 +2797,7 @@ class FortranCompiler(Compiler): return ' '.join(self.exelist) def get_pic_args(self): - if self.gcc_type in (GCC_MINGW, GCC_OSX): + if self.gcc_type in (GCC_CYGWIN, GCC_MINGW, GCC_OSX): return [] # On Window and OS X, pic is always on. return ['-fPIC'] diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index cb62506..7ae53fc 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -368,7 +368,8 @@ class Environment: return GCC_OSX elif '__MINGW32__' in defines or '__MINGW64__' in defines: return GCC_MINGW - # We ignore Cygwin for now, and treat it as a standard GCC + elif '__CYGWIN__' in defines: + return GCC_CYGWIN return GCC_STANDARD def _get_compilers(self, lang, evar, want_cross): diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index ba52219..291eb68 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -212,6 +212,10 @@ def is_windows(): platname = platform.system().lower() return platname == 'windows' or 'mingw' in platname +def is_cygwin(): + platname = platform.system().lower() + return platname.startswith('cygwin') + def is_debianlike(): return os.path.isfile('/etc/debian_version') diff --git a/run_unittests.py b/run_unittests.py index 53abef7..14badc2 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -24,7 +24,7 @@ from pathlib import PurePath import mesonbuild.compilers import mesonbuild.environment import mesonbuild.mesonlib -from mesonbuild.mesonlib import is_windows, is_osx +from mesonbuild.mesonlib import is_windows, is_osx, is_cygwin from mesonbuild.environment import detect_ninja, Environment from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram @@ -833,6 +833,8 @@ class AllPlatformTests(BasePlatformTests): self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_OSX) elif is_windows(): self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_MINGW) + elif is_cygwin(): + self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_CYGWIN) else: self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_STANDARD) if isinstance(cc, clang): |