You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
[HTML5] Scons now expects "emcc" to be in PATH.
No longer parse emscripten/emsdk config to detect emcc/node paths. Use WhereIs to find "emcc" and "node", look for "node_modules" in "emcc" path. (cherry picked from commit7998745237) (cherry picked from commit2d5f9c53b0)
This commit is contained in:
committed by
Rémi Verschelde
parent
2407df9870
commit
0948ca9f83
@@ -1,28 +1,11 @@
|
||||
import os
|
||||
|
||||
|
||||
def parse_config():
|
||||
em_config_file = os.getenv("EM_CONFIG") or os.path.expanduser("~/.emscripten")
|
||||
if not os.path.exists(em_config_file):
|
||||
raise RuntimeError("Emscripten configuration file '%s' does not exist" % em_config_file)
|
||||
|
||||
normalized = {}
|
||||
em_config = {}
|
||||
with open(em_config_file) as f:
|
||||
try:
|
||||
# Emscripten configuration file is a Python file with simple assignments.
|
||||
exec(f.read(), em_config)
|
||||
except StandardError as e:
|
||||
raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e))
|
||||
normalized["EMCC_ROOT"] = em_config.get("EMSCRIPTEN_ROOT")
|
||||
normalized["NODE_JS"] = em_config.get("NODE_JS")
|
||||
normalized["CLOSURE_BIN"] = os.path.join(normalized["EMCC_ROOT"], "node_modules", ".bin", "google-closure-compiler")
|
||||
return normalized
|
||||
from SCons.Util import WhereIs
|
||||
|
||||
|
||||
def run_closure_compiler(target, source, env, for_signature):
|
||||
cfg = parse_config()
|
||||
cmd = [cfg["NODE_JS"], cfg["CLOSURE_BIN"]]
|
||||
closure_bin = os.path.join(os.path.dirname(WhereIs("emcc")), "node_modules", ".bin", "google-closure-compiler")
|
||||
cmd = [WhereIs("node"), closure_bin]
|
||||
cmd.extend(["--compilation_level", "ADVANCED_OPTIMIZATIONS"])
|
||||
for f in env["JSEXTERNS"]:
|
||||
cmd.extend(["--externs", f.get_abspath()])
|
||||
|
||||
Reference in New Issue
Block a user