diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index a0f25f204..bccbd576b 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -5,6 +5,124 @@ TEMPLATE = subdirs # Copy Qt runtime libraries into the build directory (to run or package) equals(copydata, 1) { +GCS_LIBRARY_PATH + + linux-* { + + QT_LIBS = libQt5Core.so.5 \ + libQt5Gui.so.5 \ + libQt5Widgets.so.5 \ + libQt5Network.so.5 \ + libQt5OpenGL.so.5 \ + libQt5Sql.so.5 \ + libQt5Svg.so.5 \ + libQt5Test.so.5 \ + libQt5Xml.so.5 \ + libQt5Declarative.so.5 \ + libQt5XmlPatterns.so.5 \ + libQt5Script.so.5 \ + libQt5Concurrent.so.5 \ + libQt5PrintSupport.so.5 \ + libQt5SerialPort.so.5 \ + libQt5Multimedia.so.5 \ + libQt5MultimediaWidgets.so.5 \ + libQt5Quick.so.5 \ + libQt5Qml.so.5 \ + libQt5V8.so.5 \ + libQt5DBus.so.5 \ + libQt5QuickParticles.so.5 \ + libicui18n.so.51 \ + libicuuc.so.51 \ + libicudata.so.51 + + 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() + } + + # 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 \ + 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() + } + + # create QtQuick2 plugin directories + QT_QUICK2_DIRS = QtQuick \ + QtQuick.2 \ + QtQuick/Layouts \ + QtQuick/LocalStorage \ + QtQuick/Particles.2 \ + QtQuick/PrivateWidgets \ + QtQuick/Window.2 \ + QtQuick/XmlListModel + for(dir, QT_QUICK2_DIRS) { + data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline() + } + + # Copy QtQuick2 complete directories + # These directories have a lot of files + # Easier to copy everything + QTQ_WHOLE_DIRS = QtQuick/Controls \ + QtQuick/Dialogs + for(dir, QTQ_WHOLE_DIRS) { + data_copy.commands += $(COPY_DIR) $$targetPath(\"$$[QT_INSTALL_QML]/$$dir\") $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline() + } + + # Remove the few unwanted libs after whole dir copy + QT_QUICK2_DELS = QtQuick/Controls/libqtquickcontrolsplugin.so \ + QtQuick/Controls/Private/libqtquickcontrolsprivateplugin.so \ + QtQuick/Dialogs/libdialogplugin.so + + for(delfile, QT_QUICK2_DELS) { + data_copy.commands += $(DEL_FILE) $$targetPath(\"$$GCS_QT_QML_PATH/$${delfile}\") $$addNewline() + } + + # Remaining QtQuick plugin libs + QT_QUICK2_DLLS = QtQuick.2/libqtquick2plugin.so \ + QtQuick.2/plugins.qmltypes \ + QtQuick.2/qmldir \ + QtQuick/Layouts/libqquicklayoutsplugin.so \ + QtQuick/Layouts/plugins.qmltypes \ + QtQuick/Layouts/qmldir \ + QtQuick/LocalStorage/libqmllocalstorageplugin.so \ + QtQuick/LocalStorage/plugins.qmltypes \ + QtQuick/LocalStorage/qmldir \ + QtQuick/Particles.2/libparticlesplugin.so \ + QtQuick/Particles.2/plugins.qmltypes \ + QtQuick/Particles.2/qmldir \ + QtQuick/PrivateWidgets/libwidgetsplugin.so \ + QtQuick/PrivateWidgets/plugins.qmltypes \ + QtQuick/PrivateWidgets/qmldir \ + QtQuick/Window.2/libwindowplugin.so \ + QtQuick/Window.2/plugins.qmltypes \ + QtQuick/Window.2/qmldir \ + QtQuick/XmlListModel/libqmlxmllistmodelplugin.so \ + QtQuick/XmlListModel/plugins.qmltypes \ + QtQuick/XmlListModel/qmldir + + for(lib, QT_QUICK2_DLLS) { + data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$lib\") $$targetPath(\"$$GCS_QT_QML_PATH/$$lib\") $$addNewline() + } + + data_copy.target = FORCE + QMAKE_EXTRA_TARGETS += data_copy + } # Windows release only, no debug target DLLs ending with 'd' # It is assumed that SDL.dll can be found in the same directory as mingw32-make.exe win32 { diff --git a/ground/openpilotgcs/openpilotgcs.pri b/ground/openpilotgcs/openpilotgcs.pri index cf984a611..aed8044f9 100644 --- a/ground/openpilotgcs/openpilotgcs.pri +++ b/ground/openpilotgcs/openpilotgcs.pri @@ -89,6 +89,9 @@ macx { } else { GCS_APP_WRAPPER = openpilotgcs GCS_APP_TARGET = openpilotgcs.bin + GCS_QT_LIBRARY_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5 + GCS_QT_PLUGINS_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5/plugins + GCS_QT_QML_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5/qml } GCS_LIBRARY_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/openpilotgcs GCS_PLUGIN_PATH = $$GCS_LIBRARY_PATH/plugins diff --git a/ground/openpilotgcs/src/openpilotgcsplugin.pri b/ground/openpilotgcs/src/openpilotgcsplugin.pri index 6fee35d8e..9276f1832 100644 --- a/ground/openpilotgcs/src/openpilotgcsplugin.pri +++ b/ground/openpilotgcs/src/openpilotgcsplugin.pri @@ -31,7 +31,7 @@ macx { QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Plugins/$${PROVIDER}/ } else:linux-* { #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR - QMAKE_RPATHDIR += \$\$ORIGIN + QMAKE_RPATHDIR = \$\$ORIGIN QMAKE_RPATHDIR += \$\$ORIGIN/.. QMAKE_RPATHDIR += \$\$ORIGIN/../.. GCS_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":") @@ -45,7 +45,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hGCS_symbols CONFIG += plugin plugin_with_soname !macx { - target.path = /$$GCS_LIBRARY_BASENAME/opnepilotgcs/plugins/$$PROVIDER + target.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs/plugins/$$PROVIDER pluginspec.files += $${TARGET}.pluginspec pluginspec.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs/plugins/$$PROVIDER INSTALLS += target pluginspec diff --git a/ground/openpilotgcs/src/rpath.pri b/ground/openpilotgcs/src/rpath.pri index f6cb4d196..6d000262f 100644 --- a/ground/openpilotgcs/src/rpath.pri +++ b/ground/openpilotgcs/src/rpath.pri @@ -3,7 +3,8 @@ macx { } else:linux-* { #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR # this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var - QMAKE_RPATHDIR += \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/openpilotgcs + QMAKE_RPATHDIR = \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/openpilotgcs + QMAKE_RPATHDIR += \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/qt5 GCS_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":") QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${GCS_PLUGIN_RPATH}\' diff --git a/package/linux/deb_common/openpilot.substvars b/package/linux/deb_common/openpilot.substvars index 39006599c..ed7070fc2 100644 --- a/package/linux/deb_common/openpilot.substvars +++ b/package/linux/deb_common/openpilot.substvars @@ -1,2 +1,2 @@ -shlibs:Depends=libc6 (>= 2.3.6-6~), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libglu1-mesa | libglu1, libphonon4 (>= 4:4.3.0), libqt4-network (>= 4:4.6.1), libqt4-opengl (>= 4:4.6.1), libqt4-script (>= 4:4.5.3), libqt4-sql (>= 4:4.5.3), libqt4-svg (>= 4:4.5.3), libqt4-test (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.6.2), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.1), libudev0 (>= 147), libusb-0.1-4 (>= 2:0.1.12), phonon +shlibs:Depends=libc6 (>= 2.3.6-6~), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libglu1-mesa | libglu1, libphonon4 (>= 4:4.3.0), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.1), libudev0 | libudev1, libusb-0.1-4 (>= 2:0.1.12), phonon misc:Depends= diff --git a/package/linux/deb_common/rules b/package/linux/deb_common/rules index 9bf1a3e68..6af5f63c5 100644 --- a/package/linux/deb_common/rules +++ b/package/linux/deb_common/rules @@ -25,7 +25,7 @@ clean: dh_testdir dh_testroot dh_clean - + install: dh_testdir dh_testroot @@ -37,6 +37,7 @@ install: cp -arp build/openpilotgcs_release/lib debian/openpilot/usr/local/OpenPilot cp -arp build/openpilotgcs_release/share debian/openpilot/usr/local/OpenPilot cp -arp build/openpilotgcs_release/.obj debian/openpilot/usr/local/OpenPilot + cp -arp package/linux/qt.conf debian/openpilot/usr/local/OpenPilot/bin cp -arp package/linux/openpilot.desktop debian/openpilot/usr/share/applications cp -arp package/linux/openpilot.png debian/openpilot/usr/share/pixmaps cp -arp package/linux/openpilot_menu.png debian/openpilot/usr/share/pixmaps @@ -73,10 +74,10 @@ binary-arch: install dh_compress dh_fixperms dh_installdeb - dh_shlibdeps -l/usr/local/OpenPilot/lib/openpilotgcs --dpkg-shlibdeps-params="--ignore-missing-info -v" + dh_shlibdeps -l/usr/local/OpenPilot/lib/openpilotgcs -l/usr/local/OpenPilot/lib/qt5 --dpkg-shlibdeps-params="--ignore-missing-info -v" dh_gencontrol dh_md5sums - dh_builddeb + dh_builddeb -- -Zbzip2 binary: binary-indep binary-arch diff --git a/package/linux/qt.conf b/package/linux/qt.conf new file mode 100644 index 000000000..b8dd60015 --- /dev/null +++ b/package/linux/qt.conf @@ -0,0 +1,6 @@ +[Paths] +Prefix = .. +Plugins = lib/qt5/plugins +Imports = lib/qt5/qml +Qml2Imports = lib/qt5/qml +Libraries = lib/qt5