Skip to content

Commit

Permalink
Merge branch 'master' into incoming
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Mar 5, 2012
2 parents 73d6511 + 6fdaf94 commit ad9ce81
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/scons/site_scons/site_tools/emscripten/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env python

from emscripten import exists, generate
44 changes: 44 additions & 0 deletions tools/scons/site_scons/site_tools/emscripten/emscripten.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ad9ce81

Please sign in to comment.