From 544ce42c52b7ab0ecbc2a51a9932a91951022048 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 19 Jul 2014 01:33:01 +0300 Subject: [PATCH] Build type flags for C#. --- environment.py | 8 ++++++++ ninjabackend.py | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/environment.py b/environment.py index 4c6a36ad6..8e3eadbe6 100644 --- a/environment.py +++ b/environment.py @@ -62,6 +62,11 @@ rust_buildtype_args = {'plain' : [], 'debugoptimized' : ['-g', '--opt-level', '2'], 'release' : ['--opt-level', '3']} +mono_buildtype_args = {'plain' : [], + 'debug' : ['-debug'], + 'debugoptimized': ['-debug', '-optimize+'], + 'release' : ['-optimize+']} + class CCompiler(): def __init__(self, exelist, version, is_cross, exe_wrapper=None): if type(exelist) == type(''): @@ -585,6 +590,9 @@ class MonoCompiler(): def has_function(self, funcname, prefix, env): raise EnvironmentException('Mono does not support function checks.') + def get_buildtype_args(self, buildtype): + return mono_buildtype_args[buildtype] + class JavaCompiler(): def __init__(self, exelist, version): if type(exelist) == type(''): diff --git a/ninjabackend.py b/ninjabackend.py index c9f69938b..01d26ae87 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -434,6 +434,7 @@ class NinjaBackend(backends.Backend): elem.write(outfile) def generate_cs_target(self, target, outfile): + buildtype = self.environment.coredata.buildtype fname = target.get_filename() subdir = target.get_subdir() outname_rel = os.path.join(subdir, fname) @@ -442,6 +443,7 @@ class NinjaBackend(backends.Backend): assert(compiler.get_language() == 'cs') rel_srcs = [os.path.join(self.build_to_src, s) for s in src_list] commands = [] + commands += compiler.get_buildtype_args(buildtype) if isinstance(target, build.Executable): commands.append('-target:exe') elif isinstance(target, build.SharedLibrary): @@ -453,7 +455,11 @@ class NinjaBackend(backends.Backend): for l in target.link_targets: commands += compiler.get_link_args(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_item('ARGS', commands) elem.write(outfile)