<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Qt 6.2.1 CMake build generates app.js and app.wasm files for my project, but not the expected app.html and qtloader.js.  What am I doing wrong?]]></title><description><![CDATA[<p dir="auto">I've had Qt wasm projects working nicely in the past with Qt5 and qmake, but I've now come back to it and wanted to play with Qt 6.2.1 and that meant it was probably time to get on the CMake train too.  (Using Qt installed via MaintainanceTool).</p>
<p dir="auto">I figured out enough CMake to be able to build a native app (on Debian oldstable amd64).  (This is just using commandline and text-editor, not Creator or any IDE). Then tried a wasm build off of the same CMakeList.txt... and while I seemed to get a test.js and test.wasm file ("test" is the project name, rather than "app" used in the examples at <a href="https://doc-snapshots.qt.io/qt6-dev/wasm.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc-snapshots.qt.io/qt6-dev/wasm.html</a> ), there was no sign of the expected accompanying test.html and qtloader.js files.  Nor did grepping reveal anything obviously relating to those files in the generated Makefiles, so they do not seem to be "targets".</p>
<p dir="auto">Any ideas what's supposed to produce them?  Does something need adding to the CMakeLists.txt file to get them?</p>
<p dir="auto">My CMakeLists.txt is</p>
<pre><code>cmake_minimum_required(VERSION 3.13)

project(test VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt6 COMPONENTS Core REQUIRED)
find_package(Qt6 COMPONENTS Quick REQUIRED)
find_package(Qt6 COMPONENTS Gui REQUIRED)
find_package(Qt6 COMPONENTS Qml REQUIRED)
find_package(Qt6 COMPONENTS Svg REQUIRED)

include_directories(
  ${Qt6Core_INCLUDE_DIRS}
  ${Qt6Quick_INCLUDE_DIRS}
  ${Qt6Gui_INCLUDE_DIRS}
  ${Qt6Qml_INCLUDE_DIRS}
  ${Qt6Svg_INCLUDE_DIRS}
  )

add_executable(test
  main.cpp
  resources.qrc
  )

target_compile_options(test PRIVATE -fPIC)

target_link_libraries(test PRIVATE ${Qt6Core_LIBRARIES} ${Qt6Quick_LIBRARIES} ${Qt6Gui_LIBRARIES} ${Qt6Qml_LIBRARIES} ${Qt6Svg_LIBRARIES})
</code></pre>
<p dir="auto">and the commands I'm using to build it are</p>
<pre><code>source ${HOME}/project/git/emsdk/emsdk_env.sh

export QTDIR=${HOME}/Qt/6.2.1/wasm_32
export PATH=${QTDIR}/bin/:${PATH}
export CMAKE_PREFIX_PATH=${QTDIR}/lib/cmake
${QTDIR}/bin/qt-cmake -Wno-dev -DQT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT=3.18 -DCMAKE_BUILD_TYPE:String=Debug -G "Unix Makefiles" .
</code></pre>
<p dir="auto">But that just gets me two of the four files expected.</p>
<p dir="auto">App itself is completely minimal... a main.cpp with a QQuickView opening some trivial QML from a qrc file.</p>
<p dir="auto">(I'm assuming the information at <a href="https://doc-snapshots.qt.io/qt6-dev/wasm.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc-snapshots.qt.io/qt6-dev/wasm.html</a> is still correct and wasm builds haven't moved to some new model where you're supposed to embed the .js in your own HTML).</p>
<p dir="auto">(I'd try setting up a qmake build for it next, assuming that's still available in 6.2.1... except it's Qt WS 21 tomorrow to be distracted by.)</p>
]]></description><link>https://forum.qt.io/topic/131656/qt-6-2-1-cmake-build-generates-app-js-and-app-wasm-files-for-my-project-but-not-the-expected-app-html-and-qtloader-js-what-am-i-doing-wrong</link><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 04:38:14 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/131656.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Nov 2021 00:48:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt 6.2.1 CMake build generates app.js and app.wasm files for my project, but not the expected app.html and qtloader.js.  What am I doing wrong? on Tue, 09 Nov 2021 00:02:43 GMT]]></title><description><![CDATA[<p dir="auto">Try changing add_executable to qt_add_executable</p>
]]></description><link>https://forum.qt.io/post/689170</link><guid isPermaLink="true">https://forum.qt.io/post/689170</guid><dc:creator><![CDATA[Babalas]]></dc:creator><pubDate>Tue, 09 Nov 2021 00:02:43 GMT</pubDate></item><item><title><![CDATA[Reply to Qt 6.2.1 CMake build generates app.js and app.wasm files for my project, but not the expected app.html and qtloader.js.  What am I doing wrong? on Mon, 08 Nov 2021 04:11:54 GMT]]></title><description><![CDATA[<p dir="auto">I don't think cmake support is actually working going on: <a href="https://bugreports.qt.io/browse/QTCREATORBUG-24807" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io/browse/QTCREATORBUG-24807</a></p>
<p dir="auto">Or there is something extra we need that isn't in the documentation.</p>
]]></description><link>https://forum.qt.io/post/688969</link><guid isPermaLink="true">https://forum.qt.io/post/688969</guid><dc:creator><![CDATA[Babalas]]></dc:creator><pubDate>Mon, 08 Nov 2021 04:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to Qt 6.2.1 CMake build generates app.js and app.wasm files for my project, but not the expected app.html and qtloader.js.  What am I doing wrong? on Mon, 08 Nov 2021 02:05:41 GMT]]></title><description><![CDATA[<p dir="auto">Just noticed the same thing. Switched over to cmake and app.html and qtloader.js aren't being created. I have installed a later cmake so that's not it.</p>
<p dir="auto">As an aside you can make your CMakeLists.txt file a little simpler:</p>
<pre><code># It'll automatically include requirements so you don't need to list everything. I frequently do just
# to be explicit
find_package(Qt6 COMPONENTS Quick Svg REQUIRED)

