Dependency tracking works with MSVC.

pull/15/head
Jussi Pakkanen 12 years ago
parent 45d5195494
commit af126c9d0e
  1. 17
      backends.py
  2. 15
      environment.py

@ -190,6 +190,7 @@ class Backend():
def generate_basic_compiler_flags(self, target, compiler):
commands = []
commands += compiler.get_always_flags()
commands += self.build.get_global_flags(compiler)
commands += target.get_extra_args(compiler.get_language())
if self.environment.coredata.buildtype != 'plain':
@ -540,10 +541,13 @@ class NinjaBackend(Backend):
' '.join(compiler.get_output_flags('$out')),\
' '.join(compiler.get_compile_only_flags()))
description = ' description = Compiling %s object $out\n' % langname
dep = ' depfile = $DEPFILE\n'
if compiler.get_id() == 'msvc':
deps = ' deps = msvc\n'
else:
deps = ' depfile = $DEPFILE\n'
outfile.write(rule)
outfile.write(command)
outfile.write(dep)
outfile.write(deps)
outfile.write(description)
outfile.write('\n')
@ -559,11 +563,14 @@ class NinjaBackend(Backend):
' '.join([qstr % d for d in depflags]),\
output,\
' '.join(compiler.get_compile_only_flags()))
description = ' description = Precompilling header %s\n' % '$in'
dep = ' depfile = $DEPFILE\n'
description = ' description = Precompiling header %s\n' % '$in'
if compiler.get_id() == 'msvc':
deps = ' deps = msvc\n'
else:
deps = ' depfile = $DEPFILE\n'
outfile.write(rule)
outfile.write(command)
outfile.write(dep)
outfile.write(deps)
outfile.write(description)
outfile.write('\n')

@ -36,7 +36,10 @@ class CCompiler():
self.language = 'c'
self.default_suffix = 'c'
self.id = 'unknown'
def get_always_flags(self):
return []
def get_id(self):
return self.id
@ -244,11 +247,15 @@ class ObjCPPCompiler(CPPCompiler):
class VisualStudioCCompiler(CCompiler):
std_warn_flags = ['/W3']
std_opt_flags= ['/O2']
always_flags = ['/nologo', '/showIncludes']
def __init__(self, exelist):
CCompiler.__init__(self, exelist)
self.id = 'msvc'
def get_always_flags(self):
return VisualStudioCCompiler.always_flags
def get_std_warn_flags(self):
return VisualStudioCCompiler.std_warn_flags
@ -447,6 +454,7 @@ class ClangCPPCompiler(CPPCompiler):
return 'pch'
class VisualStudioLinker():
always_flags = ['/NOLOGO']
def __init__(self, exelist):
self.exelist = exelist
@ -462,6 +470,9 @@ class VisualStudioLinker():
def get_coverage_link_flags(self):
return []
def get_always_flags(self):
return VisualStudioLinker.always_flags
class ArLinker():
std_flags = ['csr']
@ -480,6 +491,8 @@ class ArLinker():
def get_coverage_link_flags(self):
return []
def get_always_flags(self):
return []
def exe_exists(arglist):
try:
p = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Loading…
Cancel
Save