Testing how to bind C++ code from JavaScript code in browser using nbind.
Depends on nbind to easily define addon's API and on autogypi to handle compiler & node-gyp options to compile native code. For a browser environment emscripten should be installed.
brew install emscriptem
LLVM_ROOT must be updated manually when installing using Homebrew. You should edit ~/.emscripten and change
LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/bin') # directory
to
LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/local/Cellar/llvm/3.2/bin') # directory
Initialize it like this:
npm run -- autogypi --init-gyp -p nbind -s greeter.cxx
Your package should also include binding.gyp and autogypi.json files.
for node environment (server)
node-gyp configure build
for browser environment
node-gyp configure build --asmjs=1