[Qt-interest] Qt open source and VS 2008... how to make it work?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Fri Feb 19 17:35:40 CET 2010


Ender EREL wrote on Friday, February 19, 2010 3:57 PM:

> You are right. I forgot about adding these generated files to the
> project and compiling them. But these files can be manually added to
> the project after this batch file executes, generates the files and
> build fails. 

So your batch file would (roughly) do something like (let's stick to moccing files only, for sake of simplicity):

- For debug or release:
- Iterate over all specified source paths
- For each *.h
  If (needs to be mocked (1))
    Run moc on that file with the proper DEFINES (debug, release)

(1) would be the same logic as qmake applies as well:

IF
- class is derived from QObject
- class contains Q_OBJECT macro
THEN moccing is needed


This batch file is not even required to be run before each build (Pre-build step), but only once you add new sources (which potentially have to be mocced) in Visual Studio to your project. After that you would manually add the generated files manually to the Visual Studio project.

Or, if one would be more daringly, one could write a (Qt ;) application which would take a bunch of source subdirectories and a Visual Studio project (*.vcproj) as input, do the steps as outlined above and modify the *.vcproj accordingly, by adding the proper custom build steps into the XML stuff of the Visual Studio project :)


Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list