windows下使用emscripten和cmake编译WebAssembly
需要先安装emsdk和mingw,假设mingw make为 C:/mingw32-make.exe
emsdk提示符下运行:
cmake.exe -DCMAKE_TOOLCHAIN_FILE=C:/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM:FILEPATH=C:/mingw32-make.exe -DCMAKE_BUILD_TYPE=Release -S "c:\src" -B "c:\build"
这一步根据情况可能需要修改生成的CMakeCache.txt,并运行多次
cmake配置完成后,build目录下运行:
emmake c:/mingw32-make.exe
c:/mingw32-make.exe install