Added conf option for build tree layout.

pull/255/head
Jussi Pakkanen 9 years ago
parent 384365c843
commit 067935ce76
  1. 6
      backends.py
  2. 2
      compilers.py
  3. 30
      coredata.py
  4. 3
      meson.py
  5. 6
      mesonconf.py
  6. 12
      run_tests.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

@ -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):

@ -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):

@ -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=[],

@ -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':

@ -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)

Loading…
Cancel
Save