add_executable(test
  main.cpp
  resources.qrc
  )

target_compile_options(test PRIVATE -fPIC)
# This will set your includes and libraries for you using cmake library targets
target_link_libraries(test PRIVATE Qt::Quick Qt::Svg)
</code></pre>
]]></description><link>https://forum.qt.io/post/688965</link><guid isPermaLink="true">https://forum.qt.io/post/688965</guid><dc:creator><![CDATA[Babalas]]></dc:creator><pubDate>Mon, 08 Nov 2021 02:05:41 GMT</pubDate></item><item><title><![CDATA[Reply to Qt 6.2.1 CMake build generates app.js and app.wasm files for my project, but not the expected app.html and qtloader.js.  What am I doing wrong? on Wed, 03 Nov 2021 21:50:28 GMT]]></title><description><![CDATA[<p dir="auto">You could always install cmake manually into /opt and then use that version instead.</p>
]]></description><link>https://forum.qt.io/post/688340</link><guid isPermaLink="true">https://forum.qt.io/post/688340</guid><dc:creator><![CDATA[lorn.potter]]></dc:creator><pubDate>Wed, 03 Nov 2021 21:50:28 GMT</pubDate></item><item><title><![CDATA[Reply to Qt 6.2.1 CMake build generates app.js and app.wasm files for my project, but not the expected app.html and qtloader.js.  What am I doing wrong? on Wed, 03 Nov 2021 10:51:07 GMT]]></title><description><![CDATA[<p dir="auto">Well it (wasm build) works as expected with Qt 6.2 qmake...</p>
<p dir="auto">I have a <a href="http://test.pro" target="_blank" rel="noopener noreferrer nofollow ugc">test.pro</a></p>
<pre><code>TEMPLATE = app

CONFIG += debug
CONFIG += qtquickcompiler

QT += core gui quick qml 

TARGET = test

SOURCES += main.cpp

RESOURCES += resources.qrc

cache()
</code></pre>
<p dir="auto">and then the commands</p>
<pre><code>source ${HOME}/project/git/emsdk/emsdk_env.sh

export QTDIR=${HOME}/Qt/6.2.1/wasm_32
export PATH=${QTDIR}/bin/:${PATH}

qmake test.pro &amp;&amp; make
</code></pre>
<p dir="auto">get me something with the expected index.html and other files that I can run just fine with</p>
<pre><code>${HOME}/project/git/emsdk/upstream/emscripten/emrun --browser=firefox test.html
</code></pre>
<p dir="auto">So it seems to be either my CMakeLists.txt needs some extra magic, or CMake and wasm builds have some issue.</p>
<p dir="auto">I note that my CMake build outputs a warning</p>
<pre><code> The minimum required CMake version to use Qt is: '3.21'.  You have
  explicitly chosen to require a lower minimum CMake version: '3.18'.  Using
  Qt with this CMake version is not officially supported.  Use at your own
  risk.
</code></pre>
<p dir="auto">Which I found a bit puzzling as I'd assumed using <code>Qt/6.2.1/wasm_32/bin/qt-cmake</code> was a "bundled" version of cmake and would be "good enough"... but on closer inspection it's just a shim forwarding to the system cmake, which for me is 3.18.4 (from Debian's oldstable-backports).  No idea if not using a 3.21+ version could be a contributing factor... at some point soon I'll upgrade to Debian "bullseye" and that has cmake 3.21 in bullseye-backports, so I'll find out then and report back.  But for now qmake seems to work.</p>
]]></description><link>https://forum.qt.io/post/688199</link><guid isPermaLink="true">https://forum.qt.io/post/688199</guid><dc:creator><![CDATA[timday]]></dc:creator><pubDate>Wed, 03 Nov 2021 10:51:07 GMT</pubDate></item></channel></rss>