forked from derat/xsettingsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
77 lines (57 loc) · 1.88 KB
/
SConstruct
File metadata and controls
77 lines (57 loc) · 1.88 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# -*- python -*-
# Copyright 2009 Daniel Erat <dan@erat.org>
# All rights reserved.
import os
import subprocess
Help('''
Type: 'scons xsettingsd' to build xsettingsd
'scons dump_xsettings' to build dump_xsettings
'scons test' to build and run all tests
''')
def run_tests(target, source, env):
'''Run all test binaries listed in 'source'.'''
tests = sorted([str(t) for t in source])
max_length = max([len(t) for t in tests])
for test in tests:
padded_name = test + ' ' * (max_length - len(test))
proc = subprocess.Popen('./%s' % test,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
close_fds=True)
[stdout, stderr] = proc.communicate()
proc.wait()
if proc.returncode == 0:
print '%s OK' % padded_name
else:
print "%s FAILED\n" % padded_name
print stdout
run_tests_builder = Builder(action=run_tests)
env = Environment(
BUILDERS = {
'RunTests': run_tests_builder,
})
env.Append(CPPFLAGS = os.environ.get('CPPFLAGS', ''),
CFLAGS = os.environ.get('CFLAGS', ''),
CXXFLAGS = os.environ.get('CXXFLAGS', ''),
LDFLAGS = os.environ.get('LDFLAGS', ''))
env.Append(CCFLAGS = '-Wall -Werror')
srcs = Split('''\
common.cc
config_parser.cc
data_reader.cc
data_writer.cc
setting.cc
settings_manager.cc
''')
libxsettingsd = env.Library('xsettingsd', srcs)
env['LIBS'] = libxsettingsd
env.ParseConfig('pkg-config --cflags --libs x11')
xsettingsd = env.Program('xsettingsd', 'xsettingsd.cc')
dump_xsettings = env.Program('dump_xsettings', 'dump_xsettings.cc')
Default([xsettingsd, dump_xsettings])
test_env = env.Clone()
test_env.Append(CCFLAGS=' -D__TESTING', LINKFLAGS=' -lgtest')
tests = []
for file in Glob('*_test.cc', strings=True):
tests += test_env.Program(file)
test_env.RunTests('test', tests)