Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QMake - how to add a post-build step after EVERY build

Having a bit of trouble - I've added the following lines to qmake in order to get it to copy files into the app bundle on Mac.

mac {
    QMAKE_POST_LINK = $$PWD/package_mac.sh
}

The .sh file runs sometimes, and seems to work (at the moment it just runs touch geese which creates a file named geese in the build directory (excellent!).

But, it doesn't run every time I build, it seems to be only when files are changed. Really, I want a way to get qmake to copy over all my game's resources into the correct places on each platform (so build folder on Windows, app package on Mac, etc...) every time I build.

Any ideas?

like image 669
Javawag Avatar asked Jan 25 '14 21:01

Javawag


1 Answers

Have you tried using POST_TARGETDEPS (with QMAKE_EXTRA_TARGETS)? The downside to this approach is that you'll have to create some sort of dummy file (since to the best of my knowledge .PHONY isn't supported by qmake), which you should probably also clean later.

Taking your example:

mac {
    package-script = $$PWD/package_mac.sh
}

package-target.target = $$PWD/package.tmp
package-target.depends = FORCE
package-target.commands = $$package-script

(See this question for a similar discussion.)

like image 86
Ernest3.14 Avatar answered Nov 08 '22 23:11

Ernest3.14