-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwscript
More file actions
62 lines (46 loc) · 1.36 KB
/
wscript
File metadata and controls
62 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /usr/bin/env python
# encoding: utf-8
VERSION='0.0.1'
APPNAME='waf-template-project'
top = '.'
out = 'build'
def options(opt):
opt.load('compiler_cxx')
opt.load('waf_unit_test')
def configure(conf):
from waflib.Tools.compiler_cxx import cxx_compiler
cxx_compiler['linux'] = ['clangxx', 'gxx']
conf.load('compiler_cxx')
# Unit Testing Library
conf.load('waf_unit_test')
conf.check(lib='gtest', uselib_store='GTEST')
# gperftools
conf.check(lib='tcmalloc', uselib_store='tcmalloc')
conf.check(lib='profiler', uselib_store='profiler')
def gtest_results(bld):
from waflib import Logs
lst = getattr(bld, 'utest_results', [])
if not lst:
return
for (f, code, out, err) in lst:
# if not code:
# continue
# uncomment if you want to see what's happening
# print(str(out, 'utf-8'))
output = str(out, 'utf-8').split('\n')
for i, line in enumerate(output):
if '[ RUN ]' in line and code:
i += 1
if ' OK ]' in output[i]:
continue
while not '[ ' in output[i]:
Logs.warn('%s' % output[i])
i += 1
elif ' FAILED ]' in line and code:
Logs.error('%s' % line)
elif ' PASSED ]' in line:
Logs.info('%s' % line)
def build(bld):
directories = ['include', 'source', 'tests']
bld.recurse(directories)
bld.add_post_fun(gtest_results)