Building your wasm app with a custom HTML page
-
Hi,
I'm building a Qt + OpenGL + Webassembly app using CMake and Qt Creator. All builds and runs fine.However, now I want to change the HTML, that is generated along with the wasm file. I put the html file into site/index.html. I can now enable the install step and install everything into a folder, that is served by apache like that:
set(MY_INSTALL_FILES "$<TARGET_FILE_DIR:plain_renderer>/plain_renderer.js" "$<TARGET_FILE_DIR:plain_renderer>/plain_renderer.wasm" "$<TARGET_FILE_DIR:plain_renderer>/qtloader.js" "${CMAKE_SOURCE_DIR}/site/index.html" "${CMAKE_SOURCE_DIR}/site/mascot.png" ) if (MY_ENABLE_THREADING) list(APPEND MY_INSTALL_FILES "$<TARGET_FILE_DIR:plain_renderer>/plain_renderer.worker.js") endif() install(FILES ${MY_INSTALL_FILES} DESTINATION ${MY_INSTALL_DIR})
however, when i simply click on the run button in creator, the default html, which is generated automatically, is put into the build directory and started. that obviously doesn't include my changes.
I can copy my own files into the build dir by
configure_file(site/index.html index.html COPYONLY) configure_file(site/mascot.png mascot.png COPYONLY)
but the run button still starts plain_renderer.html. I can see that in Projects -> WebAssembly -> Run -> Effective emrun call. I tried to change it to index.html, but it is always overwritten, and doesn't take effect.
Is that a bug? Is there a canonical way to build with your own html files?
-
This is a known issue, please follow progress on this:
https://bugreports.qt.io/browse/QTBUG-109959