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

 

posted @ 2021-06-04 14:10  wiki3D  阅读(1926)  评论(0编辑  收藏  举报