aboutsummaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-10-16 22:33:33 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-10-16 22:33:33 +0300
commit309a5c1510810d3676dcec9962894a3353ce218c (patch)
tree60bff326cf68f7eb5c1422b5800bdbd30727bb4d /build.py
parent4e522ef2158c8ba4bac3f13b31ecd2f746696a84 (diff)
downloadmeson-309a5c1510810d3676dcec9962894a3353ce218c.zip
meson-309a5c1510810d3676dcec9962894a3353ce218c.tar.gz
meson-309a5c1510810d3676dcec9962894a3353ce218c.tar.bz2
Options can be accessed from scripts.
Diffstat (limited to 'build.py')
-rw-r--r--build.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/build.py b/build.py
index 64125a8..64ea6ac 100644
--- a/build.py
+++ b/build.py
@@ -40,6 +40,16 @@ class Build:
self.static_cross_linker = None
self.configure_files = []
self.pot = []
+ self.user_options = {}
+
+ def merge_options(self, options):
+ for (name, value) in options.items():
+ if name not in self.user_options:
+ self.user_options[name] = value
+ else:
+ oldval = self.user_options[name]
+ if type(oldval) != type(value):
+ self.user_options[name] = value
def add_compiler(self, compiler):
if len(self.compilers) == 0:
@@ -82,7 +92,7 @@ class IncludeDirs():
# Fixme: check that the directories actually exist.
# Also that they don't contain ".." or somesuch.
if len(kwargs) > 0:
- raise InvalidCode('Includedirs function does not take keyword arguments.')
+ raise InvalidArguments('Includedirs function does not take keyword arguments.')
def get_curdir(self):
return self.curdir
@@ -268,15 +278,15 @@ class BuildTarget():
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.')
+ raise InvalidArguments('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.')
+ raise InvalidArguments('PCH definition must contain one header and at most one source.')
pchlist = [pchlist[1], pchlist[0]]
else:
- raise InterpreterException('PCH argument %s is of unknown type.' % pchlist[0])
+ raise InvalidArguments('PCH argument %s is of unknown type.' % pchlist[0])
elif len(pchlist) > 2:
- raise InterpreterException('PCH definition may have a maximum of 2 files.')
+ raise InvalidArguments('PCH definition may have a maximum of 2 files.')
self.pch[language] = pchlist
def add_include_dirs(self, args):