0

I try to compile a qt cpp file but no moc is generated for Q_OBJECT objects. I am using Maya's distribution of qt. My makefile.qt file looks like this and I am compiling with make -f makefile.qt myPlugIn.bundle:

%.mak : %.pro qtconfig
    $(QMAKE) -o - QMAKE_CC=$(CC) QMAKE_CXX=$(C++) $< | \
        sed -e '/^TARGET.*=/s?=.*$$?= $$(QMAKE_TARGET).$(EXT)?' \
            -e 's?-framework QtCore?$$(MAYA_LOCATION)/MacOS/QtCore?' \
            -e 's?-framework QtGui?$$(MAYA_LOCATION)/MacOS/QtGui?' \
            -e 's?-framework QtOpenGL?$$(MAYA_LOCATION)/MacOS/QtOpenGL?' \
            -e 's?-framework QtTest?$$(MAYA_LOCATION)/MacOS/QtTest?' \
            -e 's?-framework QtXml?$$(MAYA_LOCATION)/MacOS/QtXml?' \
            -e 's?-dynamiclib??' -e 's?-mtune=generic??' >$@

PLUGINS =   helixQtCmd.$(EXT)   \
            qtForms.$(EXT)      \
            saveSwatchesCmd.$(EXT)

ifeq ($(QMAKE),)
all:
    @echo "Qt not found. Qt-based plug-ins will not be built."
else
all:    $(PLUGINS)
endif


# For each plugin, make sure that its individual Makefile is up-to-date then
# use that Makefile to build the plugin.
.PHONY: force
%.$(EXT):   force
    $(MAKE) -f Makefile.qt $(@:.$(EXT)=.mak)
    $(MAKE) -f $(@:.$(EXT)=.mak) $@

clean:
    rm -f $(PLUGINS:.$(EXT)=.o) $(PLUGINS:.$(EXT)=.mak) \
        moc_* ui_* qrc_*

Clean:  clean
    rm -f $(PLUGINS)

What command am I missing to generate this moc file ?

Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89

1 Answers1

0

I finally added the following moc line:

%.$(EXT):   force

    moc $(@:.$(EXT)=.h) -o moc_$(@:.$(EXT)=.cpp)
    $(MAKE) -f Makefile.qt $(@:.$(EXT)=.mak)
    $(MAKE) -f $(@:.$(EXT)=.mak) $@
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89