从命令行构建Qt Creator项目 [英] Building Qt Creator projects from command line

查看:178
本文介绍了从命令行构建Qt Creator项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个构建脚本以自动构建和释放任务。我有一个Qt Creator项目,它有三个配置,其中两个我想从头完全重建,没有任何预编译头和现有的.o文件跳过(release和release_production)。后者是相同的,除了它有PRODUCTION符号#defined。

I'm in the process of writing a build script to automate build and release tasks. I have a Qt Creator project which has three configurations, two of which I want to completely rebuild from scratch without any precompiled headers and existing .o files to skip (release and release_production). The latter is the same except it has the PRODUCTION symbol #defined.

我使用的是windows。如何从命令行构建这些配置?

I'm using windows. How can I build these configurations from the command line?

编辑:一些澄清:Qt Creator自定义构建步骤不存储在qmake makefile,但在Qt Creator-特定.pro.user XML文件。

Some clarification: The Qt Creator custom build steps are not stored in the qmake makefile but in the Qt Creator-specific .pro.user XML file. I would like to perform these from the command line without repeating them in the script.

推荐答案

这里有两个步骤:


  1. 运行 qmake 来生成Makefile。通常的命令是

  1. Running qmake to generate Makefiles. The usual command is

c:\qt\4.7.2\bin\qmake.exe" path\to\some\project.pro -r -spec win32-g++ CONFIG+=...

-spec 开关很重要,请确保提供一个有效的makepec文件。 CONFIG 需要在此步骤中指定

The -spec switch is important. Make sure you supply a valid makespec file. CONFIG needs to be specified in this step.

运行 make 来编译和链接

C:\MinGW32\bin\mingw32-make -f Makefile.Debug

记住将 make 指向正确的makefile。

Remember to point make to the correct makefile.

这篇关于从命令行构建Qt Creator项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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