How to generate Qt .pri files from Visual studio project at the end of the build?

痴心易碎 提交于 2020-03-23 09:04:10

问题


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?

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.

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.

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


回答1:


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




回答2:


You know, Visual Studio is independent on Qt environment. The only opportunity to do what you want is use of some VS plugins, but I've never actually seen such an option anywhere.

As for me, when I add some file to VS solution, I append it manually to the *.pro file.



来源:https://stackoverflow.com/questions/15921380/how-to-generate-qt-pri-files-from-visual-studio-project-at-the-end-of-the-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!