By removing the moc generation step from QMake I no longer have to rely on QtCreator. At the moment I am using a custom script to generate/update Qt moc files before generating makefiles via GYP in eclipse. Does anyone know how to add moc as build rules to GYP so I can consolidate this step?
At the moment I have the script as a build rule inside of eclipse running every-time but I would like to avoid this approach by having GYP generate a makefile with the moc rules already inside of it like QMake does.
Links of interest:
Reference to developing Qt with GYP: https://groups.google.com/group/gyp-developer/browse_thread/thread/42cfb9902b86d715/b17701d9a6805671?show_docid=b17701d9a6805671
GYP Homepage: http://code.google.com/p/gyp/
QMake Homepage: http://qt-project.org/doc/qt-4.8/qmake-manual.html
My current moc script:
#!/bin/bash
MOC="/path/to/Qt/4.8.1/gcc/bin/moc"
SRC_DIR="/path/to/project"
$MOC $SRC_DIR/SkDebuggerUI.h -o $SRC_DIR/moc_SkDebuggerUI.cpp
$MOC $SRC_DIR/SkQtWidget.h -o $SRC_DIR/moc_SkQtWidget.cpp
I had exactly the same question. Instead of including a separate step with moc script, I added the following lines into my .gyp file.
I didn't try it on other operating systems, but I think you can do it on other systems similarly. Let me know, if you have figured better ways.