Skip to content

cmake+forms: install the MorphForms QML module as the forms_qml component, and ship the header qt_forms includes - #811

Merged
Yaraslaut merged 1 commit into
masterfrom
feature/forms-qml-install
Sep 25, 2026
Merged

Yaraslaut merged 1 commit into
masterfrom
feature/forms-qml-install

Conversation

@Yaraslaut

Copy link
Copy Markdown
Member

cmake --install of a MORPH_BUILD_FORMS_QML=ON build installed no QML module (nothing to link, nothing to import), and the one forms header it did install did not compile from the install:

forms_controller_core.hpp(32): fatal error C1083: Cannot open include file: 'morph/qt/qt_executor.hpp'

(qt_executor.hpp belonged only to the qt component, which needs Qt WebSockets.) In-tree builds and header-set verification read the source tree, so neither saw it.

Change Detail
qt_forms ships qt_executor.hpp QtCore-only; now in both header sets
new component forms_qml morph::forms_qml + morph::forms_qmlplugin + the OUTPUT_TARGETS object libraries (compiled resources, static plugin initialiser) — without them the app links but finds no MorphForms at run time; all with EXPORT_NAMEs (no morph::morph_*)
tooling files qmldir, .qmltypes, sources → MORPH_INSTALL_QMLDIR (default <libdir>/qml), exported as morph_QML_IMPORT_PATH; installed qmldir linktarget rewritten to morph::forms_qmlplugin (what a static-Qt/WASM build's QML plugin import resolves)
morphConfig.cmake find_dependency(Qt6 6.5 COMPONENTS Core Gui Qml Quick) for forms_qml

Consumer usage (README + forms.md "Shipped Qt/QML reference renderer"):

find_package(morph CONFIG REQUIRED COMPONENTS forms_qml qt_forms)
target_link_libraries(app PRIVATE morph::forms_qmlplugin morph::qt_forms)

Verification: new scripts/check_forms_qml_install.sh installs to a scratch prefix, then builds and runs an app that instantiates DynamicForm from import MorphForms; its vacuity guard runs the same app without the plugin and requires it to fail (module "MorphForms" plugin ... not found). Local run on Windows (MSVC 14.51, Qt 6.11.1): all steps ok. New CI job install-export-forms-qml (ubuntu-24.04, Qt 6.8.1) runs it — first run is on this PR. forms_qml_logic 317 passed.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…nent, and ship the header qt_forms includes

`cmake --install` of a MORPH_BUILD_FORMS_QML=ON build installed the
controller-core header and nothing of the QML module itself, so a packaged
morph -- a vcpkg port, say -- could not be used to render a form: there was no
target to link and no module to import. And the one piece that was installed
could not be compiled from the install: measured against a Windows install
built with MORPH_BUILD_FORMS_QML alone,

    forms_controller_core.hpp(32): fatal error C1083: Cannot open include
    file: 'morph/qt/qt_executor.hpp'

because qt_executor.hpp belongs to the `qt` component (MORPH_BUILD_QT, which
needs Qt WebSockets). The in-tree build and the header-set verification both
read the source tree, so neither could see it.

  - `qt_forms` now lists qt_executor.hpp in its own header set (it needs only
    QtCore), so the component installs what it includes.
  - The QML module installs and exports as `forms_qml`: `morph::forms_qml`
    (backing library) and `morph::forms_qmlplugin`, plus the object libraries
    `qt_add_qml_module(... OUTPUT_TARGETS)` reports for a static module -- its
    compiled resources and the plugin's static initialiser. Without those an
    application links and then finds no MorphForms at run time. Each gets an
    EXPORT_NAME so nothing arrives as morph::morph_*.
  - qmldir, the .qmltypes and the sources go to MORPH_INSTALL_QMLDIR
    (default <libdir>/qml) for tooling, exported to consumers as
    `morph_QML_IMPORT_PATH`. The installed qmldir's `linktarget` is rewritten
    to `morph::forms_qmlplugin`, the name a static-Qt build's QML plugin
    import looks the plugin up by.
  - morphConfig.cmake finds Qt6 Core/Gui/Qml/Quick for the component.

scripts/check_forms_qml_install.sh measures it the way check_install_export.sh
measures the C++ side: install to a scratch prefix, then build and *run* an
application that instantiates DynamicForm from `import MorphForms` via
find_package(morph COMPONENTS forms_qml qt_forms). Its vacuity guard runs the
same application linked against morph::forms_qml without the plugin, which
must fail (`module "MorphForms" plugin "morph_forms_moduleplugin" not
found`), so the check is shown to measure the plugin. Run locally on Windows
(MSVC 14.51, Qt 6.11.1): all four steps ok. New CI job
install-export-forms-qml runs it on ubuntu-24.04 with Qt 6.8.1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Yaraslaut
Yaraslaut force-pushed the feature/forms-qml-install branch from 687a7ad to 8962fad Compare September 25, 2026 06:19
@Yaraslaut
Yaraslaut merged commit 36e17ab into master Sep 25, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant