From cac6198c2813009268773d0a1edf95a74efe2707 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 21 Jul 2014 23:35:10 -0700 Subject: [PATCH 1/5] A QObject needs to be the first parent of a class using the Q_OBJECT macro. --- libs/thirdParty/3DMouse/win/Mouse3DInput.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/thirdParty/3DMouse/win/Mouse3DInput.h b/libs/thirdParty/3DMouse/win/Mouse3DInput.h index 0e5aebf..7fb1cd2 100644 --- a/libs/thirdParty/3DMouse/win/Mouse3DInput.h +++ b/libs/thirdParty/3DMouse/win/Mouse3DInput.h @@ -34,7 +34,7 @@ Qt is compiled for Win 2000 targets. */ -class Mouse3DInput : public QAbstractNativeEventFilter, public QObject +class Mouse3DInput : public QObject, public QAbstractNativeEventFilter { Q_OBJECT public: From 7f319a5fbd2d125d191428fae5d1907effa4f790 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 21 Jul 2014 23:36:46 -0700 Subject: [PATCH 2/5] Fix initialized-but-unused warnings in test code for Release builds. --- src/qgcunittest/MockMavlinkFileServer.cc | 1 + src/qgcunittest/TCPLoopBackServer.cc | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/qgcunittest/MockMavlinkFileServer.cc b/src/qgcunittest/MockMavlinkFileServer.cc index 6577611..9a3ec9f 100644 --- a/src/qgcunittest/MockMavlinkFileServer.cc +++ b/src/qgcunittest/MockMavlinkFileServer.cc @@ -97,6 +97,7 @@ void MockMavlinkFileServer::_openCommand(QGCUASFileManager::Request* request) size_t cchPath = strnlen((char *)request->data, sizeof(request->data)); Q_ASSERT(cchPath != sizeof(request->data)); + Q_UNUSED(connected); // Fix initialized-but-not-referenced warning on release builds path = (char *)request->data; // Check path against one of our known test cases diff --git a/src/qgcunittest/TCPLoopBackServer.cc b/src/qgcunittest/TCPLoopBackServer.cc index 0198ade..d564eb8 100644 --- a/src/qgcunittest/TCPLoopBackServer.cc +++ b/src/qgcunittest/TCPLoopBackServer.cc @@ -45,6 +45,7 @@ void TCPLoopBackServer::run(void) bool connected = QObject::connect(_tcpServer, SIGNAL(newConnection()), this, SLOT(_newConnection())); Q_ASSERT(connected); + Q_UNUSED(connected); // Fix initialized-but-not-referenced warning on release builds Q_ASSERT(_tcpServer->listen(_hostAddress, _port)); @@ -59,6 +60,7 @@ void TCPLoopBackServer::_newConnection(void) Q_ASSERT(_tcpSocket); bool connected = QObject::connect(_tcpSocket, SIGNAL(readyRead()), this, SLOT(_readBytes())); Q_ASSERT(connected); + Q_UNUSED(connected); // Fix initialized-but-not-referenced warning on release builds } void TCPLoopBackServer::_readBytes(void) From e8afc6369e3a4d1b9cad30c9bcc7d69d89ace247 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 21 Jul 2014 23:40:23 -0700 Subject: [PATCH 3/5] Fix post-compilation steps in Windows. Revised the DLLs that are copied post-compilation so that QGC.exe can run. Improved robustness by quoting all filenames/paths. --- QGCSetup.pri | 76 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/QGCSetup.pri b/QGCSetup.pri index d28865f..9bff908 100644 --- a/QGCSetup.pri +++ b/QGCSetup.pri @@ -38,9 +38,9 @@ WindowsBuild { # Make sure to keep both side of this if using the same set of directories DESTDIR_COPY_RESOURCE_LIST = $$replace(DESTDIR,"/","\\") BASEDIR_COPY_RESOURCE_LIST = $$replace(BASEDIR,"/","\\") - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR $$BASEDIR_COPY_RESOURCE_LIST\\files $$DESTDIR_COPY_RESOURCE_LIST\\files - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR $$BASEDIR_COPY_RESOURCE_LIST\\qml $$DESTDIR_COPY_RESOURCE_LIST\\qml - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR $$BASEDIR_COPY_RESOURCE_LIST\\data $$DESTDIR_COPY_RESOURCE_LIST\\data + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\files\" \"$$DESTDIR_COPY_RESOURCE_LIST\\files\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\qml\" \"$$DESTDIR_COPY_RESOURCE_LIST\\qml\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\data\" \"$$DESTDIR_COPY_RESOURCE_LIST\\data\" } else { # Make sure to keep both side of this if using the same set of directories QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/files $$DESTDIR_COPY_RESOURCE_LIST @@ -155,44 +155,62 @@ MacBuild { } WindowsBuild { - BASEDIR_WIN = $$replace(BASEDIR,"/","\\") - DESTDIR_WIN = $$replace(DESTDIR,"/","\\") + BASEDIR_WIN = $$replace(BASEDIR, "/", "\\") + DESTDIR_WIN = $$replace(DESTDIR, "/", "\\") + D_DIR = $$[QT_INSTALL_LIBEXECS] + DLL_DIR = $$replace(D_DIR, "/", "\\") + P_DIR = $$[QT_INSTALL_PLUGINS] + PLUGIN_DIR = $$replace(P_DIR, "/", "\\") # Copy dependencies - QMAKE_POST_LINK += $$escape_expand(\\n) $$quote($$QMAKE_COPY_DIR "$$(QTDIR)\\plugins" "$$DESTDIR_WIN") - - COPY_FILE_DESTDIR = $$DESTDIR_WIN DebugBuild: DLL_QT_DEBUGCHAR = "d" ReleaseBuild: DLL_QT_DEBUGCHAR = "" COPY_FILE_LIST = \ - $$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll \ - $$BASEDIR_WIN\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll \ - $$(QTDIR)\\bin\\phonon$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtCore$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtGui$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtMultimedia$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtNetwork$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtOpenGL$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtSql$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtSvg$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtTest$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtWebKit$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtXml$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtXmlPatterns$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtDeclarative$${DLL_QT_DEBUGCHAR}4.dll \ - $$(QTDIR)\\bin\\QtScript$${DLL_QT_DEBUGCHAR}4.dll + $$BASEDIR\\libs\\lib\\sdl\\win32\\SDL.dll \ + $$BASEDIR\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll \ + $$DLL_DIR\\icu*.dll \ + $$DLL_DIR\\Qt5Core$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Gui$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Multimedia$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5MultimediaWidgets$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Network$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5OpenGL$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Positioning$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5PrintSupport$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Qml$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Quick$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Sensors$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5SerialPort$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5OpenGL$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Sql$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Svg$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Test$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5WebKit$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5WebKitWidgets$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Widgets$${DLL_QT_DEBUGCHAR}.dll \ + $$DLL_DIR\\Qt5Xml$${DLL_QT_DEBUGCHAR}.dll for(COPY_FILE, COPY_FILE_LIST) { - QMAKE_POST_LINK += $$escape_expand(\\n) $$quote($$QMAKE_COPY "$$COPY_FILE" "$$COPY_FILE_DESTDIR") + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$COPY_FILE\" \"$$DESTDIR_WIN\" } ReleaseBuild { # Copy Visual Studio DLLs # Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed. - # This currently only works for VS2010. win32-msvc2010 { - QMAKE_POST_LINK += $$escape_expand(\\n) $$quote($$QMAKE_COPY "C:\\Windows\\System32\\msvcp100.dll" "$$DESTDIR_WIN\\") - QMAKE_POST_LINK += $$escape_expand(\\n) $$quote($$QMAKE_COPY "C:\\Windows\\System32\\msvcr100.dll" "$$DESTDIR_WIN\\") + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp100.dll\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr100.dll\" \"$$DESTDIR_WIN\" + } + else:win32-msvc2012 { + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp110.dll\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr110.dll\" \"$$DESTDIR_WIN\" + } + else:win32-msvc2013 { + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp120.dll\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr120.dll\" \"$$DESTDIR_WIN\" + } + else { + error("Visual studio version not supported, installation cannot be completed.") } } -} +} \ No newline at end of file From b7dc11b40c666704483049fef0059a637c8a8efa Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 21 Jul 2014 23:47:22 -0700 Subject: [PATCH 4/5] Minor changes to build scripts. --- QGCSetup.pri | 2 +- qgroundcontrol.pro | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/QGCSetup.pri b/QGCSetup.pri index 9bff908..46bdebb 100644 --- a/QGCSetup.pri +++ b/QGCSetup.pri @@ -17,7 +17,7 @@ # along with QGroundControl. If not, see . # ------------------------------------------------- -QMAKE_POST_LINK += $$quote(echo "Copying files") +QMAKE_POST_LINK += echo "Copying files" # # Copy the application resources to the associated place alongside the application diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index b4477a7..4fef898 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -140,13 +140,6 @@ WindowsBuild { QMAKE_CXXFLAGS_DEBUG += -MP QMAKE_CXXFLAGS_RELEASE += -MP - # Specify that the Unicode versions of string functions should be used in the Windows API. - # Without this the utils and qserialport libraries crash. - DEFINES += UNICODE - - # QWebkit is not needed on MS-Windows compilation environment - CONFIG -= webkit - RC_FILE = $$BASEDIR/qgroundcontrol.rc } @@ -176,7 +169,7 @@ WindowsBuild { } # -# Build flavor specific settings +# Build-specific settings # DebugBuild { @@ -187,7 +180,7 @@ ReleaseBuild { DEFINES += QT_NO_DEBUG WindowsBuild { - # Use link time code generation for beteer optimization (I believe this is supported in msvc express, but not 100% sure) + # Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure) QMAKE_LFLAGS_LTCG = /LTCG QMAKE_CFLAGS_LTCG = -GL } From c339a05a9e26b0a98609570f83c2550cac7863c3 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 21 Jul 2014 23:48:20 -0700 Subject: [PATCH 5/5] Unit testing now always built due to Windows Qt/VS bug. --- qgroundcontrol.pro | 75 +++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 4fef898..a78152e 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -187,43 +187,6 @@ ReleaseBuild { } # -# Unit Test specific configuration goes here (debug only) -# - -DebugBuild { - INCLUDEPATH += \ - src/qgcunittest - - HEADERS += \ - src/qgcunittest/AutoTest.h \ - src/qgcunittest/UASUnitTest.h \ - src/qgcunittest/MockUASManager.h \ - src/qgcunittest/MockUAS.h \ - src/qgcunittest/MockQGCUASParamManager.h \ - src/qgcunittest/MockMavlinkInterface.h \ - src/qgcunittest/MockMavlinkFileServer.h \ - src/qgcunittest/MultiSignalSpy.h \ - src/qgcunittest/FlightModeConfigTest.h \ - src/qgcunittest/FlightGearTest.h \ - src/qgcunittest/TCPLinkTest.h \ - src/qgcunittest/TCPLoopBackServer.h \ - src/qgcunittest/QGCUASFileManagerTest.h - - SOURCES += \ - src/qgcunittest/UASUnitTest.cc \ - src/qgcunittest/MockUASManager.cc \ - src/qgcunittest/MockUAS.cc \ - src/qgcunittest/MockQGCUASParamManager.cc \ - src/qgcunittest/MockMavlinkFileServer.cc \ - src/qgcunittest/MultiSignalSpy.cc \ - src/qgcunittest/FlightModeConfigTest.cc \ - src/qgcunittest/FlightGearTest.cc \ - src/qgcunittest/TCPLinkTest.cc \ - src/qgcunittest/TCPLoopBackServer.cc \ - src/qgcunittest/QGCUASFileManagerTest.cc -} - -# # External library configuration # @@ -783,3 +746,41 @@ SOURCES += \ src/uas/QGCUASWorker.cc \ src/CmdLineOptParser.cc \ src/uas/QGXPX4UAS.cc + +# +# Unit Test specific configuration goes here +# +# FIXME: These files should only be enabled on the Debug build, but that is currently broken as of Qt5.3.1 on Windows, +# so we just always compile them. +#ReleaseBuild { + INCLUDEPATH += \ + src/qgcunittest + + HEADERS += \ + src/qgcunittest/AutoTest.h \ + src/qgcunittest/UASUnitTest.h \ + src/qgcunittest/MockUASManager.h \ + src/qgcunittest/MockUAS.h \ + src/qgcunittest/MockQGCUASParamManager.h \ + src/qgcunittest/MockMavlinkInterface.h \ + src/qgcunittest/MockMavlinkFileServer.h \ + src/qgcunittest/MultiSignalSpy.h \ + src/qgcunittest/FlightModeConfigTest.h \ + src/qgcunittest/FlightGearTest.h \ + src/qgcunittest/TCPLinkTest.h \ + src/qgcunittest/TCPLoopBackServer.h \ + src/qgcunittest/QGCUASFileManagerTest.h + + SOURCES += \ + src/qgcunittest/UASUnitTest.cc \ + src/qgcunittest/MockUASManager.cc \ + src/qgcunittest/MockUAS.cc \ + src/qgcunittest/MockQGCUASParamManager.cc \ + src/qgcunittest/MockMavlinkFileServer.cc \ + src/qgcunittest/MultiSignalSpy.cc \ + src/qgcunittest/FlightModeConfigTest.cc \ + src/qgcunittest/FlightGearTest.cc \ + src/qgcunittest/TCPLinkTest.cc \ + src/qgcunittest/TCPLoopBackServer.cc \ + src/qgcunittest/QGCUASFileManagerTest.cc +#}