aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-01-29 12:43:37 -0800
committerChad Austin <chad@imvu.com>2013-03-04 19:06:20 -0800
commitbd4bc7050b70b71d035327199a18a8e0725d7f1d (patch)
treeca37a42256c57903837cc8a2a3f5553598f43665
parenteff17663bc9460f1f760eaeb9be04450347eba1e (diff)
allow cwd-relative paths when passing --compiler to emscripten.py
-rwxr-xr-xemscripten.py18
-rw-r--r--tools/shared.py11
2 files changed, 24 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py
index a0b34751..1ea6e0d7 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -44,7 +44,12 @@ def process_funcs(args):
ll = ''.join(funcs) + '\n' + meta
funcs_file = temp_files.get('.func_%d.ll' % i).name
open(funcs_file, 'w').write(ll)
- out = shared.run_js(compiler, compiler_engine, [settings_file, funcs_file, 'funcs', forwarded_file] + libraries, stdout=subprocess.PIPE, cwd=path_from_root('src'))
+ out = shared.run_js(
+ compiler,
+ engine=os.path.abspath(compiler_engine),
+ args=[settings_file, funcs_file, 'funcs', forwarded_file] + libraries,
+ stdout=subprocess.PIPE,
+ cwd=path_from_root('src'))
shared.try_delete(funcs_file)
return out
@@ -206,12 +211,15 @@ def emscript(configuration, infile, settings, outfile, libraries=[]):
# TODO: minimize size of forwarded data from funcs to what we actually need
- if cores == 1 and total_ll_size < MAX_CHUNK_SIZE: assert len(chunks) == 1, 'no point in splitting up without multiple cores'
+ if cores == 1 and total_ll_size < MAX_CHUNK_SIZE:
+ assert len(chunks) == 1, 'no point in splitting up without multiple cores'
if len(chunks) > 0:
if DEBUG: print >> sys.stderr, ' emscript: phase 2 working on %d chunks %s (intended chunk size: %.2f MB, meta: %.2f MB, forwarded: %.2f MB, total: %.2f MB)' % (len(chunks), ('using %d cores' % cores) if len(chunks) > 1 else '', chunk_size/(1024*1024.), len(meta)/(1024*1024.), len(forwarded_data)/(1024*1024.), total_ll_size/(1024*1024.))
- commands = [(i, chunks[i], meta, settings_file, compiler, forwarded_file, libraries) for i in range(len(chunks))]
+ commands = [
+ (i, chunks[i], meta, settings_file, compiler, forwarded_file, libraries)
+ for i in range(len(chunks))]
if len(chunks) > 1:
pool = multiprocessing.Pool(processes=cores)
@@ -616,7 +624,11 @@ 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')
+
+ global compiler_engine
compiler_engine = keywords.compiler
+
+ global jcache
jcache = keywords.jcache
temp_files.run_and_clean(lambda: main(keywords))
diff --git a/tools/shared.py b/tools/shared.py
index 585b2af2..7005dee4 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -497,9 +497,16 @@ def timeout_run(proc, timeout, note='unnamed process', full_output=False):
def run_js(filename, engine=None, args=[], check_timeout=False, stdout=PIPE, stderr=None, cwd=None, full_output=False):
if engine is None: engine = JS_ENGINES[0]
engine = listify(engine)
- #if not WINDOWS: 'd8' in engine[0] or 'node' in engine[0]: engine += ['--stack_size=8192'] # needed for some big projects
command = engine + [filename] + (['--'] if 'd8' in engine[0] else []) + args
- return timeout_run(Popen(command, stdout=stdout, stderr=stderr, cwd=cwd), 15*60 if check_timeout else None, 'Execution', full_output=full_output)
+ return timeout_run(
+ Popen(
+ command,
+ stdout=stdout,
+ stderr=stderr,
+ cwd=cwd),
+ 15*60 if check_timeout else None,
+ 'Execution',
+ full_output=full_output)
def to_cc(cxx):
# By default, LLVM_GCC and CLANG are really the C++ versions. This gets an explicit C version