diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-21 15:53:21 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-21 15:53:21 -0700 |
commit | 218cfaa4236a9f5ffa4abb4628e612299f5fc171 (patch) | |
tree | 9a241d6c3a78b717dba880d28158bf76b4864f5f | |
parent | 181824314fa2e77ff3a281d4e8cba3463318acc1 (diff) | |
parent | 367603568b18e2108d2f0b1a42cf7d3b9fec1862 (diff) |
Merge pull request #1197 from LCID-Fire/emscons
emscons
-rwxr-xr-x | emcc | 28 | ||||
-rwxr-xr-x | emscons | 20 |
2 files changed, 20 insertions, 28 deletions
@@ -28,34 +28,6 @@ Example uses: so it should relay everything to gcc/g++. You should not define that when running make, of course. - * With CMake, the same command will work (with cmake instead of ./configure). You may also be - able to do the following in your CMakeLists.txt: - - SET(CMAKE_C_COMPILER "PATH/emcc") - SET(CMAKE_CXX_COMPILER "PATH/em++") - SET(CMAKE_LINKER "PATH/emcc") - SET(CMAKE_CXX_LINKER "PATH/emcc") - SET(CMAKE_C_LINK_EXECUTABLE "PATH/emcc") - SET(CMAKE_CXX_LINK_EXECUTABLE "PATH/emcc") - SET(CMAKE_AR "PATH/emar") - SET(CMAKE_RANLIB "PATH/emranlib") - - * For SCons the shared.py can be imported like so: - __file__ = str(Dir('#/project_path_to_emscripten/dummy/dummy')) - __rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - def path_from_root(*pathelems): - return os.path.join(__rootpath__, *pathelems) - sys.path += [path_from_root('')] - from tools.shared import * - - For using the Emscripten compilers/linkers/etc. you can do: - env = Environment() - ... - env.Append(CCFLAGS = COMPILER_OPTS) - env.Replace(LINK = LLVM_LD) - env.Replace(LD = LLVM_LD) - TODO: Document all relevant setup changes - After setting that up, run your build system normally. Note the appearance of em++ instead of emcc diff --git a/emscons b/emscons new file mode 100755 index 00000000..2666f18c --- /dev/null +++ b/emscons @@ -0,0 +1,20 @@ +#!/usr/bin/env python2 + +''' +Wrapping the scons invocation, EMSCRIPTEN_TOOL_PATH is set in the process +environment, and can be used to locate the emscripten SCons Tool. +Example: +# Load emscripten Tool +my_env = Environment(tools=['emscripten'], toolpath=[os.environ['EMSCRIPTEN_TOOL_PATH']]) +''' + +import os, subprocess, sys +from tools import shared + +tool_path = os.path.join(shared.path_from_root('tools'), 'scons', 'site_scons', 'site_tools', 'emscripten') + +env = os.environ.copy() +env[ 'EMSCRIPTEN_TOOL_PATH' ] = tool_path + +exit(subprocess.call(sys.argv[1:], env=env)) + |