brew install cmake複製代碼
# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git
# Enter that directory
cd emsdk
Fetch the latest version of the emsdk (not needed the first time you clone)
git pull
# Download and install the latest SDK tools.
./emsdk install latest #or ./emsdk install sdk-incoming-64bit binaryen-master-64bit
# Make the "latest" SDK "active" for the current user. (writes ~/.emscripten file)
./emsdk activate latest #or ./emsdk activate sdk-incoming-64bit binaryen-master-64bit
# Activate PATH and other environment variables in the current terminal
# 當前命令窗口
source ./emsdk_env.sh複製代碼
emcc
INFO root: (Emscripten: Running sanity checks)
WARNING root: no input files
lemon-Air:emsdk_portable複製代碼
hello.c#include <stdio.h>
int main( )
{
printf("Hello World!\n");
}
//保存爲hello.c
emcc hello.c
node a.out.js就能夠看到結果了複製代碼
參考:emscripten.org/docs/gettin…javascript
git clone https://github.com/WebAssembly/binaryen.git
cmake . && make
複製代碼
git clone --recursive https://github.com/WebAssembly/wabt
cd wabt
mkdir build
cd build
cmake ..
cmake --build .
# 或者直接運行
make
複製代碼
#test
bin/wat2wasm out/test.wat -o out/test.wasm複製代碼
參考資料:github.com/WebAssembly…html