mphair
mphair

Reputation: 1460

How to force update of OSX app bundle in qmake?

I've written an application that needs access to a large number of resources.

I have a folder on the same level as my .pro file that contains other folders that contain the resources:

Project Directory
  app.pro
  Resources
    ResourceDirA
      ResourceA0.png
      ResourceA1.png
      ...
    ResourceDirB
      ResourceB0.png
      ResourceB1.png
      ...
    ...

In my .pro file, I have the code

macx {
    resources.files = "Resources"
    resources.path = Contents/Resources
    QMAKE_BUNDLE_DATA += resources
}

This works fine when I delete the build directory and rebuild. But when I've already built and I add one file to one of the subdirectories (ResourceA2.png or something) and rebuild, the new file isn't transferred to the app bundle.

Is there a way to ensure that new files are checked for and updated or at least a way to force the entire bundle to be rebuilt every time I build the project?

Upvotes: 3

Views: 284

Answers (1)

Your problem is due to an inherent limitation present in the qmake + make combo, it should be solvable with qbs if at all.

Here's how it works:

  1. qmake scans the Resources directory and generates copy actions in the Makefile

  2. make copies files listed in the Makefile to the app bundle

You need to run both qmake and make, in that order, to find the new files and copy them over.

There's nothing that can be put in the Makefile, short of a special script, that could detect changes in the Resources folder and force re-run of quake. Apparently, the actions in the Makefile are not copying the whole folder over, but only individual files, or, perhaps, the folder is copied if any of the currently known files are out of date. In either case, new files are ignored by make.

Upvotes: 1

Related Questions