I've just released nbind ( https://github.com/charto/nbind#readme ) which builds C++ projects into asm.js for web apps and native binary addons for Node.js or Electron. It works with GCC, Clang, Visual Studio and Emscripten on Linux, Windows and OS X.
nbind comes with headers using C++ templates that allow adding this kind of declaration at the end of a C++ source file:
#include "nbind/nbind.h"
NBIND_CLASS(MyClass) {
method(myMethod);
method(anotherMethod);
}
It auto-detects types of method parameters and return values using template magic (including things like std::vector<std::string>), and generates necessary bindings for calling the code from JavaScript or TypeScript. Native binaries and asm.js modules are easy to bundle into npm packages. Additionally asm.js modules can be included in web apps with script tags. The actual C++ code doesn't need any other changes.