aboutsummaryrefslogtreecommitdiff
path: root/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-02-10 15:05:35 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-02-10 15:05:35 +0200
commit727562fbd899e0d20bd3a4a9fd178e58db0928cd (patch)
tree5607e4a827d0fc1973fc72fa2ae4cc7ceef764b8 /environment.py
parentab35e989fa43a2817e952e679002e2218f5197b9 (diff)
downloadmeson-727562fbd899e0d20bd3a4a9fd178e58db0928cd.zip
meson-727562fbd899e0d20bd3a4a9fd178e58db0928cd.tar.gz
meson-727562fbd899e0d20bd3a4a9fd178e58db0928cd.tar.bz2
Added support for Clang.
Diffstat (limited to 'environment.py')
-rwxr-xr-xenvironment.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/environment.py b/environment.py
index 699274a..637b280 100755
--- a/environment.py
+++ b/environment.py
@@ -126,6 +126,22 @@ class GnuCCompiler(CCompiler):
def get_pch_suffix(self):
return 'gch'
+class ClangCCompiler(CCompiler):
+ std_warn_flags = ['-Wall', '-Winvalid-pch']
+ std_opt_flags = ['-O2']
+
+ def __init__(self, exelist):
+ CCompiler.__init__(self, exelist)
+
+ def get_std_warn_flags(self):
+ return ClangCCompiler.std_warn_flags
+
+ def get_std_opt_flags(self):
+ return ClangCCompiler.std_opt_flags
+
+ def get_pch_suffix(self):
+ return 'pch'
+
class GnuCXXCompiler(CXXCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
std_opt_flags = ['-O2']
@@ -142,6 +158,22 @@ class GnuCXXCompiler(CXXCompiler):
def get_pch_suffix(self):
return 'gch'
+class ClangCXXCompiler(CXXCompiler):
+ std_warn_flags = ['-Wall', '-Winvalid-pch']
+ std_opt_flags = ['-O2']
+
+ def __init__(self, exelist):
+ CXXCompiler.__init__(self, exelist)
+
+ def get_std_warn_flags(self):
+ return ClangCXXCompiler.std_warn_flags
+
+ def get_std_opt_flags(self):
+ return ClangCXXCompiler.std_opt_flags
+
+ def get_pch_suffix(self):
+ return 'pch'
+
class ArLinker():
std_flags = ['csr']
@@ -196,6 +228,8 @@ class Environment():
if (out.startswith('cc ') or out.startswith('gcc')) and \
'Free Software Foundation' in out:
return GnuCCompiler(exelist)
+ if (out.startswith('clang')):
+ return ClangCCompiler(exelist)
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
def get_scratch_dir(self):
@@ -213,6 +247,8 @@ class Environment():
if (out.startswith('c++ ') or out.startswith('g++')) and \
'Free Software Foundation' in out:
return GnuCXXCompiler(exelist)
+ if out.startswith('clang'):
+ return ClangCXXCompiler(exelist)
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
def detect_static_linker(self):