[Qbs] Quick compiler with external library

Christian Gagneraud chgans at gmail.com
Tue May 12 08:08:00 CEST 2020


Hi there,

The UI of my app is a separate static library, i would like too use
the quick compiler in release mode, like so:
    Depends { name: "Qt"; submodules: "quick" }
    Qt.quick.useCompiler: qbs.buildVariant == "release"

The problem is that on Desktop, it doesn't link due to the external
resource having a different name, so as a temporary workaround, i'm
using:
#ifdef NDEBUG
    Q_INIT_RESOURCE(navico_ui_qtquickcompiler);
#else
    Q_INIT_RESOURCE(navico_ui);
#endif

Not elegant, but will do for now.

But it doesnt work at runtime, i get errors like:
qrc:/navico/ui/TestModuleUiLoader.js:-1 No such file or directory
Same story with android, with the addition of:
E libTestApp.so: "unterminated string"

Not sure if it is related tho.

2 hours later:
I ended up comparing CMake vs Qbs generated cpp, and it turned out
that this is what i need to do with Qbs:
#ifdef NDEBUG
    Q_INIT_RESOURCE(navico_ui_qtquickcompiler);
    Q_INIT_RESOURCE(navico_ui_qrc_navico_ui_qtquickcompiler);
#else
    Q_INIT_RESOURCE(navico_ui);
#endif

With CMake 'Q_INIT_RESOURCE(navico_ui);' works in both cases.

Looks like a bug to me. What do you think?

Chris


More information about the Qbs mailing list