Compiler name may have more than one command (i.e. "ccache gcc" works).

pull/15/head
Jussi Pakkanen 12 years ago
parent c3c9a31a5a
commit 70bf9b03be
  1. 17
      environment.py

@ -20,26 +20,27 @@ class EnvironmentException(Exception):
def __init(self, text):
Exception.__init__(self, text)
def detect_c_compiler(exename):
p = subprocess.Popen([exename, '--version'], stdout=subprocess.PIPE)
def detect_c_compiler(execmd):
exelist = execmd.split()
p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE)
(out, err) = p.communicate()
out = out.decode()
if (out.startswith('cc ') or out.startswith('gcc')) and \
'Free Software Foundation' in out:
return GnuCCompiler(exename)
raise EnvironmentException('Unknown compiler ' + exename)
return GnuCCompiler(exelist)
raise EnvironmentException('Unknown compiler ' + execmd)
class CCompiler():
def __init__(self, exename):
self.exename = exename
def __init__(self, exelist):
self.exelist = exelist
def get_std_warn_flags(self):
return []
class GnuCCompiler(CCompiler):
std_warn_flags = ['-Wall']
def __init__(self, exename):
CCompiler.__init__(self, exename)
def __init__(self, exelist):
CCompiler.__init__(self, exelist)
def get_std_warn_flags(self):
return GnuCCompiler.std_warn_flags

Loading…
Cancel
Save