Created
September 19, 2017 01:30
-
-
Save halferty/5b43d0e09df8e7e54344b4022e558236 to your computer and use it in GitHub Desktop.
Compile C++ to webassembly. Uses LLVM, binaryen, and wabt. This sequence of commands is ridiculous, but if you want the memory buffer exported from your C++ code, you'll need this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/Users/ehalferty/objc/build/bin/clang++ -emit-llvm --target=wasm32 -Oz src/cxx/test.cxx -c -o src/cxx/test.ll | |
llc src/cxx/test.ll -march=wasm32 -filetype=asm -o src/cxx/test.s | |
s2wasm src/cxx/test.s > src/cxx/test.wat | |
wat2wasm src/cxx/test.wat -o src/wasm/test.wasm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment