aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-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: