Updated to add a PYTHON config option instead of defaulting to python2. This should preserve the default behavior in a way that can be overridden.
This commit is contained in:
Родитель
14077b9868
Коммит
a2bc9a30de
2
em++
2
em++
|
@ -8,5 +8,5 @@ import os, subprocess, sys
|
|||
from tools import shared
|
||||
|
||||
os.environ['EMMAKEN_CXX'] = '1'
|
||||
exit(subprocess.call(['python2', shared.EMCC] + sys.argv[1:]))
|
||||
exit(subprocess.call([shared.PYTHON, shared.EMCC] + sys.argv[1:]))
|
||||
|
||||
|
|
12
emcc
12
emcc
|
@ -925,9 +925,9 @@ try:
|
|||
# dlmalloc
|
||||
def create_dlmalloc():
|
||||
if DEBUG: print >> sys.stderr, 'emcc: building dlmalloc for cache'
|
||||
execute(shared.ENV_PREFIX + ['python2', shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr)
|
||||
execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr)
|
||||
# we include the libc++ new stuff here, so that the common case of using just new/delete is quick to link
|
||||
execute(shared.ENV_PREFIX + ['python2', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr)
|
||||
execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr)
|
||||
shared.Building.link([in_temp('dlmalloc.o'), in_temp('new.o')], in_temp('dlmalloc_full.o'))
|
||||
return in_temp('dlmalloc_full.o')
|
||||
def fix_dlmalloc():
|
||||
|
@ -950,7 +950,7 @@ try:
|
|||
os = []
|
||||
for src in ['algorithm.cpp', 'condition_variable.cpp', 'future.cpp', 'iostream.cpp', 'memory.cpp', 'random.cpp', 'stdexcept.cpp', 'system_error.cpp', 'utility.cpp', 'bind.cpp', 'debug.cpp', 'hash.cpp', 'mutex.cpp', 'string.cpp', 'thread.cpp', 'valarray.cpp', 'chrono.cpp', 'exception.cpp', 'ios.cpp', 'locale.cpp', 'regex.cpp', 'strstream.cpp', 'typeinfo.cpp']:
|
||||
o = in_temp(src + '.o')
|
||||
execute(shared.ENV_PREFIX + ['python2', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr)
|
||||
execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr)
|
||||
os.append(o)
|
||||
shared.Building.link(os, in_temp('libcxx.bc'))
|
||||
return in_temp('libcxx.bc')
|
||||
|
@ -969,7 +969,7 @@ try:
|
|||
os = []
|
||||
for src in ['private_typeinfo.cpp']:
|
||||
o = in_temp(src + '.o')
|
||||
execute(shared.ENV_PREFIX + ['python2', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr)
|
||||
execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr)
|
||||
os.append(o)
|
||||
shared.Building.link(os, in_temp('libcxxabi.bc'))
|
||||
return in_temp('libcxxabi.bc')
|
||||
|
@ -1075,7 +1075,7 @@ try:
|
|||
|
||||
if AUTODEBUG:
|
||||
if DEBUG: print >> sys.stderr, 'emcc: autodebug'
|
||||
execute(shared.ENV_PREFIX + ['python2', shared.AUTODEBUGGER, final, final + '.ad.ll'])
|
||||
execute([shared.PYTHON, shared.AUTODEBUGGER, final, final + '.ad.ll'])
|
||||
final += '.ad.ll'
|
||||
if DEBUG: save_intermediate('autodebug', 'll')
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ try:
|
|||
file_args += embed_files
|
||||
if Compression.on:
|
||||
file_args += ['--compress', Compression.encoder, Compression.decoder, Compression.js_name]
|
||||
code = execute(shared.ENV_PREFIX + ['python2', shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
|
||||
code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
|
||||
src = open(final).read().replace('// {{PRE_RUN_ADDITIONS}}', '// {{PRE_RUN_ADDITIONS}}\n' + code)
|
||||
final += '.files.js'
|
||||
open(final, 'w').write(src)
|
||||
|
|
|
@ -14,5 +14,5 @@ from tools.shared import *
|
|||
|
||||
emmaken = path_from_root('tools', 'emmaken.py')
|
||||
os.environ['EMMAKEN_CXX'] = '1'
|
||||
exit(subprocess.call(['python2', emmaken] + sys.argv[1:]))
|
||||
exit(subprocess.call([PYTHON, emmaken] + sys.argv[1:]))
|
||||
|
||||
|
|
|
@ -318,6 +318,12 @@ try:
|
|||
except:
|
||||
CLOSURE_COMPILER = path_from_root('third_party', 'closure-compiler', 'compiler.jar')
|
||||
|
||||
try:
|
||||
PYTHON
|
||||
except:
|
||||
print >> sys.stderr, 'PYTHON not defined in ~/.emscripten, using "python"'
|
||||
PYTHON = 'python'
|
||||
|
||||
try:
|
||||
JAVA
|
||||
except:
|
||||
|
@ -378,7 +384,7 @@ WINDOWS = sys.platform.startswith('win')
|
|||
ENV_PREFIX = []
|
||||
if not WINDOWS:
|
||||
try:
|
||||
assert 'Python' in Popen(['env', 'python2', '-V'], stdout=PIPE, stderr=STDOUT).communicate()[0]
|
||||
assert 'Python' in Popen(['env', 'python', '-V'], stdout=PIPE, stderr=STDOUT).communicate()[0]
|
||||
ENV_PREFIX = ['env']
|
||||
except:
|
||||
pass
|
||||
|
@ -862,13 +868,13 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
|
|||
if output_filename is None:
|
||||
output_filename = filename + '.o'
|
||||
try_delete(output_filename)
|
||||
Popen(ENV_PREFIX + ['python2', EMCC, filename] + args + ['-o', output_filename], stdout=stdout, stderr=stderr, env=env).communicate()
|
||||
Popen([PYTHON, EMCC, filename] + args + ['-o', output_filename], stdout=stdout, stderr=stderr, env=env).communicate()
|
||||
assert os.path.exists(output_filename), 'emcc could not create output file'
|
||||
|
||||
@staticmethod
|
||||
def emar(action, output_filename, filenames, stdout=None, stderr=None, env=None):
|
||||
try_delete(output_filename)
|
||||
Popen(ENV_PREFIX + ['python2', EMAR, action, output_filename] + filenames, stdout=stdout, stderr=stderr, env=env).communicate()
|
||||
Popen([PYTHON, EMAR, action, output_filename] + filenames, stdout=stdout, stderr=stderr, env=env).communicate()
|
||||
if 'c' in action:
|
||||
assert os.path.exists(output_filename), 'emar could not create output file'
|
||||
|
||||
|
@ -879,7 +885,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
|
|||
|
||||
# Run Emscripten
|
||||
settings = Settings.serialize()
|
||||
compiler_output = timeout_run(Popen(ENV_PREFIX + ['python2', EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling')
|
||||
compiler_output = timeout_run(Popen([PYTHON, EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling')
|
||||
#print compiler_output
|
||||
|
||||
# Detect compilation crashes and errors
|
||||
|
|
Загрузка…
Ссылка в новой задаче