aboutsummaryrefslogtreecommitdiff
path: root/scons-tools
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-05-17 12:52:32 -0700
committerChad Austin <chad@imvu.com>2013-05-17 13:04:09 -0700
commit184ff9ea2d18c09988226afb90328679e9818d0d (patch)
tree876b10b0db3ea1d44c45152c735fe6d488110411 /scons-tools
parentec19fe482bf564de68a076ed093af131d502bb30 (diff)
Add a demo that showcases using scons to build an embind library you can load from JavaScript.
Diffstat (limited to 'scons-tools')
-rwxr-xr-xscons-tools/emscripten.py15
-rwxr-xr-xscons-tools/llvm.py13
2 files changed, 15 insertions, 13 deletions
diff --git a/scons-tools/emscripten.py b/scons-tools/emscripten.py
index cdf960ac..473c51ad 100755
--- a/scons-tools/emscripten.py
+++ b/scons-tools/emscripten.py
@@ -41,6 +41,7 @@ def build_version_file(env):
'$EMSCRIPTEN_VERSION_FILE',
EMSCRIPTEN_DEPENDENCIES,
touch_file)
+
env.AddPostAction(
emscripten_version_file,
Delete(env.Dir('$EMSCRIPTEN_TEMP_DIR').abspath))
@@ -260,24 +261,18 @@ def generate(env):
JS_OPTIMIZER_PASSES=[],
LLVM_OPT_PASSES=['-std-compile-opts', '-std-link-opts'],
- # todo: calculate from __file__
- EMSCRIPTEN_HOME=env.Dir('#/third-party/emscripten'),
+ EMSCRIPTEN_HOME=env.Dir(os.path.join(os.path.dirname(__file__), '..')),
)
env.Replace(
- CC='${LLVM_ROOT}/clang',
- CXX='${LLVM_ROOT}/clang++',
- AR='${LLVM_ROOT}/llvm-link',
+ CC='${LLVM_ROOT}/${CLANG}',
+ CXX='${LLVM_ROOT}/${CLANGXX}',
+ AR='${LLVM_ROOT}/${LLVM_LINK}',
ARCOM='$AR -o $TARGET $SOURCES',
OBJSUFFIX='.bc',
LIBPREFIX='',
LIBSUFFIX='.bc',
RANLIBCOM='',
- # todo: remove
- _LIBFLAGS='',
- _LIBDIRFLAGS='',
- # comment this out:
- LINK=os.path.join('${LLVM_ROOT}', 'llvm-link'),
CCFLAGS=[
'-U__STRICT_ANSI__',
'-target', 'le32-unknown-nacl',
diff --git a/scons-tools/llvm.py b/scons-tools/llvm.py
index 2e03caa3..f272bd16 100755
--- a/scons-tools/llvm.py
+++ b/scons-tools/llvm.py
@@ -15,12 +15,19 @@ def add_libraries(target, source, env):
return (target, source + unique)
def generate(env):
+ env.SetDefault(
+ CLANG='clang',
+ CLANGXX='clang++',
+ LLVM_DIS='llvm-dis',
+ LLVM_OPT='opt',
+ LLVM_LINK='llvm-link')
+
env['BUILDERS']['LLVMDis'] = Builder(
- action='${LLVM_ROOT}/llvm-dis -o=$TARGET $SOURCE')
+ action='${LLVM_ROOT}/$LLVM_DIS -o=$TARGET $SOURCE')
env['BUILDERS']['LLVMOpt'] = Builder(
- action='${LLVM_ROOT}/opt $LLVM_OPT_FLAGS $LLVM_OPT_PASSES -o=$TARGET $SOURCE')
+ action='${LLVM_ROOT}/$LLVM_OPT $LLVM_OPT_FLAGS $LLVM_OPT_PASSES -o=$TARGET $SOURCE')
env['BUILDERS']['LLVMLink'] = Builder(
- action='${LLVM_ROOT}/llvm-link -o=$TARGET $SOURCES',
+ action='${LLVM_ROOT}/$LLVM_LINK -o=$TARGET $SOURCES',
emitter=add_libraries)