diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-02-25 14:03:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-25 14:03:02 +0200 |
commit | 8a68dc0179bc63303a8ef8c4a339cc01ca406084 (patch) | |
tree | 9ee89c663207c3f5cfd5e16f42ff24ea16727879 /mesonbuild/compilers | |
parent | f1ce7af2d5866b5207c1f4036477a175f433655c (diff) | |
parent | 67f3f803620cdf5cbabd2757211cb4c969ccf41f (diff) | |
download | meson-8a68dc0179bc63303a8ef8c4a339cc01ca406084.zip meson-8a68dc0179bc63303a8ef8c4a339cc01ca406084.tar.gz meson-8a68dc0179bc63303a8ef8c4a339cc01ca406084.tar.bz2 |
Merge pull request #3132 from mesonbuild/csc
Visual Studio C# compiler support and some fixes
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/__init__.py | 3 | ||||
-rw-r--r-- | mesonbuild/compilers/cs.py | 46 |
2 files changed, 41 insertions, 8 deletions
diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py index f09f252..84c87fb 100644 --- a/mesonbuild/compilers/__init__.py +++ b/mesonbuild/compilers/__init__.py @@ -67,6 +67,7 @@ __all__ = [ 'JavaCompiler', 'LLVMDCompiler', 'MonoCompiler', + 'VisualStudioCsCompiler', 'NAGFortranCompiler', 'ObjCCompiler', 'ObjCPPCompiler', @@ -127,7 +128,7 @@ from .cpp import ( IntelCPPCompiler, VisualStudioCPPCompiler, ) -from .cs import MonoCompiler +from .cs import MonoCompiler, VisualStudioCsCompiler from .d import ( DCompiler, DmdDCompiler, diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index dd7a433..f78e364 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -15,19 +15,26 @@ import os.path, subprocess from ..mesonlib import EnvironmentException +from ..mesonlib import is_windows from .compilers import Compiler, mono_buildtype_args -class MonoCompiler(Compiler): - def __init__(self, exelist, version, **kwargs): +class CsCompiler(Compiler): + def __init__(self, exelist, version, id, runner=None): self.language = 'cs' - super().__init__(exelist, version, **kwargs) - self.id = 'mono' - self.monorunner = 'mono' + super().__init__(exelist, version) + self.id = id + self.runner = runner def get_display_language(self): return 'C sharp' + def get_always_args(self): + return ['/nologo'] + + def get_linker_always_args(self): + return ['/nologo'] + def get_output_args(self, fname): return ['-out:' + fname] @@ -92,11 +99,14 @@ class MonoCompiler(Compiler): } } ''') - pc = subprocess.Popen(self.exelist + [src], cwd=work_dir) + pc = subprocess.Popen(self.exelist + self.get_always_args() + [src], cwd=work_dir) pc.wait() if pc.returncode != 0: raise EnvironmentException('Mono compiler %s can not compile programs.' % self.name_string()) - cmdlist = [self.monorunner, obj] + if self.runner: + cmdlist = [self.runner, obj] + else: + cmdlist = [os.path.join(work_dir, obj)] pe = subprocess.Popen(cmdlist, cwd=work_dir) pe.wait() if pe.returncode != 0: @@ -107,3 +117,25 @@ class MonoCompiler(Compiler): def get_buildtype_args(self, buildtype): return mono_buildtype_args[buildtype] + + +class MonoCompiler(CsCompiler): + def __init__(self, exelist, version): + super().__init__(exelist, version, 'mono', + 'mono') + + +class VisualStudioCsCompiler(CsCompiler): + def __init__(self, exelist, version): + super().__init__(exelist, version, 'csc') + + def get_buildtype_args(self, buildtype): + res = mono_buildtype_args[buildtype] + if not is_windows(): + tmp = [] + for flag in res: + if flag == '-debug': + flag = '-debug:portable' + tmp.append(flag) + res = tmp + return res |