On terça-feira, 31 de maio de 2016 14:42:01 BRT Thiago Macieira wrote: > The best of both worlds would be if: > * moc could output more than one file > * moc could be run once for however many files needed updating > * moc could be given the list of files that have changed, but no others [cut] > Also, qmake would need to list only the actual headers, not the indirect > dependencies of them as it currently does. That would mean moc would not > get rerun if an indirect dependency of a header changed. In Qt 4, that > wasn't a problem; for Qt 5, given that moc parses plugin and metatype > declarations from included headers, the rerun would not produce the same as > a clean build.
The attached Makefile accomplishes the goals above (to test, run "make create" first). $ gmake moc --combine=%.h=.moc/moc_%.cpp 1.h 2.h $ touch 1.h $ gmake moc --combine=%.h=.moc/moc_%.cpp 1.h $ touch 2.h $ gmake moc --combine=%.h=.moc/moc_%.cpp 2.h $ touch *.h $ gmake moc --combine=%.h=.moc/moc_%.cpp 1.h 2.h But it suffers from the problem of indirect dependencies, which I don't know how to solve: $ gmake gmake: Nothing to be done for 'mocables'. $ touch indirect1.h $ gmake gmake: Nothing to be done for 'mocables'. The other problem, of course, is about systems that don't use GNU make. Looks like nmake has the same syntax[1], but what about BSD makes? [1] https://msdn.microsoft.com/en-us/library/cbes8ded.aspx -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
MOC_DIR = .moc/ mocables: \ $(MOC_DIR)moc_1.cpp \ $(MOC_DIR)moc_2.cpp $(MOC_DIR): mkdir -p $(MOC_DIR) $(MOC_DIR)moc_1.cpp: 1.h indirect1.h indirect1-1.h .moc-run $(MOC_DIR)moc_2.cpp: 2.h indirect2.h .moc-run .moc-run: 1.h 2.h | $(MOC_DIR) @echo moc --combine=%.h=$(MOC_DIR)moc_%.cpp $? @touch $@ ${?:%.h=$(MOC_DIR)moc_%.cpp} clean: -rm -f $(MOC_DIR)moc_1.cpp $(MOC_DIR)moc_2.cpp .moc-run create: touch 1.h 2.h indirect1.h indirect2.h indirect1-1.h .PHONY: clean mocables create
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development