Here is my situation:
I have a typical Qt C ++ project that I create with a qmake (.pro file).
I also have a python script that generates some code. The Python script (call it update.py) generates three files, let them name gen.h, gen.cpp, gen.qml.
Now, what I'm doing now is manually updating.py executing to generate these files. Then I can run make, and everything builds OK. Gen.h and gen.cpp are just βregularβ files in my .pro file, and they are checked in SVN.
Instead, I want to make sure that when make is launched, update.py will start and generate these files, and then they will be built with the project. This way I can remove them from SVN and avoid the extra manual step.
FYI: I already have update.py setting to update these files only when necessary, therefore, if you run update.py several times, it will not blindly change gen.h, gen.cpp, etc.
I spent a huge amount of time trying to get this job (seemingly embarrassing in fact). I was messing around with QMAKE_EXTRA_TARGETS, QMAKE_EXTRA_COMPILERS, PRE_TARGETDEPS, etc., but nothing of the kind works the way I want.
Oh, another piece of information: gen.cpp and gen.h have QObject-based classes, so I need to generate them before running MOC.
Thanks!
source share