QMake:构建后执行脚本 [英] QMake: execute script after build

查看:558
本文介绍了QMake:构建后执行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是用于设置MacOSX应用程序的应用程序捆绑包.我有一个脚本,可以复制一些文件并执行其他一些操作.所以我想在构建后执行脚本(即在链接步骤之后).我希望它每次都能执行,因为无法指定其依赖项.

This is for setting up the application bundle of a MacOSX app. I have a script which copies a few files and does some other things. So I want to execute the script after the build (i.e. after the linking step). I want it to be executed just every time because it is not possible to specify its dependencies.

我知道有QMAKE_POST_LINK(例如,描述为此处),但仅在目标不存在,即何时需要进行链接.但是,我希望脚本每次在目标已经存在的情况下运行.

I know there is QMAKE_POST_LINK (e.g. described here or here) but it runs only when the target does not exists, i.e. when linking needs to be done. However, I want the script to run every time, also when the target already exists.

还有QMAKE_EXTRA_TARGETSPOST_TARGETDEPS(例如,描述为

There is also QMAKE_EXTRA_TARGETS and POST_TARGETDEPS (e.g. described here) but that forces a relink all the time but I actually only want the script to rerun and it runs the script before the linking. (Currently, that's what I'm using using anyway, because I don't see a better way. Here is my QMake source.)

推荐答案

有相关问题.我首先引用我的答案:

There is related questions there and there. I quote my answer for first of them:

按给定顺序进行处理的另一种方法是使用空的"super" 目标:

Another way to make things in given order is to use empty "super" target:

super.depends = target_pre first target_post
QMAKE_EXTRA_TARGETS += super

first-是默认的qmake目标,target_pretarget_post一些自定义目标.现在make super随便做.

Where first - is default qmake target, and target_pre and target_post some custom targets. Now make super just do the thing.

看起来在Qt的最新版本中,依赖关系的构建正在paralell中运行,因此该解决方案将无法工作.

looks like in last versions of Qt build of dependencies is running in paralell so this solution wouldn't work.

这篇关于QMake:构建后执行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