diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-01-26 01:44:56 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-01-26 01:44:56 +0200 |
commit | b97f43b9b7777a83dd44b4a16b65aeafda996aba (patch) | |
tree | c0c42c3f541b62222599534514de47c639268482 /interpreter.py | |
parent | 2af66e54781c2592f22c99b1d72d35a7b758a32f (diff) | |
download | meson-b97f43b9b7777a83dd44b4a16b65aeafda996aba.zip meson-b97f43b9b7777a83dd44b4a16b65aeafda996aba.tar.gz meson-b97f43b9b7777a83dd44b4a16b65aeafda996aba.tar.bz2 |
Can set global flags.
Diffstat (limited to 'interpreter.py')
-rwxr-xr-x | interpreter.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/interpreter.py b/interpreter.py index 13d3c8f..e74030c 100755 --- a/interpreter.py +++ b/interpreter.py @@ -262,6 +262,7 @@ class Interpreter(): 'data' : self.func_data, 'configure_file' : self.func_configure_file, 'include_directories' : self.func_include_directories, + 'add_global_arguments' : self.func_add_global_arguments, } def get_variables(self): @@ -428,6 +429,19 @@ class Interpreter(): i = IncludeDirs(self.subdir, args) return i + def func_add_global_arguments(self, node, args): + for a in args: + if not isinstance(a, str): + raise InvalidArguments('Line %d: Argument %s is not a string.' % (node.lineno(), str(a))) + if len(self.build.get_targets()) > 0: + raise InvalidCode('Line %d: global flags can not be set once any build target is defined.' % node.lineno()) + lang = args[0].lower() + switches = args[1:] + if lang in self.build.global_args: + self.build.global_args[lang] += switches + else: + self.build.global_args[lang] = switches + def flatten(self, args): result = [] for a in args: |