KDAB / cxx-qt

Safe interop between Rust and Qt
https://kdab.github.io/cxx-qt/book/
1.04k stars 70 forks source link

examples: add a unit test to ensure that qrc works #981

Closed ahayzen-kdab closed 2 months ago

LeonMatthesKDAB commented 3 months ago

Hm, I wonder whether we even want to support QRC files this way in a CMake-driven build.

There is really little reason to do this over simply adding the qrc file to the CMake build :thinking:

This should definitely work if you're running a Cargo-only build, but maybe we shouldn't support this in CMake-based builds?

ahayzen-kdab commented 3 months ago

I think it'd be tricky to explicitly disable for CMake builds and in theory shouldn't really be any different between CMake or Cargo builds as seen in the diff here.

For the object files the initialiser can just go into the crate's general initialiser so that we don't need to know the qrc name at the figure stage?

LeonMatthesKDAB commented 3 months ago

That would work, as long as the qrc call happens in the build script of the final crate. However, it wouldn't work for libraries, unless we somehow add this to the opts as well. Which would definitely require a different API, as you couldn't just call qrc on the builder :thinking:

ahayzen-kdab commented 3 months ago

Hmm fun, but that is also true for cargo builds too? Any qrc's added in cxx-qt-lib would need an initialiser to be passed through via opts to the final build script?

LeonMatthesKDAB commented 3 months ago

Cargo builds should work, even with dependencies as I'm adding the object file generated by each qrc file to the linker if it's a cargo-only build.

But I also haven't tested that yet.