0

I'm dealing with a build problem for my Qt desktop application. I'm using QT 5.7.

As far as I know, for qt mac applications, I need to use QMAKE_BUNDLE_DATA to bundle all the resources into the .app, so I used it. I also defined custom targets for the make file which runs an external command(rcc) which generates some .rcc files that need to be copied into the .app bundle.

...
CMD_RCC += "rcc -binary "$${QRC_FILE}" -o "$${RCC_FILE}

creatercc.commands = $$CMD_RCC
creatercc-check.commands = $$CMD_RCC
creatercc-make_first.commands = $$CMD_RCC
creatercc-make_default.commands = $$CMD_RCC
creatercc-make_all.commands = $$CMD_RCC
creatercc-qmake_all.commands = $$CMD_RCC

QMAKE_EXTRA_TARGETS *= creatercc creatercc-check creatercc-make_default creatercc-make_first creatercc-make_all creatercc-qmake_all creatercc-clean creatercc-distclean
PRE_TARGETDEPS *= creatercc

macx{
    DEPLOYDIR = $$PWD/deploy

    LAUNCHER_THEMES.files = \
        $$PWD/deploy/themes/res.rcc
    LAUNCHER_THEMES.path = Contents/Resources/themes
    QMAKE_BUNDLE_DATA += LAUNCHER_THEMES
}

The problem is that I receive an error at compile time which suggests that the .app bundle could not find the.rcc file, meaning that the .rcc file was not generated! However I tested my custom target(creatercc) without QMAKE_BUNDLE_DATA and it generates the .rcc file so I conclude that .app bundle wants to be created before the .rcc creation so that's why the bundle cannot find the .rcc file.

The question is: how to make sure that the predefined target run first, before QMAKE_BUNDLE_DATA, and that QMAKE_BUNDLE_DATA waits until the predefined target command ended it's execution? Thanks

Ispas Claudiu
  • 1,890
  • 2
  • 28
  • 54
  • No idea what the interaction between QMAKE_EXTRA_TARGETS, PRE_TARGETDEPS and QMAKE_BUNDLE_DATA are, but as a more general comment, the common way for generate files would be to add a QMAKE_EXTRA_COMPILERS (see [qmake manual](https://doc.qt.io/qt-5/qmake-advanced-usage.html#adding-compilers)) – E4z9 Dec 12 '16 at 11:18
  • Thank you for the manual but it didn't help – Ispas Claudiu Dec 12 '16 at 14:02

0 Answers0