aboutsummaryrefslogtreecommitdiffstats
path: root/extras/autowaf.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-01-12 20:32:06 +0100
committerDavid Robillard <d@drobilla.net>2019-01-12 20:32:06 +0100
commitb95c23571a94ae9cce8dbbc5aa8a84c398cc10d6 (patch)
tree5d763cf807f825f708f2084b61cc8e13c36eb913 /extras/autowaf.py
parent1c5d1c8712500cf4ad5f286f5e2cfcc55292ca7e (diff)
downloadjalv-b95c23571a94ae9cce8dbbc5aa8a84c398cc10d6.tar.gz
jalv-b95c23571a94ae9cce8dbbc5aa8a84c398cc10d6.tar.bz2
jalv-b95c23571a94ae9cce8dbbc5aa8a84c398cc10d6.zip
Squashed 'waflib/' changes from 5ea8f99..915dcb1
915dcb1 Report test time correctly 26f0a2b Remove redundant verbose-tests option fc35c2c Fix MSVC CFLAGS git-subtree-dir: waflib git-subtree-split: 915dcb1778a592ef54a6b7e14fa8a6bd1ca3376c
Diffstat (limited to 'extras/autowaf.py')
-rw-r--r--extras/autowaf.py54
1 files changed, 39 insertions, 15 deletions
diff --git a/extras/autowaf.py b/extras/autowaf.py
index feaae3c..92d0e57 100644
--- a/extras/autowaf.py
+++ b/extras/autowaf.py
@@ -87,9 +87,6 @@ def set_options(opt, debug_by_default=False, test=False):
test_opts.add_option('--wrapper', type='string',
dest='test_wrapper',
help='command prefix for tests (e.g. valgrind)')
- test_opts.add_option('--verbose-tests', action='store_true',
- default=False, dest='verbose_tests',
- help='always show test output')
g_step = 1
@@ -249,16 +246,37 @@ def configure(conf):
conf.env['CXXFLAGS'] = ['-O0', '-g']
else:
if conf.env['MSVC_COMPILER']:
- conf.env['CFLAGS'] = ['/MD', '/FS', '/DNDEBUG']
- conf.env['CXXFLAGS'] = ['/MD', '/FS', '/DNDEBUG']
+ append_cxx_flags(['/MD', '/FS', '/DNDEBUG'])
else:
append_cxx_flags(['-DNDEBUG'])
if conf.env.MSVC_COMPILER:
Options.options.no_coverage = True
- if Options.options.strict:
- conf.env.append_value('CFLAGS', ['/Wall'])
- conf.env.append_value('CXXFLAGS', ['/Wall'])
+ append_cxx_flags(['/nologo',
+ '/FS',
+ '/DNDEBUG',
+ '/D_CRT_SECURE_NO_WARNINGS',
+ '/experimental:external',
+ '/external:W0',
+ '/external:anglebrackets'])
+ conf.env.append_value('LINKFLAGS', '/nologo')
+ if Options.options.strict or Options.options.ultra_strict:
+ ms_strict_flags = ['/Wall',
+ '/wd4061',
+ '/wd4200',
+ '/wd4514',
+ '/wd4571',
+ '/wd4625',
+ '/wd4626',
+ '/wd4706',
+ '/wd4710',
+ '/wd4820',
+ '/wd5026',
+ '/wd5027',
+ '/wd5045']
+ conf.env.append_value('CFLAGS', ms_strict_flags)
+ conf.env.append_value('CXXFLAGS', ms_strict_flags)
+ conf.env.append_value('CXXFLAGS', ['/EHsc'])
else:
if Options.options.ultra_strict:
Options.options.strict = True
@@ -346,7 +364,7 @@ def set_c_lang(conf, lang):
"Set a specific C language standard, like 'c99' or 'c11'"
if conf.env.MSVC_COMPILER:
# MSVC has no hope or desire to compile C99, just compile as C++
- conf.env.append_unique('CFLAGS', ['-TP'])
+ conf.env.append_unique('CFLAGS', ['/TP'])
else:
flag = '-std=%s' % lang
conf.check(cflags=['-Werror', flag],
@@ -370,7 +388,7 @@ def set_modern_c_flags(conf):
if 'COMPILER_CC' in conf.env:
if conf.env.MSVC_COMPILER:
# MSVC has no hope or desire to compile C99, just compile as C++
- conf.env.append_unique('CFLAGS', ['-TP'])
+ conf.env.append_unique('CFLAGS', ['/TP'])
else:
for flag in ['-std=c11', '-std=c99']:
if conf.check(cflags=['-Werror', flag], mandatory=False,
@@ -739,11 +757,17 @@ def cd_to_orig_dir(ctx, child):
else:
os.chdir('..')
+def bench_time():
+ if hasattr(time, 'perf_counter'): # Added in Python 3.3
+ return time.perf_counter()
+ else:
+ return time.time()
+
def pre_test(ctx, appname, dirs=['src']):
Logs.pprint('GREEN', '\n[==========] Running %s tests' % appname)
if not hasattr(ctx, 'autowaf_tests_total'):
- ctx.autowaf_tests_start_time = time.clock()
+ ctx.autowaf_tests_start_time = bench_time()
ctx.autowaf_tests_total = 0
ctx.autowaf_tests_failed = 0
ctx.autowaf_local_tests_total = 0
@@ -811,7 +835,7 @@ def post_test(ctx, appname, dirs=['src'], remove=['*boost*', 'c++*']):
coverage_lcov.close()
coverage_log.close()
- duration = (time.clock() - ctx.autowaf_tests_start_time) * 1000.0
+ duration = (bench_time() - ctx.autowaf_tests_start_time) * 1000.0
total_tests = ctx.autowaf_tests[appname]['total']
failed_tests = ctx.autowaf_tests[appname]['failed']
passed_tests = total_tests - failed_tests
@@ -884,7 +908,7 @@ def run_test(ctx,
if type(test) != list and not callable(test):
Logs.pprint('RED', test)
- if Options.options.verbose_tests and type(test) != list and not callable(test):
+ if Options.options.verbose and type(test) != list and not callable(test):
sys.stdout.write(out[0].decode('utf-8'))
sys.stderr.write(out[1].decode('utf-8'))
@@ -899,7 +923,7 @@ def tests_name(ctx, appname, name='*'):
def begin_tests(ctx, appname, name='*'):
ctx.autowaf_local_tests_failed = 0
ctx.autowaf_local_tests_total = 0
- ctx.autowaf_local_tests_start_time = time.clock()
+ ctx.autowaf_local_tests_start_time = bench_time()
Logs.pprint('GREEN', '\n[----------] %s' % (
tests_name(ctx, appname, name)))
@@ -913,7 +937,7 @@ def begin_tests(ctx, appname, name='*'):
return Handle()
def end_tests(ctx, appname, name='*'):
- duration = (time.clock() - ctx.autowaf_local_tests_start_time) * 1000.0
+ duration = (bench_time() - ctx.autowaf_local_tests_start_time) * 1000.0
total = ctx.autowaf_local_tests_total
failures = ctx.autowaf_local_tests_failed
if failures == 0: