QGCPostLinkCommon.pri 5.09 KB
Newer Older
Gus Grubba's avatar
Gus Grubba committed
1 2 3 4 5 6 7 8
################################################################################
#
# (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
#
# QGroundControl is licensed according to the terms in the file
# COPYING.md in the root of the source code directory.
#
################################################################################
Don Gagne's avatar
Don Gagne committed
9

Don Gagne's avatar
Don Gagne committed
10
# These are the Post Link steps which are common to all builds
Don Gagne's avatar
Don Gagne committed
11 12 13 14 15

#
# Perform platform specific setup
#

DonLakeFlyer's avatar
DonLakeFlyer committed
16
MacBuild {
17
    macx-xcode {
Don Gagne's avatar
Don Gagne committed
18 19 20 21 22 23 24 25 26 27 28 29
        # XCode Project builds create the .app in BUILT_PRODUCTS_DIR. Copy it to the normal location for QtCreator builds.
        QMAKE_POST_LINK += cp -r $BUILT_PRODUCTS_DIR/$${TARGET}.app .
    }

    # Copy non-standard frameworks into app package
    QMAKE_POST_LINK += rsync -a --delete $$BASEDIR/libs/Frameworks $${TARGET}.app/Contents/
    # SDL2 Framework
    QMAKE_POST_LINK += && install_name_tool -change "@rpath/SDL2.framework/Versions/A/SDL2" "@executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2" $${TARGET}.app/Contents/MacOS/$${TARGET}
    # AirMap
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
        QMAKE_POST_LINK += && rsync -a $$BASEDIR/libs/airmapd/macOS/$$AIRMAP_QT_PATH/* $${TARGET}.app/Contents/Frameworks/
        QMAKE_POST_LINK += && install_name_tool -change "@rpath/libairmap-qt.0.0.1.dylib" "@executable_path/../Frameworks/libairmap-qt.0.0.1.dylib" $${TARGET}.app/Contents/MacOS/$${TARGET}
Gus Grubba's avatar
Gus Grubba committed
30
    }
Don Gagne's avatar
Don Gagne committed
31 32 33
}

WindowsBuild {
34 35
    BASEDIR_WIN = $$replace(BASEDIR, "/", "\\")
    DESTDIR_WIN = $$replace(DESTDIR, "/", "\\")
36
    QT_BIN_DIR  = $$dirname(QMAKE_QMAKE)
Don Gagne's avatar
Don Gagne committed
37

38 39
    # Copy dependencies
    DebugBuild: DLL_QT_DEBUGCHAR = "d"
40
    ReleaseBuild: DLL_QT_DEBUGCHAR = ""
Don Gagne's avatar
Don Gagne committed
41
    COPY_FILE_LIST = \
Don Gagne's avatar
Don Gagne committed
42
        $$BASEDIR\\libs\\sdl2\\msvc\\lib\\x64\\SDL2.dll \
DonLakeFlyer's avatar
DonLakeFlyer committed
43 44
        $$BASEDIR\\deploy\\libcrypto-1_1-x64.dll \
        $$BASEDIR_WIN\\deploy\\libssl-1_1-x64.dll
45

Don Gagne's avatar
Don Gagne committed
46
    for(COPY_FILE, COPY_FILE_LIST) {
dogmaphobic's avatar
dogmaphobic committed
47
        QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$COPY_FILE\" \"$$DESTDIR_WIN\"
Don Gagne's avatar
Don Gagne committed
48 49
    }

50
    ReleaseBuild {
dogmaphobic's avatar
dogmaphobic committed
51 52
        # Copy Visual Studio DLLs
        # Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed.
DonLakeFlyer's avatar
DonLakeFlyer committed
53 54
        QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$BASEDIR\\deploy\\msvcp140.dll\"  \"$$DESTDIR_WIN\"
        QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$BASEDIR\\deploy\\vcruntime140.dll\"  \"$$DESTDIR_WIN\"
dogmaphobic's avatar
dogmaphobic committed
55
    }
56 57

    DEPLOY_TARGET = $$shell_quote($$shell_path($$DESTDIR_WIN\\$${TARGET}.exe))
Gus Grubba's avatar
Gus Grubba committed
58
    QMAKE_POST_LINK += $$escape_expand(\\n) $$QT_BIN_DIR\\windeployqt --qmldir=$${BASEDIR_WIN}\\src $${DEPLOY_TARGET}
Don Gagne's avatar
Don Gagne committed
59
}
60

61
LinuxBuild {
62 63 64
    QMAKE_POST_LINK += && mkdir -p $$DESTDIR/Qt/libs && mkdir -p $$DESTDIR/Qt/plugins

    # QT_INSTALL_LIBS
65
    QT_LIB_LIST += \
DonLakeFlyer's avatar
DonLakeFlyer committed
66
        libQt5Charts.so.5 \
67 68 69 70 71
        libQt5Core.so.5 \
        libQt5DBus.so.5 \
        libQt5Gui.so.5 \
        libQt5Location.so.5 \
        libQt5Multimedia.so.5 \
72
        libQt5MultimediaQuick.so.5 \
73 74 75
        libQt5Network.so.5 \
        libQt5OpenGL.so.5 \
        libQt5Positioning.so.5 \
76
        libQt5PositioningQuick.so.5 \
77 78 79
        libQt5PrintSupport.so.5 \
        libQt5Qml.so.5 \
        libQt5Quick.so.5 \
Don Gagne's avatar
Don Gagne committed
80
        libQt5QuickControls2.so.5 \
DonLakeFlyer's avatar
DonLakeFlyer committed
81 82
        libQt5QuickTemplates2.so.5 \
        libQt5QuickWidgets.so.5 \
83 84 85 86 87
        libQt5SerialPort.so.5 \
        libQt5Sql.so.5 \
        libQt5Svg.so.5 \
        libQt5Test.so.5 \
        libQt5Widgets.so.5 \
DoinLakeFlyer's avatar
DoinLakeFlyer committed
88
        libQt5X11Extras.so.5 \
89
        libQt5XcbQpa.so.5 \
DonLakeFlyer's avatar
DonLakeFlyer committed
90
        libQt5Xml.so.5 \
91
        libicui18n.so* \
92
        libQt5TextToSpeech.so.5
93 94

    !contains(DEFINES, __rasp_pi2__) {
95
        # Some Qt distributions link with *.so.56
96
        QT_LIB_LIST += \
97 98 99
            libicudata.so.56 \
            libicui18n.so.56 \
            libicuuc.so.56
100
    }
ChukRhodes's avatar
ChukRhodes committed
101

102 103 104
    for(QT_LIB, QT_LIB_LIST) {
        QMAKE_POST_LINK += && $$QMAKE_COPY --dereference $$[QT_INSTALL_LIBS]/$$QT_LIB $$DESTDIR/Qt/libs/
    }
105

106 107 108 109 110 111 112 113 114
    # QT_INSTALL_PLUGINS
    QT_PLUGIN_LIST = \
        bearer \
        geoservices \
        iconengines \
        imageformats \
        platforminputcontexts \
        platforms \
        position \
DonLakeFlyer's avatar
DonLakeFlyer committed
115 116
        sqldrivers \
        texttospeech
117 118 119 120

    !contains(DEFINES, __rasp_pi2__) {
        QT_PLUGIN_LIST += xcbglintegrations
    }
121

122 123 124
    for(QT_PLUGIN, QT_PLUGIN_LIST) {
        QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_PLUGINS]/$$QT_PLUGIN $$DESTDIR/Qt/plugins/
    }
125

126 127
    # QT_INSTALL_QML
    QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_QML] $$DESTDIR/Qt/
128

129 130
    # Airmap
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
131
        QMAKE_POST_LINK += && $$QMAKE_COPY $$PWD/libs/airmapd/linux/Qt.5.11.0/libairmap-qt.so.0.0.1 $$DESTDIR/Qt/libs/
132 133
    }

134
    # QGroundControl start script
135 136 137 138 139 140 141
    contains (CONFIG, QGC_DISABLE_CUSTOM_BUILD) | !exists($$PWD/custom/custom.pri) {
        QMAKE_POST_LINK += && $$QMAKE_COPY $$BASEDIR/deploy/qgroundcontrol-start.sh $$DESTDIR
        QMAKE_POST_LINK += && $$QMAKE_COPY $$BASEDIR/deploy/qgroundcontrol.desktop $$DESTDIR
        QMAKE_POST_LINK += && $$QMAKE_COPY $$BASEDIR/resources/icons/qgroundcontrol.png $$DESTDIR
    } else {
        include($$PWD/custom/custom_deploy.pri)
    }
142
}