Skip to content

Latest commit

 

History

History
92 lines (73 loc) · 4.87 KB

README.md

File metadata and controls

92 lines (73 loc) · 4.87 KB

Table of Contents generated with DocToc

Requirements

Commands

  • To compile C/C++

    • emcc hw.c -s WASM=1 -s SIDE_MODULE=1 -o hw.wasm
    • emcc hw.cpp -s WASM=1 -o hw.html
    • em++ hw.cpp -s WASM=1 --bind --std=c++11 -o hw.js
  • To update emsdk source run emsdk update or git pull&&emsdk update-tags (for the github repo clone)

  • To update emsdk used run emsdk install sdk-1.38.24-64bit change version to the latest (see emsdk list), this action will install 3 components: emscripten-1.38.24, clang-e1.38.24-64bit, node-8.9.1-64bit

  • To activate emsdk run emsdk activate sdk-1.38.24-64bit

Some docs

Options emscripten

all options here settings

  • -Os optimizations (O0, O1, O2, O3, Os, Oz)
  • -g generate wast, wasm, wasm.map
  • -s WASM=1 with JS polyfill
  • -s "BINARYEN_METHOD='native-wasm'" without polyfill (default)
    • methods: ['native-wasm', 'interpret-s-expr', 'interpret-binary', 'interpret-asm2wasm', 'asmjs']
  • -o <target> one of <name> + '.js' || '.html' || '.bc'(default) || '.o'
  • -s MAIN_MODULE=1 system libraries linked in or -s SIDE_MODULE=1 without
  • -s BINARYEN_ASYNC_COMPILATION=1
  • -s ONLY_MY_CODE=1 only compiles your methods, and stops Emscripten including parts of its standard library
  • -s EXPORTED_FUNCTIONS="['_my_func','_my_2d_func']" lists the methods we'd like to access from JavaScript. Note that these names are from the source, with a prefixed underscore.

Tools

Url's

Articles