diff --git a/Makefile b/Makefile index 97ff2d923..6860634c6 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,8 @@ export BUILD_DIR := $(ROOT_DIR)/build export PACKAGE_DIR := $(ROOT_DIR)/build/package export DIST_DIR := $(ROOT_DIR)/build/dist +DIRS = $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR) + # Set up default build configurations (debug | release) GCS_BUILD_CONF := release UAVOGEN_BUILD_CONF := release @@ -140,20 +142,6 @@ all_clean: .PONY: clean clean: all_clean -$(DL_DIR): - $(MKDIR) -p $@ - -$(TOOLS_DIR): - $(MKDIR) -p $@ - -$(BUILD_DIR): - $(MKDIR) -p $@ - -$(PACKAGE_DIR): - $(MKDIR) -p $@ - -$(DIST_DIR): - $(MKDIR) -p $@ ############################## # @@ -167,10 +155,12 @@ else UAVOGEN_SILENT := silent endif +UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator +DIRS += $(UAVOBJGENERATOR_DIR) + .PHONY: uavobjgenerator -uavobjgenerator: - $(V1) $(MKDIR) -p $(BUILD_DIR)/$@ - $(V1) ( cd $(BUILD_DIR)/$@ && \ +uavobjgenerator: | $(UAVOBJGENERATOR_DIR) + $(V1) ( cd $(UAVOBJGENERATOR_DIR) && \ $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \ $(MAKE) --no-print-directory -w ; \ ) @@ -183,8 +173,7 @@ uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS)) UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics -$(UAVOBJ_OUT_DIR): - $(V1) $(MKDIR) -p $@ +DIRS += $(UAVOBJ_OUT_DIR) uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator $(V1) ( cd $(UAVOBJ_OUT_DIR) && \ @@ -214,6 +203,8 @@ export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics +DIRS += $(OPGCSSYNTHDIR) + # Define supported board lists ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum @@ -225,7 +216,7 @@ osd_short := 'osd ' revoproto_short := 'revp' simposix_short := 'posx' discoveryf4bare_short := 'df4b' -gpsplatinum_short := 'gps9 ' +gpsplatinum_short := 'gps9' # SimPosix only builds on Linux so drop it from the list for # all other platforms. @@ -460,8 +451,9 @@ sim_osx_%: uavobjects_flight all_ground: openpilotgcs uploader # Convenience target for the GCS -.PHONY: gcs gcs_clean +.PHONY: gcs gcs_qmake gcs_clean gcs: openpilotgcs +gcs_qmake: openpilotgcs_qmake gcs_clean: openpilotgcs_clean ifeq ($(V), 1) @@ -470,32 +462,25 @@ else GCS_SILENT := silent endif -.NOTPARALLEL: -.PHONY: openpilotgcs -openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make +OPENPILOTGCS_DIR := $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) +DIRS += $(OPENPILOTGCS_DIR) + +OPENPILOTGCS_MAKEFILE := $(OPENPILOTGCS_DIR)/Makefile .PHONY: openpilotgcs_qmake -openpilotgcs_qmake: -ifeq ($(QMAKE_SKIP),) - $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) - $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) && \ +openpilotgcs_qmake $(OPENPILOTGCS_MAKEFILE): | $(OPENPILOTGCS_DIR) + $(V1) ( cd $(OPENPILOTGCS_DIR) && \ $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \ ) -else - @$(ECHO) "skipping qmake" -endif -.PHONY: openpilotgcs_make -openpilotgcs_make: - $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) - $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \ - $(MAKE) -w ; \ - ) +.PHONY: openpilotgcs +openpilotgcs: uavobjects_gcs $(OPENPILOTGCS_MAKEFILE) + $(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR); .PHONY: openpilotgcs_clean openpilotgcs_clean: - @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF))" - $(V1) [ ! -d "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" + @$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))" + $(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)" ################################ # @@ -503,77 +488,27 @@ openpilotgcs_clean: # ################################ -.NOTPARALLEL: -.PHONY: uploader -uploader: uploader_qmake uploader_make +UPLOADER_DIR := $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) +DIRS += $(UPLOADER_DIR) + +UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile .PHONY: uploader_qmake -uploader_qmake: -ifeq ($(QMAKE_SKIP),) - $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) - $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) && \ +uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR) + $(V1) ( cd $(UPLOADER_DIR) && \ $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \ ) -else - @$(ECHO) "skipping qmake" -endif -.PHONY: uploader_make -uploader_make: - $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) - $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \ - $(MAKE) -w ; \ - ) +.PHONY: uploader +uploader: $(UPLOADER_MAKEFILE) + $(V1) $(MAKE) -w -C $(UPLOADER_DIR) .PHONY: uploader_clean uploader_clean: - @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF))" - $(V1) [ ! -d "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)" + @$(ECHO) " CLEAN $(call toprel, $(UPLOADER_DIR))" + $(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)" -################################ -# -# Android GCS related components -# -################################ - -# Build the output directory for the Android GCS build -ANDROIDGCS_OUT_DIR := $(BUILD_DIR)/androidgcs -$(ANDROIDGCS_OUT_DIR): - $(V1) $(MKDIR) -p $@ - -# Build the asset directory for the android assets -ANDROIDGCS_ASSETS_DIR := $(ANDROIDGCS_OUT_DIR)/assets -$(ANDROIDGCS_ASSETS_DIR)/uavos: - $(V1) $(MKDIR) -p $@ - -ifeq ($(V), 1) - ANT_QUIET := - ANDROID_SILENT := -else - ANT_QUIET := -q - ANDROID_SILENT := -s -endif - -.PHONY: androidgcs -androidgcs: uavo-collections_java - $(V0) @$(ECHO) " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))" - $(V1) $(MKDIR) -p $(ANDROIDGCS_OUT_DIR) - $(V1) $(ANDROID) $(ANDROID_SILENT) update project \ - --target "Google Inc.:Google APIs:$(GOOGLE_API_VERSION)" \ - --name androidgcs \ - --path ./androidgcs - $(V1) $(ANT) -f ./androidgcs/build.xml \ - $(ANT_QUIET) \ - -Dout.dir="../$(call toprel, $(ANDROIDGCS_OUT_DIR)/bin)" \ - -Dgen.absolute.dir="$(ANDROIDGCS_OUT_DIR)/gen" \ - $(ANDROIDGCS_BUILD_CONF) - -.PHONY: androidgcs_clean -androidgcs_clean: - @$(ECHO) " CLEAN $(call toprel, $(ANDROIDGCS_OUT_DIR))" - $(V1) [ ! -d "$(ANDROIDGCS_OUT_DIR)" ] || $(RM) -r "$(ANDROIDGCS_OUT_DIR)" - # We want to take snapshots of the UAVOs at each point that they change # to allow the GCS to be compatible with as many versions as possible. # We always include a pseudo collection called "srctree" which represents @@ -695,8 +630,7 @@ ALL_UNITTESTS := logfs math lednotification # Build the directory for the unit tests UT_OUT_DIR := $(BUILD_DIR)/unit_tests -$(UT_OUT_DIR): - $(V1) $(MKDIR) -p $@ +DIRS += $(UT_OUT_DIR) .PHONY: all_ut all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS))) @@ -771,9 +705,8 @@ OPFW_CONTENTS := \ .PHONY: opfw_resource opfw_resource: $(OPFW_RESOURCE) -$(OPFW_RESOURCE): $(FW_TARGETS) +$(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR) @$(ECHO) Generating OPFW resource file $(call toprel, $@) - $(V1) $(MKDIR) -p $(dir $@) $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@ # If opfw_resource or all firmware are requested, GCS should depend on the resource @@ -864,9 +797,8 @@ docs_all_clean: ############################## .PHONY: build-info -build-info: +build-info: | $(BUILD_DIR) @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)" - $(V1) $(MKDIR) -p $(BUILD_DIR) $(V1) $(VERSION_INFO) \ --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \ --template="make/templates/$@.txt" \ @@ -895,6 +827,17 @@ $(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR) .PHONY: dist dist: $(DIST_NAME).gz + +############################## +# +# Directories +# +############################## + +$(DIRS): + $(V1) $(MKDIR) -p $@ + + ############################## # # Help message, the default Makefile goal @@ -928,7 +871,6 @@ help: @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon" @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards" @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards" - @$(ECHO) " android_sdk_install - Install the Android SDK tools" @$(ECHO) " Install all available tools:" @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)" @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)" @@ -1000,26 +942,19 @@ help: @$(ECHO) @$(ECHO) " [GCS]" @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)" - @$(ECHO) " Skip qmake: QMAKE_SKIP=1" @$(ECHO) " Compile specific directory: MAKE_DIR=" - @$(ECHO) " Example: make gcs QMAKE_SKIP=1 MAKE_DIR=src/plugins/coreplugin" + @$(ECHO) " Example: make gcs MAKE_DIR=src/plugins/coreplugin" + @$(ECHO) " gcs_qmake - Run qmake for the Ground Control System (GCS) application (debug|release)" @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)" @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))" @$(ECHO) @$(ECHO) " [Uploader Tool]" @$(ECHO) " uploader - Build the serial uploader tool (debug|release)" - @$(ECHO) " Skip qmake: QMAKE_SKIP=1" - @$(ECHO) " Example: make uploader QMAKE_SKIP=1" + @$(ECHO) " uploader_qmake - Run qmake for the serial uploader tool (debug|release)" @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)" @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))" @$(ECHO) @$(ECHO) - @$(ECHO) " [AndroidGCS]" - @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application" - @$(ECHO) " androidgcs_install - Use ADB to install the Android GCS application" - @$(ECHO) " androidgcs_run - Run the Android GCS application" - @$(ECHO) " androidgcs_clean - Remove the Android GCS application" - @$(ECHO) @$(ECHO) " [UAVObjects]" @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files" @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..." diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index 3ececc457..eaf91ee08 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -1,36 +1,10 @@ include(openpilotgcs.pri) -TEMPLATE = subdirs +TEMPLATE = aux # Copy Qt runtime libraries into the build directory (to run or package) equals(copyqt, 1) { - - # Copy QtQuick2 complete directories - # Some of these directories have a lot of files - # Easier to copy everything - QT_QUICK2_DIRS = QtQuick/Controls \ - QtQuick/Dialogs \ - QtQuick/Layouts \ - QtQuick/LocalStorage \ - QtQuick/Particles.2 \ - QtQuick/PrivateWidgets \ - QtQuick/Window.2 \ - QtQuick/XmlListModel \ - QtQuick.2 - - # create QtQuick directory - data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_QML_PATH/QtQuick\") $$addNewline() - - for(dir, QT_QUICK2_DIRS) { - data_copy.commands += @rm -rf $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline() - data_copy.commands += $(COPY_DIR) $$targetPath(\"$$[QT_INSTALL_QML]/$$dir\") $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline() - } - - data_copy.target = FORCE - QMAKE_EXTRA_TARGETS += data_copy - linux { - QT_LIBS = libQt5Core.so.5 \ libQt5Gui.so.5 \ libQt5Widgets.so.5 \ @@ -56,35 +30,21 @@ equals(copyqt, 1) { libicui18n.so.53 \ libicuuc.so.53 \ libicudata.so.53 - - data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_LIBRARY_PATH\") $$addNewline() for(lib, QT_LIBS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_LIBS]/$$lib\") $$targetPath(\"$$GCS_QT_LIBRARY_PATH/$$lib\") $$addNewline() + addCopyFileTarget($${lib},$$[QT_INSTALL_LIBS],$${GCS_QT_LIBRARY_PATH}) } - # create Qt plugin directories - QT_PLUGIN_DIRS = iconengines \ - imageformats \ - platforms \ - mediaservice \ - sqldrivers - for(dir, QT_PLUGIN_DIRS) { - data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_PLUGINS_PATH/$$dir\") $$addNewline() - } - QT_PLUGIN_LIBS = iconengines/libqsvgicon.so \ - imageformats/libqgif.so \ - imageformats/libqico.so \ - imageformats/libqjpeg.so \ - imageformats/libqmng.so \ - imageformats/libqsvg.so \ - imageformats/libqtiff.so \ - mediaservice/libgstaudiodecoder.so \ - mediaservice/libgstmediaplayer.so \ - platforms/libqxcb.so \ - sqldrivers/libqsqlite.so - for(lib, QT_PLUGIN_LIBS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_PLUGINS]/$$lib\") $$targetPath(\"$$GCS_QT_PLUGINS_PATH/$$lib\") $$addNewline() - } + QT_PLUGINS = iconengines/libqsvgicon.so \ + imageformats/libqgif.so \ + imageformats/libqico.so \ + imageformats/libqjpeg.so \ + imageformats/libqmng.so \ + imageformats/libqsvg.so \ + imageformats/libqtiff.so \ + mediaservice/libgstaudiodecoder.so \ + mediaservice/libgstmediaplayer.so \ + platforms/libqxcb.so \ + sqldrivers/libqsqlite.so } win32 { @@ -106,7 +66,6 @@ equals(copyqt, 1) { Qt5Script$${DS}.dll \ Qt5Concurrent$${DS}.dll \ Qt5PrintSupport$${DS}.dll \ - Qt5OpenGL$${DS}.dll \ Qt5SerialPort$${DS}.dll \ Qt5Multimedia$${DS}.dll \ Qt5MultimediaWidgets$${DS}.dll \ @@ -120,33 +79,7 @@ equals(copyqt, 1) { libstdc++-6.dll \ libwinpthread-1.dll for(dll, QT_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_BINS]/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() - } - - # create Qt plugin directories - QT_PLUGIN_DIRS = iconengines \ - imageformats \ - platforms \ - mediaservice \ - sqldrivers \ - opengl32_32 - for(dir, QT_PLUGIN_DIRS) { - data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_APP_PATH/$$dir\") $$addNewline() - } - - # copy Qt plugin DLLs - QT_PLUGIN_DLLS = iconengines/qsvgicon$${DS}.dll \ - imageformats/qgif$${DS}.dll \ - imageformats/qico$${DS}.dll \ - imageformats/qjpeg$${DS}.dll \ - imageformats/qmng$${DS}.dll \ - imageformats/qsvg$${DS}.dll \ - imageformats/qtiff$${DS}.dll \ - platforms/qwindows$${DS}.dll \ - mediaservice/dsengine$${DS}.dll \ - sqldrivers/qsqlite$${DS}.dll - for(dll, QT_PLUGIN_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_PLUGINS]/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + addCopyFileTarget($${dll},$$[QT_INSTALL_BINS],$${GCS_APP_PATH}) } # copy OpenSSL DLLs @@ -154,14 +87,45 @@ equals(copyqt, 1) { ssleay32.dll \ libeay32.dll for(dll, OPENSSL_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$${OPENSSL_DIR}/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + addCopyFileTarget($${dll},$${OPENSSL_DIR},$${GCS_APP_PATH}) } # copy OpenGL DLL OPENGL_DLLS = \ opengl32_32/opengl32.dll for(dll, OPENGL_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$${MESAWIN_DIR}/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + addCopyFileTarget($${dll},$${MESAWIN_DIR},$${GCS_APP_PATH}) } + + QT_PLUGINS = iconengines/qsvgicon$${DS}.dll \ + imageformats/qgif$${DS}.dll \ + imageformats/qico$${DS}.dll \ + imageformats/qjpeg$${DS}.dll \ + imageformats/qmng$${DS}.dll \ + imageformats/qsvg$${DS}.dll \ + imageformats/qtiff$${DS}.dll \ + platforms/qwindows$${DS}.dll \ + mediaservice/dsengine$${DS}.dll \ + sqldrivers/qsqlite$${DS}.dll + } + + for(plugin, QT_PLUGINS) { + addCopyFileTarget($${plugin},$$[QT_INSTALL_PLUGINS],$${GCS_QT_PLUGINS_PATH}) + } + + # Copy QtQuick2 complete directories + # Some of these directories have a lot of files + # Easier to copy everything + QT_QUICK2_DIRS = QtQuick/Controls \ + QtQuick/Dialogs \ + QtQuick/Layouts \ + QtQuick/LocalStorage \ + QtQuick/Particles.2 \ + QtQuick/PrivateWidgets \ + QtQuick/Window.2 \ + QtQuick/XmlListModel \ + QtQuick.2 + for(dir, QT_QUICK2_DIRS) { + addCopyDirTarget($${dir},$$[QT_INSTALL_QML],$${GCS_QT_QML_PATH}) } } diff --git a/ground/openpilotgcs/openpilotgcs.pri b/ground/openpilotgcs/openpilotgcs.pri index cbf44dd75..3141d1832 100644 --- a/ground/openpilotgcs/openpilotgcs.pri +++ b/ground/openpilotgcs/openpilotgcs.pri @@ -32,6 +32,57 @@ defineReplace(qtLibraryName) { return($$RET) } +defineTest(addCopyFileTarget) { + file = $$1 + src = $$2/$$1 + dest = $$3/$$1 + + $${file}.target = $$dest + $${file}.depends = $$src + + # create directory. Better would be an order only dependency + $${file}.commands = -@$(MKDIR) \"$$targetPath($$dirname(dest))\" $$addNewline() + $${file}.commands += $(COPY_FILE) \"$$targetPath($$src)\" \"$$targetPath($$dest)\" + + QMAKE_EXTRA_TARGETS += $$file + POST_TARGETDEPS += $$eval($${file}.target) + + export($${file}.target) + export($${file}.depends) + export($${file}.commands) + export(QMAKE_EXTRA_TARGETS) + export(POST_TARGETDEPS) + + return(true) +} + +defineTest(addCopyDirTarget) { + dir = $$1 + src = $$2/$$1 + dest = $$3/$$1 + + $${dir}.target = $$dest + $${dir}.depends = $$src + # Windows does not update directory timestamp if files are modified + win32: $${dir}.depends += FORCE + + $${dir}.commands = @rm -rf \"$$targetPath($$dest)\" $$addNewline() + # create directory. Better would be an order only dependency + $${dir}.commands += -@$(MKDIR) \"$$targetPath($$dirname(dest))\" $$addNewline() + $${dir}.commands += $(COPY_DIR) \"$$targetPath($$src)\" \"$$targetPath($$dest)\" + + QMAKE_EXTRA_TARGETS += $$dir + POST_TARGETDEPS += $$eval($${dir}.target) + + export($${dir}.target) + export($${dir}.depends) + export($${dir}.commands) + export(QMAKE_EXTRA_TARGETS) + export(POST_TARGETDEPS) + + return(true) +} + # For use in custom compilers which just copy files win32:i_flag = i defineReplace(stripSrcDir) { @@ -119,6 +170,8 @@ macx { contains(TEMPLATE, vc.*)|contains(TEMPLATE_PREFIX, vc):vcproj = 1 GCS_APP_TARGET = openpilotgcs + + GCS_QT_PLUGINS_PATH = $$GCS_APP_PATH GCS_QT_QML_PATH = $$GCS_APP_PATH copyqt = $$copydata diff --git a/ground/openpilotgcs/share/copydata.pro b/ground/openpilotgcs/share/copydata.pro new file mode 100644 index 000000000..b9c2a1875 --- /dev/null +++ b/ground/openpilotgcs/share/copydata.pro @@ -0,0 +1,13 @@ +include(../openpilotgcs.pri) + +TEMPLATE = aux + +DATACOLLECTIONS = cloudconfig default_configurations dials models pfd sounds diagrams mapicons stylesheets + +equals(copydata, 1) { + for(dir, DATACOLLECTIONS) { + exists($$GCS_SOURCE_TREE/share/openpilotgcs/$$dir) { + addCopyDirTarget($$dir, $$GCS_SOURCE_TREE/share/openpilotgcs, $$GCS_DATA_PATH) + } + } +} diff --git a/ground/openpilotgcs/share/share.pro b/ground/openpilotgcs/share/share.pro index 7a4fe575a..c4d845b95 100644 --- a/ground/openpilotgcs/share/share.pro +++ b/ground/openpilotgcs/share/share.pro @@ -1,26 +1,5 @@ -include(../openpilotgcs.pri) - TEMPLATE = subdirs -SUBDIRS = openpilotgcs/translations -DATACOLLECTIONS = cloudconfig default_configurations dials models pfd sounds diagrams mapicons stylesheets +SUBDIRS = openpilotgcs/translations copydata -equals(copydata, 1) { - for(dir, DATACOLLECTIONS) { - exists($$GCS_SOURCE_TREE/share/openpilotgcs/$$dir) { - # Qt make macros (CHK_DIR_EXISTS, COPY_DIR, etc) have different syntax. They cannot be used - # reliably to copy subdirectories in two different Windows environments (bash and cmd/QtCreator). - # So undocumented QMAKE_SH variable is used to find out the real environment. - !isEmpty(QMAKE_SH) { - # sh environment (including Windows bash) - data_copy.commands += $(MKDIR) $$targetPath(\"$$GCS_DATA_PATH/$$dir\") $$addNewline() - data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/\") $$addNewline() - } else { - # native Windows cmd environment - data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/$$dir\") $$addNewline() - } - } - } - data_copy.target = FORCE - QMAKE_EXTRA_TARGETS += data_copy -} +copydata.file = copydata.pro diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro b/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro index 4fa7cb219..af9cecbff 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro +++ b/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro @@ -1,18 +1,10 @@ equals(copydata, 1) { - win32 { # copy SDL DLL SDL_DLLS = \ SDL.dll for(dll, SDL_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$${SDL_DIR}/bin/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + addCopyFileTarget($${dll},$${SDL_DIR}/bin,$${GCS_APP_PATH}) } - - # add make target - POST_TARGETDEPS += copydata - - data_copy.target = copydata - QMAKE_EXTRA_TARGETS += data_copy } - } diff --git a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro index dab7ba70a..5f4c57579 100644 --- a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro +++ b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro @@ -35,8 +35,6 @@ equals(copydata, 1) { # Windows release only win32:CONFIG(release, debug|release) { - data_copy.commands += -@$(MKDIR) $$targetPath(\"$$PLUGIN_DIR\") $$addNewline() - # resources and sample configuration PLUGIN_RESOURCES = \ cc_off.tga \ @@ -46,7 +44,7 @@ equals(copydata, 1) { cc_plugin.ini \ plugin.txt for(res, PLUGIN_RESOURCES) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$RES_DIR/$$res\") $$targetPath(\"$$PLUGIN_DIR/$$res\") $$addNewline() + addCopyFileTarget($${res},$${RES_DIR},$${PLUGIN_DIR}) } # Qt DLLs @@ -54,7 +52,7 @@ equals(copydata, 1) { Qt5Core.dll \ Qt5Network.dll for(dll, QT_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_BINS]/$$dll\") $$targetPath(\"$$SIM_DIR/$$dll\") $$addNewline() + addCopyFileTarget($${dll},$$[QT_INSTALL_BINS],$${SIM_DIR}) } # MinGW DLLs @@ -62,10 +60,7 @@ equals(copydata, 1) { # libgcc_s_dw2-1.dll \ # mingwm10.dll #for(dll, MINGW_DLLS) { - # data_copy.commands += $(COPY_FILE) $$targetPath(\"$$(QTMINGW)/$$dll\") $$targetPath(\"$$SIM_DIR/$$dll\") $$addNewline() + # addCopyFileTarget($${dll},$$(QTMINGW),$${SIM_DIR}) #} - - data_copy.target = FORCE - QMAKE_EXTRA_TARGETS += data_copy } } diff --git a/ground/uavobject-synthetics/uavobject-synthetics.pro b/ground/uavobject-synthetics/uavobject-synthetics.pro index 1f974ae80..85e53d139 100644 --- a/ground/uavobject-synthetics/uavobject-synthetics.pro +++ b/ground/uavobject-synthetics/uavobject-synthetics.pro @@ -3,7 +3,7 @@ # Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org # -TEMPLATE = subdirs +TEMPLATE = aux # Some handy defines defineReplace(targetPath) { @@ -64,5 +64,6 @@ win32 { uavobjects.commands += -spec $$SPEC CONFIG+=$${BUILD_CONFIG} -r $$addNewline() } -uavobjects.target = FORCE +uavobjects.depends = FORCE QMAKE_EXTRA_TARGETS += uavobjects +PRE_TARGETDEPS += uavobjects diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 5f1ed36ee..d184c0b05 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -136,7 +136,7 @@ endef define OPFW_TEMPLATE FORCE: -$(1).firmware_info.c: $(1) $(ROOT_DIR)/flight/templates/firmware_info.c.template FORCE +$(1).firmware_info.c: $(1) $(ROOT_DIR)/flight/templates/firmware_info.c.template $(ROOT_DIR)/shared/uavobjectdefinition @$(ECHO) $(MSG_FWINFO) $$(call toprel, $$@) $(V1) $(VERSION_INFO) \ --template=$(ROOT_DIR)/flight/templates/firmware_info.c.template \ diff --git a/make/tools.mk b/make/tools.mk index fb7ff75b3..3dc0c28cd 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -776,8 +776,8 @@ ifeq ($(UNAME), Windows) $(eval $(call TOOL_INSTALL_TEMPLATE,openssl,$(OPENSSL_DIR),$(OPENSSL_URL),,$(notdir $(OPENSSL_URL)))) ifeq ($(shell [ -d "$(OPENSSL_DIR)" ] && $(ECHO) "exists"), exists) - export OPENSSL := "$(OPENSSL_DIR)/bin/openssl" - export OPENSSL_DIR := "$(OPENSSL_DIR)" + export OPENSSL := $(OPENSSL_DIR)/bin/openssl + export OPENSSL_DIR else # not installed, hope it's in the path... # $(info $(EMPTY) WARNING $(call toprel, $(OPENSSL_DIR)) not found (make openssl_install), using system PATH) diff --git a/package/winx86/openpilotgcs.nsi b/package/winx86/openpilotgcs.nsi index ab8534742..844028159 100644 --- a/package/winx86/openpilotgcs.nsi +++ b/package/winx86/openpilotgcs.nsi @@ -316,7 +316,6 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${InSecResources} $(DESC_InSecResources) !insertmacro MUI_DESCRIPTION_TEXT ${InSecSounds} $(DESC_InSecSounds) !insertmacro MUI_DESCRIPTION_TEXT ${InSecLocalization} $(DESC_InSecLocalization) - !insertmacro MUI_DESCRIPTION_TEXT ${InSecFirmware} $(DESC_InSecFirmware) !insertmacro MUI_DESCRIPTION_TEXT ${InSecUtilities} $(DESC_InSecUtilities) !insertmacro MUI_DESCRIPTION_TEXT ${InSecDrivers} $(DESC_InSecDrivers) !insertmacro MUI_DESCRIPTION_TEXT ${InSecInstallDrivers} $(DESC_InSecInstallDrivers)