在构建结束时如何从Visual Studio项目生成Qt .pri文件? [英] How to generate Qt .pri files from Visual studio project at the end of the build?

查看:212
本文介绍了在构建结束时如何从Visual Studio项目生成Qt .pri文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Visual Studio中设置解决方案以在构建结束时自动生成.pri文件吗?我想过也许要编写一个批处理文件来调用命令来生成.pri文件,是否可以从命令行生成.pri文件?

Can I setup my solution in visual studio to automatically generate the .pri files at the end of the build? I thought about perhaps writing a batch file to call a command to generate the .pri files, is it possible to generate .pri files from the command line?

我在工作在Visual Studio中由9个子项目组成的Qt C ++应用程序上。我还使用Qt visual studio插件创建了一个基于QMake的同一应用程序生成,以生成.pro和.pri文件。

I am working on a Qt C++ application in visual studio made up of 9 subprojects. I also created a QMake based build of the same application using Qt visual studio add in to generate the .pro and .pri files.

设置运行良好,该应用程序在Windows(使用VS2010)和Mac OS X(Qt创建器)上成功编译。问题在于,每次我在Visual Studio中更改项目时(例如,通过添加或删除源文件),我都必须手动为项目重新生成.pri文件,以便qmake可以将其提取。

The setup is working well, and the application compiles successfully on Windows (using VS2010) and Mac OS X (Qt creator). The problem is that every time I change the projects in visual studio (for example by adding or removing source files), I have to manually regenerate the .pri file for the project so it gets picked up by qmake.

我正在使用v1.1.11中的Qt visual studio添加。 Visual Studio 2010,Qt 4.7.4。

I'm using the Qt visual studio add in v1.1.11. Visual studio 2010, Qt 4.7.4.

推荐答案

我创建了一个小python脚本,用于从Visual Studio .vcxproj.filter文件生成.pri文件,我已经添加了它到我们在Visual Studio构建结束时运行的后期构建脚本,它似乎运行得很好。如果有人需要它,可以在这里找到它:

I created a small python script to generate .pri files from visual studio .vcxproj.filter files, I've added it to our post build script that runs at the end of the visual studio build, and it seems to work quite well. If anyone else wants it, you can find it here:

https://github.com/JamesSmaldon/prigen.git

这篇关于在构建结束时如何从Visual Studio项目生成Qt .pri文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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