-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
195 lines (173 loc) · 5.16 KB
/
wscript
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#! /usr/bin/evn python
# encoding: utf-8
import Options, UnitTest
from TaskGen import feature, after
import Task, Utils
srcdir = '.'
blddir = 'build'
def set_options(opt):
opt.tool_options('compiler_cxx')
opt.add_option('--debug', help='Build debug variant',
action='store_true', dest="build_debug", default=True
)
opt.add_option('--release', help='Build release variant',
action='store_false', dest="build_debug"
)
def configure(conf):
conf.check_tool('compiler_cxx')
#
# Configure libraries
#
conf.env.LIB_PTHREAD = [ 'pthread' ]
conf.env.LIB_PROFILE = [ 'profiler' ]
conf.env.LIB_TCMALLOC = [ '' ]
#
# Configure a debug environment
#
env = conf.env.copy()
env.set_variant('debug')
conf.set_env_name('debug', env)
conf.setenv('debug')
conf.env.CXXFLAGS = ['-g', '-Wall', '--pedantic',
'-fno-omit-frame-pointer', '-std=c++0x']
#
# Configure a release environment
#
env = conf.env.copy()
env.set_variant('release')
conf.set_env_name('release', env)
conf.setenv('release')
conf.env.CXXFLAGS = ['-O3', '-Wall', '--pedantic',
'-fno-omit-frame-pointer']
def build(bld):
#****************************************
# libs
#
# header only libs; just documenting
# http_request.hpp
# lock.hpp
# unit_test.hpp
bld.new_task_gen( features = 'cxx cstaticlib',
source = """ spinlock.cpp
tree_node.cpp
combining_tree.cpp
thread.cpp
ticks_clock.cpp
"""
,
include = '.. .',
uselib = 'PTHREAD',
target = 'combine',
name = 'combine'
)
bld.new_task_gen( features = 'cxx cstaticlib',
source = """ spinlock.cpp
thread.cpp
ticks_clock.cpp
stat_counter.cpp
"""
,
include = '.. .',
uselib = 'PTHREAD',
target = 'stat_counter',
name = 'stat_counter'
)
bld.new_task_gen( features = 'cxx cstaticlib',
source = """ spinlock.cpp
single_lock_counter.cpp
thread.cpp
ticks_clock.cpp
""" ,
include = '.. .',
uselib = 'PTHREAD',
target = 'single_lock',
name = 'single_lock'
)
bld.new_task_gen( features = 'cxx cstaticlib',
source = """ spinlock.cpp
atomic_counter.cpp
thread.cpp
ticks_clock.cpp
""" ,
include = '.. .',
uselib = 'PTHREAD',
target = 'atomic',
name = 'atomic'
)
#****************************************
# TEST
#
bld.new_task_gen( features = 'cxx cprogram',
source = 'combining_tree_test.cpp',
includes = '.. .',
uselib = '',
uselib_local = 'combine',
target = 'combining_tree_test',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'stat_counter_test.cpp',
includes = '.. .',
uselib = '',
uselib_local = 'stat_counter',
target = 'stat_counter_test',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'single_lock_counter_test.cpp',
includes = '.. .',
uselib = '',
uselib_local = 'single_lock',
target = 'single_lock_counter_test',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'atomic_counter_test.cpp',
includes = '.. .',
uselib = '',
uselib_local = 'atomic',
target = 'atomic_counter_test',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'combining_tree_profile.cpp',
includes = '.. .',
uselib = 'PROFILE',
uselib_local = 'combine',
target = 'combining_tree_profile',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'single_lock_profile.cpp',
includes = '.. .',
uselib = 'PROFILE',
uselib_local = 'single_lock',
target = 'single_lock_profile',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'atomic_profile.cpp',
includes = '.. .',
uselib = 'PROFILE',
uselib_local = 'atomic',
target = 'atomic_profile',
unit_test = 1
)
bld.new_task_gen( features = 'cxx cprogram',
source = 'stat_counter_profile.cpp',
includes = '.. .',
uselib = 'PROFILE',
uselib_local = 'stat_counter',
target = 'stat_counter_profile',
unit_test = 1
)
#
# Build debug variant, if --debug was set
#
if Options.options.build_debug:
clone_to = 'debug'
else:
clone_to = 'release'
for obj in [] + bld.all_task_gen:
obj.clone(clone_to)
obj.posted = True # dont build in default environment