summaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 2bd219a9..321fa073 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -295,7 +295,7 @@ def check_node_version():
# we re-check sanity when the settings are changed)
# We also re-check sanity and clear the cache when the version changes
-EMSCRIPTEN_VERSION = '1.4.2'
+EMSCRIPTEN_VERSION = '1.4.3'
def generate_sanity():
return EMSCRIPTEN_VERSION + '|' + get_llvm_target()
@@ -495,7 +495,7 @@ except:
# Target choice. Must be synced with src/settings.js (TARGET_*)
def get_llvm_target():
- return os.environ.get('EMCC_LLVM_TARGET') or 'i386-pc-linux-gnu' # 'le32-unknown-nacl'
+ return os.environ.get('EMCC_LLVM_TARGET') or 'le32-unknown-nacl' # 'i386-pc-linux-gnu'
LLVM_TARGET = get_llvm_target()
try:
@@ -509,6 +509,9 @@ COMPILER_OPTS = COMPILER_OPTS + ['-m32', '-U__i386__', '-U__i386', '-Ui386',
'-D__IEEE_LITTLE_ENDIAN', '-fno-math-errno', '-fno-threadsafe-statics',
'-target', LLVM_TARGET]
+if LLVM_TARGET == 'le32-unknown-nacl':
+ COMPILER_OPTS += ['-U__native_client__', '-U__pnacl__', '-U__ELF__'] # The nacl target is originally used for Google Native Client. Emscripten is not NaCl, so remove the platform #define, when using their triple.
+
USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK')
if USE_EMSDK:
@@ -673,8 +676,10 @@ class Settings:
Settings.EMIT_GENERATED_FUNCTIONS = 1
if opt_level >= 2:
Settings.RELOOP = 1
+ Settings.ALIASING_FUNCTION_POINTERS = 1
if opt_level >= 3:
# Aside from these, -O3 also runs closure compiler and llvm lto
+ Settings.FORCE_ALIGNED_MEMORY = 1
Settings.DOUBLE_MODE = 0
Settings.PRECISE_I64_MATH = 0
if noisy: logging.warning('Applying some potentially unsafe optimizations! (Use -O2 if this fails.)')
@@ -1203,7 +1208,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
return js_optimizer.run(filename, passes, listify(NODE_JS), jcache)
@staticmethod
- def closure_compiler(filename):
+ def closure_compiler(filename, pretty=True):
if not os.path.exists(CLOSURE_COMPILER):
raise Exception('Closure compiler appears to be missing, looked at: ' + str(CLOSURE_COMPILER))
@@ -1213,10 +1218,10 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
'-Xmx' + (os.environ.get('JAVA_HEAP_SIZE') or '1024m'), # if you need a larger Java heap, use this environment variable
'-jar', CLOSURE_COMPILER,
'--compilation_level', 'ADVANCED_OPTIMIZATIONS',
- '--formatting', 'PRETTY_PRINT',
'--language_in', 'ECMASCRIPT5',
#'--variable_map_output_file', filename + '.vars',
'--js', filename, '--js_output_file', filename + '.cc.js']
+ if pretty: args += ['--formatting', 'PRETTY_PRINT']
if os.environ.get('EMCC_CLOSURE_ARGS'):
args += shlex.split(os.environ.get('EMCC_CLOSURE_ARGS'))
process = Popen(args, stdout=PIPE, stderr=STDOUT)