diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-06-15 00:37:14 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-06-15 00:37:14 +0300 |
commit | a1f4bf1124588fd59f8eed95f13ec445b236735b (patch) | |
tree | 7e9b5cc8ba5879f3c5a25cd717474ac8e64b69fd /interpreter.py | |
parent | 81b478e03108d341f1021bfe7db18e21a758a9fc (diff) | |
download | meson-a1f4bf1124588fd59f8eed95f13ec445b236735b.zip meson-a1f4bf1124588fd59f8eed95f13ec445b236735b.tar.gz meson-a1f4bf1124588fd59f8eed95f13ec445b236735b.tar.bz2 |
Started work on MSVC precompiled headers. It does not work yet but I have been at it for so long that I want to just commit now because it at least does something close to the final result.
Diffstat (limited to 'interpreter.py')
-rwxr-xr-x | interpreter.py | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/interpreter.py b/interpreter.py index 5469cec..da53cc2 100755 --- a/interpreter.py +++ b/interpreter.py @@ -348,7 +348,7 @@ class BuildTarget(InterpreterObject): self.link_targets = [] self.filename = 'no_name' self.need_install = False - self.pch = [] + self.pch = {} self.extra_args = {} self.generated = [] self.process_sourcelist(sources) @@ -379,10 +379,14 @@ class BuildTarget(InterpreterObject): llist = [llist] for linktarget in llist: self.link(linktarget) - pchlist = kwargs.get('pch', []) - if not isinstance(pchlist, list): - pchlist = [pchlist] - self.add_pch(pchlist) + c_pchlist = kwargs.get('c_pch', []) + if not isinstance(c_pchlist, list): + c_pchlist = [c_pchlist] + self.add_pch('c', c_pchlist) + cpp_pchlist = kwargs.get('cpp_pch', []) + if not isinstance(cpp_pchlist, list): + cpp_pchlist = [cpp_pchlist] + self.add_pch('cpp', cpp_pchlist) clist = kwargs.get('c_args', []) if not isinstance(clist, list): clist = [clist] @@ -434,8 +438,11 @@ class BuildTarget(InterpreterObject): def has_pch(self): return len(self.pch) > 0 - def get_pch(self): - return self.pch + def get_pch(self, language): + try: + return self.pch[language] + except KeyError: + return[] def get_include_dirs(self): return self.include_dirs @@ -467,9 +474,20 @@ class BuildTarget(InterpreterObject): raise InvalidArguments('Generated source argument is not the output of a generator.') self.generated.append(g) - def add_pch(self, pchlist): - for a in pchlist: - self.pch.append(a) + def add_pch(self, language, pchlist): + if len(pchlist) == 0: + return + if len(pchlist) == 2: + if environment.is_header(pchlist[0]): + if not environment.is_source(pchlist[1]): + raise InterpreterException('PCH definition must contain one header and at most one source.') + elif environment.is_source(pchlist[0]): + if not environment.is_header(pchlist[1]): + raise InterpreterException('PCH definition must contain one header and at most one source.') + pchlist = [pchlist[1], pchlist[0]] + elif len(pchlist) > 2: + raise InterpreterException('PCH definition may have a maximum of 2 files.') + self.pch[language] = pchlist def add_include_dirs(self, args): for a in args: |