-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwscript
129 lines (110 loc) · 3.56 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
# -*- python -*-
# automatically generated wscript
import waflib.Logs as msg
PACKAGE = {
'name': 'pluginsvc',
'author': ["Sebastien Binet"],
}
def pkg_deps(ctx):
ctx.use_pkg('pkg-settings')
return
def configure(ctx):
msg.debug('[configure] package name: '+PACKAGE['name'])
ctx.load('find_posixlibs')
ctx.find_posixlibs()
return
def build(ctx):
ctx.build_linklib(
name = "pluginsvc",
source = "src/PluginService.cpp",
includes = ["pluginsvc"],
defines= ["NDEBUG=1"],
export_includes = ["pluginsvc"],
)
ctx.build_app(
name = "gaudi-listcomps",
source = "src/listcomponents.cpp",
defines= ["NDEBUG=1"],
use = ["pluginsvc", "dl"],
)
ctx.build_linklib(
name = "MyCompLib",
source = "src/Class1.cxx src/Class2.cxx",
use = ["pluginsvc",],
)
ctx.build_linklib(
features = "gen_complist",
name = "MyComp",
source = "src/components/*.cxx",
use = ["pluginsvc", "MyCompLib"],
)
ctx.env['GENCOMPLIST'] = 'gaudi-listcomps.exe'
ctx.build_app(
name = "test-loading",
source = "src/test-loading.cpp",
use = ["pluginsvc"],
)
return
### ---------------------------------------------------------------------------
import waflib.Task
from waflib.TaskGen import feature, before_method, after_method, extension, after
@extension('.so')
@feature('gen_complist')
@after('symlink_tsk')
def schedule_gen_complist(self, node=None):
lnk_task = getattr(self, 'link_task', None)
if not lnk_task:
return
for n in lnk_task.outputs:
gen_complist_hook(self, n)
pass
@after('symlink_tsk')
def gen_complist_hook(self, node):
"Bind the .so file extension to the creation of a gen_complist task"
dso = node.name
bld_node = node.get_bld().parent
dso_ext = self.bld.dso_ext()
out_node = bld_node.make_node(dso.replace(dso_ext,".components"))
tsk = self.create_task('gen_complist', node, out_node)
self.source += tsk.outputs
#merge_dsomap_hook(self, out_node).set_run_after(tsk)
self.bld.install_files(
'${INSTALL_AREA}/lib',
out_node,
postpone=False,
)
class gen_complist(waflib.Task.Task):
vars = ['GENCOMPLIST', 'DEFINES', 'CPPFLAGS', 'INCLUDES']
color= 'BLUE'
run_str = '${GENCOMPLIST} ${SRC[0].name}'
ext_in = ['.so', '.dylib', '.dll', '.bin']
ext_out = ['.components']
shell = False
reentrant = True
after = ['cxxshlib', 'cxxprogram', 'symlink_tsk']
def exec_command(self, cmd, **kw):
cwd_node = self.outputs[0].parent
#out = self.outputs[0].change_ext('.gencomplist.log')
out = self.outputs[0]
fout_node = cwd_node.find_or_declare(out.name)
fout = open(fout_node.abspath(), 'w')
kw['stdout'] = fout
kw['stderr'] = fout
kw['env'] = self.generator.bld._get_env_for_subproc()
kw['cwd'] = self.inputs[0].get_bld().parent.abspath()
rc = waflib.Task.Task.exec_command(self, cmd, **kw)
if rc != 0:
msg.error("** error running [%s]" % ' '.join(cmd))
msg.error(fout_node.read())
return rc
def runnable_status(self):
status = waflib.Task.Task.runnable_status(self)
if status == waflib.Task.ASK_LATER:
return status
for out_node in self.outputs:
try:
os.stat(out_node.abspath())
except:
return waflib.Task.RUN_ME
return status
pass