I've been working on a senior design project that uses Qt and VS2008. I didn't like the "free" ways that were present for using Visual Studio with Qt4, so I devised a custom build rule file and a few helper programs to make development much easier. I decided that in true open-source spirit, I should share my findings with the rest of the world.
Attached is a zip file containing a detailed How-to of how to go about setting up your environment and how to setup a Visual Studio 2008 project from start to finish that utilizes my build method. Also in the zip file is a completed project example following the how-to, the two helper programs (autoMoc and autoUic) including their source code and the Visual Studio build rule file.
The How-To is a bit lengthy, I tried to cover everything I could think of including potential pitfalls, so grab your favorite caffeinated drink before you begin reading!
You can either follow the guide or use the example project to see how to setup your project. I hope this is able to help a few of you out there, I've found it to be incredibly useful.
The advantage that my build method has is that it lets Visual Studio manage the project files. The only time you need to do anything "manual" is the fist time you make a header file with the Q_OBJECT macro, you'll need to add the generated .cpp file to your project. Other than that, the autoMoc and autoUic programs together with the build rule file will run Trolltech's Uic.exe and Moc.exe on the files that need them and only when those files have changed since the last time they were Moc'd or Uic'd.
If you have any comments, suggestions, questions, post them here!
Happy coding ;p
Paul
Updated Jan 21.2008
1) Fixed an issue where spaces in the project path or build utility
path would fail. Thanks to "chty" for this find and fix.
2) Added in support to handle Qt resource files. The generated file
appears in the Generated folder.
3) Fixed a problem that could arise if the user cleaned the solution
and the generated files were deleted, but the build utilities believed
all files were up to date.
Hopefully I'll find the free time to make an article on the Qt Wiki
site. Until then, please refer to the readme.rtf file in the archive.
Bookmarks