问题描述
我有一个要编译为Web程序集的CMake项目。为此,我从项目的基本文件夹中使用了以下命令:
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"
此操作成功(或至少我认为)生成了 .wasm
文件和 .js
文件以及各种cmake和make文件。
This successfully (or at least I think) generates a .wasm
file and a .js
file as well as the various cmake and make files .
我也希望它生成一个html文件,就像您可以使用 emcc
(即 emcc example.c -s WASM = 1 -o output.html
)。
I also want it to generate an html file, like you can with emcc
(ie. emcc example.c -s WASM=1 -o output.html
).
是否可以这样做?
推荐答案
您可以尝试将 CMAKE_EXECUTABLE_SUFFIX
设置为<$ c $命令行上的c> .html 或 CMakeLists.txt
You could try and set the CMAKE_EXECUTABLE_SUFFIX
to .html
on the command line or the CMakeLists.txt
这篇关于使用指定的HTML输出从CMake项目生成Web程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!