Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate Web Assembly from CMake Project with a Specified HTML Output

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?

like image 574
Robbie Avatar asked Sep 01 '25 01:09

Robbie


1 Answers

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

like image 79
Gray Avatar answered Sep 02 '25 21:09

Gray