Emscripten 实现 ncnn-webassembly-scrfd windows10
来源:https://zhuanlan.zhihu.com/p/372332267
代码链接:https://github.com/nihui/ncnn-webassembly-scrfd
1、安装 emsripten
git clone https://github.com/emscripten-core/emsdk.git cd emsdk ./emsdk install 2.0.8 ./emsdk activate 2.0.8 source emsdk/emsdk_env.sh
2、下载 ncnn webassembly包:cmake时需要
可以手动下载,将结果解压到build文件夹。在ncnn-webassembly-scrfd项目下CMakeLists中指定了该文件的位置。
wget https://github.com/nihui/ncnn/releases/download/20210519/ncnn-20210519-webassembly.zip
unzip ncnn-20210519-webassembly.zip
3、编译四个 WASM feature variants:
windows10下稍微有点不同。
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=basic .. make -j4 cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=simd .. make -j4 cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=threads .. make -j4 cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=simd-threads .. make -j4