diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-18 19:22:09 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-18 19:22:09 -0700 |
commit | 1c11fdd98530b6d35e51c0eba14fb1f375d05229 (patch) | |
tree | bd471ce02003d0e1d16dfe773d1ed4d0acdcb499 /emscripten.py | |
parent | d6cff2177ec065aa14f228ab547abc29ef37b248 (diff) | |
parent | 327b6f859e95be71e5613f24cc1c9d4f4b97c15f (diff) |
merge
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/emscripten.py b/emscripten.py index 5674c33a..45c9f418 100755 --- a/emscripten.py +++ b/emscripten.py @@ -35,7 +35,7 @@ def path_from_root(*pathelems): temp_files = shared.TempFiles() -def emscript(infile, settings, outfile): +def emscript(infile, settings, outfile, libraries=[]): """Runs the emscripten LLVM-to-JS compiler. Args: @@ -49,7 +49,7 @@ def emscript(infile, settings, outfile): s.write(settings) s.close() compiler = path_from_root('src', 'compiler.js') - shared.run_js(compiler, shared.COMPILER_ENGINE, [settings_file, infile], stdout=outfile, cwd=path_from_root('src')) + shared.run_js(compiler, shared.COMPILER_ENGINE, [settings_file, infile] + libraries, stdout=outfile, cwd=path_from_root('src')) outfile.close() @@ -123,8 +123,11 @@ def main(args): #print >> sys.stderr, 'new defs:', str(defines).replace(',', ',\n '), '\n\n' settings.setdefault('C_DEFINES', {}).update(defines) + # libraries + libraries = args.libraries[0].split(',') if len(args.libraries) > 0 else [] + # Compile the assembly to Javascript. - emscript(args.infile, json.dumps(settings), args.outfile) + emscript(args.infile, json.dumps(settings), args.outfile, libraries) if __name__ == '__main__': parser = optparse.OptionParser( @@ -136,6 +139,10 @@ if __name__ == '__main__': default=[], action='append', help='System headers (comma separated) whose #defines should be exposed to the compiled code.') + parser.add_option('-L', '--libraries', + default=[], + action='append', + help='Library files (comma separated) to use in addition to those in emscripten src/library_*.') parser.add_option('-o', '--outfile', default=sys.stdout, help='Where to write the output; defaults to stdout.') |