aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-09-17 19:21:26 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-09-17 19:21:26 +0300
commit067935ce76c03099abe83998c7c0cb80f64b92f1 (patch)
tree8d017af4252c97daa64207768e01644d49b02674
parent384365c843ed3d3ef82ed0a9dcaf1a987134a82f (diff)
downloadmeson-067935ce76c03099abe83998c7c0cb80f64b92f1.zip
meson-067935ce76c03099abe83998c7c0cb80f64b92f1.tar.gz
meson-067935ce76c03099abe83998c7c0cb80f64b92f1.tar.bz2
Added conf option for build tree layout.
-rw-r--r--backends.py6
-rw-r--r--compilers.py2
-rw-r--r--coredata.py30
-rwxr-xr-xmeson.py3
-rwxr-xr-xmesonconf.py6
-rwxr-xr-xrun_tests.py12
6 files changed, 38 insertions, 21 deletions
diff --git a/backends.py b/backends.py
index 438e4f9..b83ad2a 100644
--- a/backends.py
+++ b/backends.py
@@ -68,8 +68,10 @@ class Backend():
return filename
def get_target_dir(self, target):
-# dirname = target.get_subdir()
- dirname = 'meson-out'
+ if self.environment.coredata.layout == 'mirror':
+ dirname = target.get_subdir()
+ else:
+ dirname = 'meson-out'
os.makedirs(os.path.join(self.environment.get_build_dir(), dirname), exist_ok=True)
return dirname
diff --git a/compilers.py b/compilers.py
index 92437e1..407770f 100644
--- a/compilers.py
+++ b/compilers.py
@@ -199,6 +199,8 @@ class CCompiler():
return []
def get_include_args(self, path):
+ if path == '':
+ path = '.'
return ['-I' + path]
def get_std_shared_lib_link_args(self):
diff --git a/coredata.py b/coredata.py
index 00703aa..7837762 100644
--- a/coredata.py
+++ b/coredata.py
@@ -17,19 +17,20 @@ import pickle, os, uuid
version = '0.26.0-research'
builtin_options = {'buildtype': True,
- 'strip': True,
- 'coverage': True,
- 'pch': True,
- 'unity': True,
- 'prefix': True,
- 'libdir' : True,
- 'bindir' : True,
- 'includedir' : True,
- 'datadir' : True,
- 'mandir' : True,
- 'localedir' : True,
- 'werror' : True,
- }
+ 'strip': True,
+ 'coverage': True,
+ 'pch': True,
+ 'unity': True,
+ 'prefix': True,
+ 'libdir' : True,
+ 'bindir' : True,
+ 'includedir' : True,
+ 'datadir' : True,
+ 'mandir' : True,
+ 'localedir' : True,
+ 'werror' : True,
+ 'layout' : True,
+ }
# This class contains all data that must persist over multiple
# invocations of Meson. It is roughly the same thing as
# cmakecache.
@@ -55,6 +56,7 @@ class CoreData():
self.unity = options.unity
self.coverage = options.coverage
self.werror = options.werror
+ self.layout = options.layout
self.user_options = {}
self.external_args = {} # These are set from "the outside" with e.g. mesonconf
self.external_link_args = {}
@@ -95,6 +97,8 @@ class CoreData():
return self.mandir
if optname == 'localedir':
return self.localedir
+ if optname == 'layout':
+ return self.layout
raise RuntimeError('Tried to get unknown builtin option %s' % optname)
def load(filename):
diff --git a/meson.py b/meson.py
index 86af45c..6ca59de 100755
--- a/meson.py
+++ b/meson.py
@@ -28,6 +28,7 @@ parser = argparse.ArgumentParser()
backendlist = ['ninja', 'vs2010', 'xcode']
build_types = ['plain', 'debug', 'debugoptimized', 'release']
+layouts = ['mirror', 'flat']
if mesonlib.is_windows():
def_prefix = 'c:/'
@@ -62,6 +63,8 @@ parser.add_argument('--unity', action='store_true', dest='unity', default=False,
help='unity build')
parser.add_argument('--werror', action='store_true', dest='werror', default=False,\
help='Treat warnings as errors')
+parser.add_argument('--layout', choices=layouts, dest='layout', default='mirror',\
+ help='Build directory layout.')
parser.add_argument('--cross-file', default=None, dest='cross_file',
help='file describing cross compilation environment')
parser.add_argument('-D', action='append', dest='projectoptions', default=[],
diff --git a/mesonconf.py b/mesonconf.py
index 57010a6..adec6e2 100755
--- a/mesonconf.py
+++ b/mesonconf.py
@@ -18,7 +18,7 @@ import sys, os
import pickle
import argparse
import coredata, optinterpreter
-from meson import build_types
+from meson import build_types, layouts
parser = argparse.ArgumentParser()
@@ -80,6 +80,10 @@ class Conf:
if v not in build_types:
raise ConfException('Invalid build type %s.' % v)
self.coredata.buildtype = v
+ elif k == 'layout':
+ if v not in layouts:
+ raise ConfException('Invalid layout type %s.' % v)
+ self.coredata.layout = v
elif k == 'strip':
self.coredata.strip = self.tobool(v)
elif k == 'coverage':
diff --git a/run_tests.py b/run_tests.py
index 7d5f92f..f6a6a81 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -172,7 +172,7 @@ def run_test_inprocess(testdir):
return (returncode, mystdout.getvalue(), mystderr.getvalue())
-def run_test(testdir, should_succeed):
+def run_test(testdir, extra_args, should_succeed):
global compile_commands
mlog.shutdown() # Close the log file because otherwise Windows wets itself.
shutil.rmtree(test_build_dir)
@@ -182,7 +182,7 @@ def run_test(testdir, should_succeed):
print('Running test: ' + testdir)
gen_start = time.time()
gen_command = [meson_command, '--prefix', '/usr', '--libdir', 'lib', testdir, test_build_dir]\
- + unity_flags + backend_flags
+ + unity_flags + backend_flags + extra_args
(returncode, stdo, stde) = run_configure_inprocess(gen_command)
gen_time = time.time() - gen_start
if not should_succeed:
@@ -255,7 +255,7 @@ def detect_tests_to_run():
all_tests.append(('fortran', gather_tests('test cases/fortran'), False if shutil.which('gfortran') else True))
return all_tests
-def run_tests():
+def run_tests(extra_args):
all_tests = detect_tests_to_run()
logfile = open('meson-test-run.txt', 'w', encoding="utf_8")
junit_root = ET.Element('testsuites')
@@ -290,7 +290,7 @@ def run_tests():
skipped_tests += 1
else:
ts = time.time()
- result = run_test(t, name != 'failing')
+ result = run_test(t, extra_args, name != 'failing')
te = time.time()
conf_time += result.conftime
build_time += result.buildtime
@@ -351,6 +351,8 @@ def generate_prebuilt_object():
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Run the test suite of Meson.")
+ parser.add_argument('extra_args', nargs='*',
+ help='arguments that are passed directly to Meson (remember to have -- before these).')
parser.add_argument('--backend', default=None, dest='backend',
choices = backendlist)
options = parser.parse_args()
@@ -362,7 +364,7 @@ if __name__ == '__main__':
check_format()
pbfile = generate_prebuilt_object()
try:
- run_tests()
+ run_tests(options.extra_args)
except StopException:
pass
os.unlink(pbfile)