From 87740479650d07ab4b571fae6d6fd805d6efa259 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 3 Oct 2017 15:27:37 +0200 Subject: [PATCH] src/wscript_build: on windows, use 'link /dump /symbols' to generate list of symbols --- src/wscript_build | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/wscript_build b/src/wscript_build index a3706226..b01bb30c 100644 --- a/src/wscript_build +++ b/src/wscript_build @@ -51,20 +51,21 @@ class gen_sym_file(Task.Task): def run(self): syms = {} reg = getattr(self.generator, 'export_symbols_regex','.+?') - binary_path = self.generator.link_task.outputs[0].abspath() if 'msvc' in self.env.CC_NAME: - reg_compiled = re.compile(r'External\s+\|\s+_(?P%s)\b' % reg) - cmd =(self.env.DUMPBIN or['dumpbin'])+['/symbols', binary_path] + outputs = [x.abspath() for x in self.generator.link_task.outputs] + binary_path = list(filter(lambda x: x.endswith('lib'), outputs))[0] + reg_compiled = re.compile(r'External\s+\|\s+(?P%s)\b' % reg) + cmd =(self.env.LINK_CC) + ['/dump', '/symbols', binary_path] else: # using gcc? assume we have nm + binary_path = self.generator.link_task.outputs[0].abspath() reg_compiled = re.compile(r'(T|D)\s+_(?P%s)\b'%reg) cmd = (self.env.NM or ['nm']) + ['-g', binary_path] - print (cmd) dump_output = self.generator.bld.cmd_and_log(cmd, quiet=STDOUT) - print (dump_output) - syms = [] + syms = set([]) for m in reg_compiled.finditer(dump_output): - syms += [m.group('symbol')] - print (m.group('symbol')) + syms.add(m.group('symbol')) + syms = list(syms) + syms.sort() self.outputs[0].write('EXPORTS\n'+'\n'.join(syms)) @TaskGen.feature('gensyms') @@ -81,7 +82,7 @@ for target in build_features: ctx(features = 'c ' + target, use = uselib + ['lib_objects'], target = 'aubio', - export_symbols_regex=r'(?:.*aubio|fvec|lvec|cvec|fmat)_.*', + export_symbols_regex=r'(?:.*aubio|fvec|lvec|cvec|fmat|new|del)_.*', vnum = ctx.env['LIB_VERSION']) # install headers, except _priv.h ones -- 2.11.0