aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-09-20 20:29:57 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2018-11-04 15:42:00 +0000
commit64edfd50691be21fae1e61b8864d6de6fcead1d4 (patch)
treeedff913b3cc3fa1adf558e1b1c860aad8f7a7717 /mesonbuild/compilers/c.py
parent63f4f9481ebc865b11a06aeecf0c624104d46afd (diff)
downloadmeson-64edfd50691be21fae1e61b8864d6de6fcead1d4.zip
meson-64edfd50691be21fae1e61b8864d6de6fcead1d4.tar.gz
meson-64edfd50691be21fae1e61b8864d6de6fcead1d4.tar.bz2
Detect clang-cl as msvc-like, not clang-like
Handle clang's cl or clang-cl being in PATH, or set in CC/CXX Future work: checking the name of the executable here seems like a bad idea. These compilers will fail to be detected if they are renamed. v2: Update compiler.get_argument_type() test Fix comparisons of id inside CCompiler, backends and elsewhere v3: ClangClCPPCompiler should be a subclass of ClangClCCompier, as well Future work: mocking in test_find_library_patterns() is effected, as we now test for a subclass, rather than self.id in CCompiler.get_library_naming()
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 9b24e85..d17dd3a 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -170,7 +170,7 @@ class CCompiler(Compiler):
else:
# GNU ld and LLVM lld
return ['-Wl,--allow-shlib-undefined']
- elif self.id == 'msvc':
+ elif isinstance(self, VisualStudioCCompiler):
# link.exe
return ['/FORCE:UNRESOLVED']
# FIXME: implement other linkers
@@ -890,7 +890,7 @@ class CCompiler(Compiler):
stlibext = ['a']
# We've always allowed libname to be both `foo` and `libfoo`,
# and now people depend on it
- if strict and self.id != 'msvc': # lib prefix is not usually used with msvc
+ if strict and not isinstance(self, VisualStudioCCompiler): # lib prefix is not usually used with msvc
prefixes = ['lib']
else:
prefixes = ['lib', '']
@@ -900,7 +900,7 @@ class CCompiler(Compiler):
elif for_windows(env.is_cross_build(), env):
# FIXME: .lib files can be import or static so we should read the
# file, figure out which one it is, and reject the wrong kind.
- if self.id == 'msvc':
+ if isinstance(self, VisualStudioCCompiler):
shlibext = ['lib']
else:
shlibext = ['dll.a', 'lib', 'dll']
@@ -1546,6 +1546,10 @@ class VisualStudioCCompiler(CCompiler):
def get_argument_syntax(self):
return 'msvc'
+class ClangClCCompiler(VisualStudioCCompiler):
+ def __init__(self, exelist, version, is_cross, exe_wrap, is_64):
+ super().__init__(exelist, version, is_cross, exe_wrap, is_64)
+ self.id = 'clang-cl'
class ArmCCompiler(ArmCompiler, CCompiler):
def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs):