diff options
author | Chad Austin <chad@imvu.com> | 2013-01-30 16:01:59 -0800 |
---|---|---|
committer | Chad Austin <chad@imvu.com> | 2013-03-04 19:12:10 -0800 |
commit | 1c08fd0c42a53edbad9b36c25997aa008f4b8384 (patch) | |
tree | 297439f9e15bca24f8e142801279831613352fdb /emscripten.py | |
parent | 98f6c4d2d64d1b53a542306be86ab87e22f2cd0f (diff) |
Compile the relooper into the emscripten cache directory
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py index e98775aa..a117a216 100755 --- a/emscripten.py +++ b/emscripten.py @@ -497,7 +497,7 @@ Runtime.stackRestore = function(top) { asm.stackRestore(top) }; outfile.close() -def main(args, compiler_engine=None, jcache=None): +def main(args, compiler_engine, jcache, relooper): # Prepare settings for serialization to JSON. settings = {} for setting in args.settings: @@ -571,7 +571,11 @@ def main(args, compiler_engine=None, jcache=None): libraries = args.libraries[0].split(',') if len(args.libraries) > 0 else [] # Compile the assembly to Javascript. - if settings.get('RELOOP'): shared.Building.ensure_relooper() + if settings.get('RELOOP'): + if not relooper: + relooper = shared.Cache.get_path('relooper.js') + settings.setdefault('RELOOPER', relooper) + shared.Building.ensure_relooper(relooper) emscript(configuration, args.infile, settings, args.outfile, libraries, compiler_engine=compiler_engine, @@ -597,6 +601,9 @@ def _main(environ): parser.add_option('-c', '--compiler', default=shared.COMPILER_ENGINE, help='Which JS engine to use to run the compiler; defaults to the one in ~/.emscripten.') + parser.add_option('--relooper', + default=None, + help='Which relooper file to use if RELOOP is enabled') parser.add_option('-s', '--setting', dest='settings', default=[], @@ -628,14 +635,17 @@ WARNING: You should normally never use this! Use emcc instead. keywords.infile = os.path.abspath(positional[0]) if isinstance(keywords.outfile, basestring): keywords.outfile = open(keywords.outfile, 'w') + if keywords.relooper: - shared.RELOOPER = os.path.abspath(keywords.relooper) - keywords.settings.append("RELOOPER=" + json.dumps(shared.RELOOPER)) + relooper = os.path.abspath(keywords.relooper) + else: + relooper = None # use the cache temp_files.run_and_clean(lambda: main( keywords, compiler_engine=os.path.abspath(keywords.compiler), - jcache=shared.JCache if keywords.jcache else None)) + jcache=shared.JCache if keywords.jcache else None, + relooper=relooper)) if __name__ == '__main__': _main(environ=os.environ) |