aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-04-19 21:10:41 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-04-19 21:10:41 +0300
commit5d81924914ca5faa0ec79f0d7f6063b5451ef0f8 (patch)
treed2b1310360ea52dcbe8d17d5f0d4bf01c1aa6cb4
parent21c6166af9d1c1501ba54cb748051867dad847f3 (diff)
downloadmeson-5d81924914ca5faa0ec79f0d7f6063b5451ef0f8.zip
meson-5d81924914ca5faa0ec79f0d7f6063b5451ef0f8.tar.gz
meson-5d81924914ca5faa0ec79f0d7f6063b5451ef0f8.tar.bz2
Check that VC can compile.
-rwxr-xr-xenvironment.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/environment.py b/environment.py
index afef14a..06a0fcc 100755
--- a/environment.py
+++ b/environment.py
@@ -183,6 +183,23 @@ class VisualStudioCCompiler(CCompiler):
def get_compile_only_flags(self):
return ['/c']
+ def sanity_check(self, work_dir):
+ source_name = os.path.join(work_dir, 'sanitycheckc.c')
+ binary_name = os.path.join(work_dir, 'sanitycheckc')
+ ofile = open(source_name, 'w')
+ ofile.write('int main(int argc, char **argv) { return 0; }\n')
+ ofile.close()
+ pc = subprocess.Popen(self.exelist + [source_name, '/Fe' + binary_name],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL)
+ pc.wait()
+ if pc.returncode != 0:
+ raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
+ pe = subprocess.Popen(binary_name)
+ pe.wait()
+ if pe.returncode != 0:
+ raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string())
+
class GnuCCompiler(CCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
std_opt_flags = ['-O2']
@@ -408,7 +425,8 @@ class Environment():
arg = '/?'
else:
arg = '--version'
- p = subprocess.Popen([compiler] + [arg], stdout=subprocess.PIPE)
+ p = subprocess.Popen([compiler] + [arg], stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL)
except OSError:
continue
out = p.communicate()[0]