Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add Tool support for SCons #290

Merged
merged 1 commit into from

1 participant

@ghost

To use:

  • Link emscripten directory to /site_scons/site_tools/emscripten
  • Load into an Environment via env.Tool("emscripten")
  • Use Program and Library normally in SCons
LCID Fire Add Tool support for SCons
To use:
* Link emscripten directory to <ProjectRoot>/site_scons/site_tools/emscripten
* Load into an Environment via env.Tool("emscripten")
* Use Program and Library normally in SCons
9bcecf4
@kripken kripken merged commit 6fdaf94 into kripken:master
@kripken
Owner

Can you maybe make an example for using this?

@ghost

SConscript could look like this:

env = Environment()
env.Tool("emscripten")
env.Program(
    target = "test",
    source = "test.c"
)
@kripken
Owner

Thanks, what would be the best file to add the example to, do you think?

@ghost

Where are the pointers to emmaken.py located?

@kripken
Owner

Mentions of emmake, emconfigure etc. are mainly in https://github.com/kripken/emscripten/wiki/Building-Projects , maybe we should add scons stuff to there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 3, 2012
  1. Add Tool support for SCons

    LCID Fire authored
    To use:
    * Link emscripten directory to <ProjectRoot>/site_scons/site_tools/emscripten
    * Load into an Environment via env.Tool("emscripten")
    * Use Program and Library normally in SCons
This page is out of date. Refresh to see the latest.
View
3  tools/scons/site_scons/site_tools/emscripten/__init__.py
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+
+from emscripten import exists, generate
View
44 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
Something went wrong with that request. Please try again.