-->

Generate Web Assembly from CMake Project with a Sp

2020-07-27 03:19发布

问题:

I have a CMake Project that I want to compile to Web assembly. To do so I used the following commands from the base folder of the project:

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/emsdk/emscripten/1.38.6/cmake/Modules/Platform/Emscripten.cmake -G "Unix Makefiles"

This successfully (or at least I think) generates a .wasm file and a .js file as well as the various cmake and make files .

I also want it to generate an html file, like you can with emcc (ie. emcc example.c -s WASM=1 -o output.html).

Is it possible to do this?

回答1:

You could try and set the CMAKE_EXECUTABLE_SUFFIX to .html on the command line or the CMakeLists.txt