shithub: aubio

Download patch

ref: 40792b2ef7f967e07626b22f6f120397a5f76317
parent: 541ea2803810e770a0f7ae1937c0f80aeefbbb19
author: Martin Hermant <martin.hermant@gmail.com>
date: Mon May 29 14:30:33 EDT 2017

wscript : use gen_external code to generate flags passed to emscripten

--- a/wscript
+++ b/wscript
@@ -238,6 +238,15 @@
             ctx.env.LINKFLAGS += ['-Oz']
             ctx.env.cshlib_PATTERN = '%s.min.js'
         
+         # import exposed function names
+        from python.lib.gen_external import get_c_declarations,get_cpp_objects_from_c_declarations,get_all_func_names_from_lib,generate_lib_from_c_declarations
+        c_decls = get_c_declarations(usedouble=False) #emscripten can't use double
+        objects = get_cpp_objects_from_c_declarations(c_decls)
+        objects+=['fvec']
+        lib =  generate_lib_from_c_declarations(objects,c_decls)
+        exported_funcnames = get_all_func_names_from_lib(lib)
+        c_mangled_names = ['_'+s for s in exported_funcnames]
+        ctx.env.LINKFLAGS_cshlib += ['-s','EXPORTED_FUNCTIONS=%s'%c_mangled_names]
         ctx.env.cprogram_PATTERN = "%s.js"
         if (ctx.options.enable_atlas != True):
             ctx.options.enable_atlas = False