Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register QML modules at build time + use qmlcachegen #649

Merged
merged 3 commits into from
Aug 8, 2023

Conversation

Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Aug 3, 2023

Fixes #242

@Be-ing Be-ing marked this pull request as draft August 3, 2023 18:42
@Be-ing Be-ing force-pushed the qml_module branch 4 times, most recently from 6bb58d2 to 156277c Compare August 8, 2023 03:19
@Be-ing Be-ing changed the title [WIP] register QML modules at build time register QML modules at build time + use qmlcachegen Aug 8, 2023
@Be-ing Be-ing force-pushed the qml_module branch 13 times, most recently from 470f313 to 9591272 Compare August 8, 2023 06:46
@Be-ing Be-ing marked this pull request as ready for review August 8, 2023 06:53
@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 8, 2023

I removed the qml_extension_plugin example now that this is automatically generating QML plugins under the hood. If the user wants a dynamically linked QML extension plugin, that can easily be created by specifying crate-type = ["cdylib"] in Cargo.toml and linking ${CRATE} instead of "$<LINK_LIBRARY:WHOLE_ARCHIVE,${CRATE}-static>" in CMakeLists.txt.

@Be-ing Be-ing force-pushed the qml_module branch 2 times, most recently from 686cc14 to 4c69d3a Compare August 8, 2023 08:21
@ahayzen-kdab
Copy link
Collaborator

I removed the qml_extension_plugin example now that this is automatically generating QML plugins under the hood. If the user wants a dynamically linked QML extension plugin, that can easily be created by specifying crate-type = ["cdylib"] in Cargo.toml and linking ${CRATE} instead of "$<LINK_LIBRARY:WHOLE_ARCHIVE,${CRATE}-static>" in CMakeLists.txt.

I wonder if we should still have an example somewhere of using the crate-type as cdylib to a) show how this is done b) so we don't forget and c) to ensure it compiles, as i thought the dynamic linking before picked up some other cases.

Maybe it doesn't need to be explicitly called extension plugin, but instead dynamic linking or something. Although would this be for cargo-only builds ? For a CMake example where one is dynamic linking would you just create a CMake library and static link the Rust into that as normal ?

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 8, 2023

Maybe it doesn't need to be explicitly called extension plugin, but instead dynamic linking or something. Although would this be for cargo-only builds ? For a CMake example where one is dynamic linking would you just create a CMake library and static link the Rust into that as normal ?

A cdylib QML plugin example could be for either Cargo-only or CMake builds. With CMake, the cdylib generated by Cargo would be linked into the C++ executable.

@ahayzen-kdab
Copy link
Collaborator

Maybe it doesn't need to be explicitly called extension plugin, but instead dynamic linking or something. Although would this be for cargo-only builds ? For a CMake example where one is dynamic linking would you just create a CMake library and static link the Rust into that as normal ?

A cdylib QML plugin example could be for either Cargo-only or CMake builds. With CMake, the cdylib generated by Cargo would be linked into the C++ executable.

Lets instead document this in the book :-)

It will be redundant when we automatically generate a QML module
at build time.
Copy link
Collaborator

@ahayzen-kdab ahayzen-kdab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, lets start with this and any refactors of qt-build-utils etc can be later.

Awesome work getting the QML modules to build correctly and removing the qrc files 🎉 🥳

@ahayzen-kdab ahayzen-kdab enabled auto-merge (rebase) August 8, 2023 10:16
@ahayzen-kdab ahayzen-kdab merged commit cfe696c into KDAB:main Aug 8, 2023
@Be-ing Be-ing deleted the qml_module branch August 8, 2023 10:26
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.

ahead-of-time compilation of QML
3 participants