diff --git a/ground/ground.pro b/ground/ground.pro index 7f4ed96c5..9792d15ef 100644 --- a/ground/ground.pro +++ b/ground/ground.pro @@ -18,24 +18,17 @@ # = The full path to the base of your svn tree which should # contain "flight", "ground", etc. -# There is a known problem with dependencies which should be fixed. -# Until that the following workaround for qt-creator users exists: -# -# - run qmake in ground directory (generated GCS Makefiles lack some -# uavobject targets - it is known problem); -# - build in uavobjgenerator; -# - build in uavobjects; -# - run qmake in ground again (IMPORTANT - now correct GCS Makefiles -# will be generated). -# -# Now you may build GCS using "Build project 'ground'" qt-creator -# command. If some uavobjects were added/removed, you need to repeat -# all steps after uavobjects.pro modification. -# -# Please note that this workaround (and meta-project at all) is only -# for qt-creator users. Top level Makefile handles all dependencies -# itself and don't use ground.pro. +# There is a small problem with dependencies. qmake needs synthetic +# files when it generates GCS Makefiles. But we do not have +# uavobjgenerator at that time (on the 1st build). So we use the +# following trick: at make stage in uavobjects we rerun qmake for +# openpilotgcs.pro and regenerate GCS Makefiles using just built +# synthetic files. It takes some extra time but solves the +# dependency problem. +# Please note that this meta-project intended only for qt-creator +# users. Top level Makefile handles all dependencies itself and +# doesn't use ground.pro. TEMPLATE = subdirs diff --git a/ground/uavobjects/uavobjects.pro b/ground/uavobjects/uavobjects.pro index aea3e403a..3cec0444c 100644 --- a/ground/uavobjects/uavobjects.pro +++ b/ground/uavobjects/uavobjects.pro @@ -1,3 +1,9 @@ +# +# Qmake project for UAVObjects generation. +# +# TODO: provide some dependencies (now it builds every time) +# + TEMPLATE = subdirs defineReplace(targetPath) { @@ -18,19 +24,37 @@ win32 { BUILD_SUBDIR = } -win32:MKDIR=$(MKDIR) -!win32:MKDIR=$(MKDIR) -p - win32:SPEC = win32-g++ macx-g++:SPEC = macx-g++ linux-g++:SPEC = linux-g++ -uavobjects.target = FORCE -uavobjects.commands += -$${MKDIR} $$targetPath(../../uavobject-synthetics) $$addNewline() -uavobjects.commands += cd $$targetPath(../../uavobject-synthetics) && -uavobjects.commands += $$targetPath(../ground/uavobjgenerator/$${BUILD_SUBDIR}uavobjgenerator) -uavobjects.commands += -gcs -flight -python -matlab $$targetPath(../../shared/uavobjectdefinition) $$targetPath(../..) $$addNewline() +win32 { + # Windows sometimes remembers working directory changed from Makefile, sometimes not. + # That's why pushd/popd is used here - to make sure that we know current directory. -uavobjects.commands += cd $$targetPath(../../ground/openpilotgcs) && -uavobjects.commands += $(QMAKE) $$targetPath(../../../ground/openpilotgcs/)openpilotgcs.pro -spec $$SPEC -r $$addNewline() + uavobjects.commands += -$(MKDIR) $$targetPath(../../uavobject-synthetics) $$addNewline() + + uavobjects.commands += pushd $$targetPath(../../uavobject-synthetics) && + uavobjects.commands += $$targetPath(../ground/uavobjgenerator/$${BUILD_SUBDIR}uavobjgenerator) + uavobjects.commands += -gcs -flight -python -matlab $$targetPath(../../shared/uavobjectdefinition) + uavobjects.commands += $$targetPath(../..) && popd $$addNewline() + + uavobjects.commands += pushd $$targetPath(../../ground/openpilotgcs) && + uavobjects.commands += $(QMAKE) $$targetPath(../../../ground/openpilotgcs/)openpilotgcs.pro + uavobjects.commands += -spec $$SPEC -r && popd $$addNewline() +} + +!win32 { + uavobjects.commands += -$(MKDIR) -p ../../uavobject-synthetics $$addNewline() + + uavobjects.commands += cd ../../uavobject-synthetics && + uavobjects.commands += ../ground/uavobjgenerator/uavobjgenerator + uavobjects.commands += -gcs -flight -python -matlab ../../shared/uavobjectdefinition ../.. && + + uavobjects.commands += cd ../ground/openpilotgcs) && + uavobjects.commands += $(QMAKE) ../../../ground/openpilotgcs/openpilotgcs.pro + uavobjects.commands += -spec $$SPEC -r $$addNewline() +} + +uavobjects.target = FORCE QMAKE_EXTRA_TARGETS += uavobjects