Build type flags for C#.

pull/15/head
Jussi Pakkanen 11 years ago
parent 7814ef986f
commit 544ce42c52
  1. 8
      environment.py
  2. 8
      ninjabackend.py

@ -62,6 +62,11 @@ rust_buildtype_args = {'plain' : [],
'debugoptimized' : ['-g', '--opt-level', '2'], 'debugoptimized' : ['-g', '--opt-level', '2'],
'release' : ['--opt-level', '3']} 'release' : ['--opt-level', '3']}
mono_buildtype_args = {'plain' : [],
'debug' : ['-debug'],
'debugoptimized': ['-debug', '-optimize+'],
'release' : ['-optimize+']}
class CCompiler(): class CCompiler():
def __init__(self, exelist, version, is_cross, exe_wrapper=None): def __init__(self, exelist, version, is_cross, exe_wrapper=None):
if type(exelist) == type(''): if type(exelist) == type(''):
@ -585,6 +590,9 @@ class MonoCompiler():
def has_function(self, funcname, prefix, env): def has_function(self, funcname, prefix, env):
raise EnvironmentException('Mono does not support function checks.') raise EnvironmentException('Mono does not support function checks.')
def get_buildtype_args(self, buildtype):
return mono_buildtype_args[buildtype]
class JavaCompiler(): class JavaCompiler():
def __init__(self, exelist, version): def __init__(self, exelist, version):
if type(exelist) == type(''): if type(exelist) == type(''):

@ -434,6 +434,7 @@ class NinjaBackend(backends.Backend):
elem.write(outfile) elem.write(outfile)
def generate_cs_target(self, target, outfile): def generate_cs_target(self, target, outfile):
buildtype = self.environment.coredata.buildtype
fname = target.get_filename() fname = target.get_filename()
subdir = target.get_subdir() subdir = target.get_subdir()
outname_rel = os.path.join(subdir, fname) outname_rel = os.path.join(subdir, fname)
@ -442,6 +443,7 @@ class NinjaBackend(backends.Backend):
assert(compiler.get_language() == 'cs') assert(compiler.get_language() == 'cs')
rel_srcs = [os.path.join(self.build_to_src, s) for s in src_list] rel_srcs = [os.path.join(self.build_to_src, s) for s in src_list]
commands = [] commands = []
commands += compiler.get_buildtype_args(buildtype)
if isinstance(target, build.Executable): if isinstance(target, build.Executable):
commands.append('-target:exe') commands.append('-target:exe')
elif isinstance(target, build.SharedLibrary): elif isinstance(target, build.SharedLibrary):
@ -453,7 +455,11 @@ class NinjaBackend(backends.Backend):
for l in target.link_targets: for l in target.link_targets:
commands += compiler.get_link_args(l.get_filename()) commands += compiler.get_link_args(l.get_filename())
deps.append(l.get_filename()) deps.append(l.get_filename())
elem = NinjaBuildElement(outname_rel, 'cs_COMPILER', rel_srcs) if '-g' in commands:
outputs = [outname_rel, outname_rel + '.mdb']
else:
outputs = [outname_rel]
elem = NinjaBuildElement(outputs, 'cs_COMPILER', rel_srcs)
elem.add_dep(deps) elem.add_dep(deps)
elem.add_item('ARGS', commands) elem.add_item('ARGS', commands)
elem.write(outfile) elem.write(outfile)

Loading…
Cancel
Save