WASM: Make wasm_shell.html compatible with CMake configure_file
The CMake configure_file command is commonly used copy & modify template files during the build process. One limitation, thought, is that configure_file expect the variables to be replaced to be encoded using either a @APPNAME@ or ${APPNAME} convention. This commit therefore changes "APPNAME" to "@APPNAME@" in wasm_shell.html to make the HTML template file compatible with CMake configure_file. With this commit, it becomes possible to write the following CMake function that mimics what QMake is already doing: function(copy_html_js_launch_files target) set(APPNAME ${target}) configure_file("${_qt5Core_install_prefix}/plugins/platforms/wasm_shell.html" "${target}.html") configure_file("${_qt5Core_install_prefix}/plugins/platforms/qtloader.js" qtloader.js COPYONLY) endfunction() Change-Id: Ic38abdc498ba03b8d21f1b9b70aa1d480ae7f362 Reference: https://cmake.org/cmake/help/latest/command/configure_file.html Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
bd55a9d912
commit
2a2f04205c
@ -67,7 +67,7 @@ contains(TEMPLATE, .*app) {
|
||||
# replacing the app name placeholder with the actual app name.
|
||||
apphtml.name = application main html file
|
||||
apphtml.output = $$DESTDIR/$$TARGET_HTML
|
||||
apphtml.commands = sed -e s/APPNAME/$$TARGET_BASE/g $$WASM_PLUGIN_PATH/wasm_shell.html > $$DESTDIR/$$TARGET_HTML
|
||||
apphtml.commands = sed -e s/@APPNAME@/$$TARGET_BASE/g $$WASM_PLUGIN_PATH/wasm_shell.html > $$DESTDIR/$$TARGET_HTML
|
||||
apphtml.input = $$WASM_PLUGIN_PATH/wasm_shell.html
|
||||
apphtml.depends = $$apphtml.input
|
||||
QMAKE_EXTRA_COMPILERS += apphtml
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>APPNAME</title>
|
||||
<title>@APPNAME@</title>
|
||||
<style>
|
||||
html, body { padding: 0; margin : 0; overflow:hidden; height: 100% }
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
@ -18,7 +18,7 @@
|
||||
<figure style="overflow:visible;" id="qtspinner">
|
||||
<center style="margin-top:1.5em; line-height:150%">
|
||||
<img src="qtlogo.svg"; width=320; height=200; style="display:block"> </img>
|
||||
<strong>Qt for WebAssembly: APPNAME</strong>
|
||||
<strong>Qt for WebAssembly: @APPNAME@</strong>
|
||||
<div id="qtstatus"></div>
|
||||
<noscript>JavaScript is disabled. Please enable JavaScript to use this application.</noscript>
|
||||
</center>
|
||||
@ -57,7 +57,7 @@
|
||||
canvas.style.display = 'block';
|
||||
},
|
||||
});
|
||||
qtLoader.loadEmscriptenModule("APPNAME");
|
||||
qtLoader.loadEmscriptenModule("@APPNAME@");
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="qtloader.js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user