diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-03-05 14:44:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-03-05 14:44:42 -0800 |
commit | ad9ce81becf51181bd367ab19a812dbf0de6c899 (patch) | |
tree | a8803edc3f1ba86c32c92d35b83f9d71cbd215ed | |
parent | 73d6511550ec7ac895818b74360e87f799fd9171 (diff) | |
parent | 6fdaf94d6d439d5391b6446c796e0059308ae15e (diff) |
Merge branch 'master' into incoming
-rw-r--r-- | tools/scons/site_scons/site_tools/emscripten/__init__.py | 3 | ||||
-rw-r--r-- | tools/scons/site_scons/site_tools/emscripten/emscripten.py | 44 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tools/scons/site_scons/site_tools/emscripten/__init__.py b/tools/scons/site_scons/site_tools/emscripten/__init__.py new file mode 100644 index 00000000..8ae2288e --- /dev/null +++ b/tools/scons/site_scons/site_tools/emscripten/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python + +from emscripten import exists, generate diff --git a/tools/scons/site_scons/site_tools/emscripten/emscripten.py b/tools/scons/site_scons/site_tools/emscripten/emscripten.py new file mode 100644 index 00000000..cb14b58e --- /dev/null +++ b/tools/scons/site_scons/site_tools/emscripten/emscripten.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +import os + +def generate(env, emscripten_path=None, **kw): + """ SCons tool entry point """ + + if emscripten_path is None: + # Try to find emscripten + # Use same method as Emscripten's shared.py + EM_CONFIG = os.environ.get('EM_CONFIG') + if not EM_CONFIG: + EM_CONFIG = '~/.emscripten' + + CONFIG_FILE = os.path.expanduser(EM_CONFIG) + try: + exec(open(CONFIG_FILE, 'r').read()) + except Exception, e: + print >> sys.stderr, 'Error in evaluating %s (at %s): %s' % (EM_CONFIG, CONFIG_FILE, str(e)) + sys.exit(1) + + emscripten_path = EMSCRIPTEN_ROOT + + try: + emscPath = emscripten_path.abspath + except: + emscPath = emscripten_path + + env.Replace(CC = os.path.join(emscPath, "emcc" )) + env.Replace(CXX = os.path.join(emscPath, "em++" )) + env.Replace(LINK = os.path.join(emscPath, "emld" )) + # SHLINK and LDMODULE should use LINK so no + # need to change them here + + env.Replace(AR = os.path.join(emscPath, "emar" )) + env.Replace(RANLIB = os.path.join(emscPath, "emranlib")) + + env.Replace(OBJSUFFIX = [".js", ".bc", ".o"][2]) + env.Replace(LIBSUFFIX = [".js", ".bc", ".o"][2]) + env.Replace(PROGSUFFIX = [".html", ".js" ][1]) + +def exists(env): + """ NOOP method required by SCons """ + return 1 |