Can build programs with MSVC.

pull/15/head
Jussi Pakkanen 12 years ago
parent 5d81924914
commit 7ce4aa1b90
  1. 10
      backends.py
  2. 22
      environment.py

@ -484,10 +484,10 @@ class NinjaBackend(Backend):
for compiler in self.build.compilers:
langname = compiler.get_language()
rule = 'rule %s_LINKER\n' % langname
command = ' command = %s %s $FLAGS %s $out $in $LINK_FLAGS $aliasing\n' % \
command = ' command = %s %s $FLAGS %s $in $LINK_FLAGS $aliasing\n' % \
(execute_wrapper,
' '.join(compiler.get_exelist()),\
' '.join(compiler.get_output_flags()))
' '.join(compiler.get_linker_exelist()),\
' '.join(compiler.get_linker_output_flags('$out')))
description = ' description = Linking target $out'
outfile.write(rule)
outfile.write(command)
@ -501,10 +501,10 @@ class NinjaBackend(Backend):
langname = compiler.get_language()
rule = 'rule %s_COMPILER\n' % langname
depflags = compiler.get_dependency_gen_flags('$out', '$DEPFILE')
command = " command = %s $FLAGS %s %s $out %s $in\n" % \
command = " command = %s $FLAGS %s %s %s $in\n" % \
(' '.join(compiler.get_exelist()),\
' '.join([qstr % d for d in depflags]),\
' '.join(compiler.get_output_flags()),\
' '.join(compiler.get_output_flags('$out')),\
' '.join(compiler.get_compile_only_flags()))
description = ' description = Compiling %s object $out\n' % langname
dep = ' depfile = $DEPFILE\n'

@ -45,12 +45,18 @@ class CCompiler():
def get_exelist(self):
return self.exelist
def get_linker_exelist(self):
return self.exelist
def get_compile_only_flags(self):
return ['-c']
def get_output_flags(self):
return ['-o']
def get_output_flags(self, target):
return ['-o', target]
def get_linker_output_flags(self, outputname):
return ['-o', outputname]
def get_debug_flags(self):
return ['-g']
@ -183,6 +189,18 @@ class VisualStudioCCompiler(CCompiler):
def get_compile_only_flags(self):
return ['/c']
def get_output_flags(self, target):
return ['/Fo' + target]
def get_dependency_gen_flags(self, outtarget, outfile):
return []
def get_linker_exelist(self):
return ['link'] # FIXME, should have same path as compiler.
def get_linker_output_flags(self, outputname):
return ['/OUT:' + outputname]
def sanity_check(self, work_dir):
source_name = os.path.join(work_dir, 'sanitycheckc.c')
binary_name = os.path.join(work_dir, 'sanitycheckc')

Loading…
Cancel
Save