QGCSetup.pri 6.94 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6
# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Maintainer:
# Lorenz Meier <lm@inf.ethz.ch>
# (c) 2009-2011 QGroundControl Developers
Lorenz Meier's avatar
Lorenz Meier committed
7
# License terms set in COPYING.md
Don Gagne's avatar
Don Gagne committed
8 9
# -------------------------------------------------

Bryant's avatar
Bryant committed
10
QMAKE_POST_LINK += echo "Copying files"
Don Gagne's avatar
Don Gagne committed
11 12 13 14 15 16 17 18 19 20 21 22

#
# Copy the application resources to the associated place alongside the application
#

LinuxBuild {
    DESTDIR_COPY_RESOURCE_LIST = $$DESTDIR
}

MacBuild {
    DESTDIR_COPY_RESOURCE_LIST = $$DESTDIR/$${TARGET}.app/Contents/MacOS
}
Don Gagne's avatar
Don Gagne committed
23 24 25 26 27 28

# Windows version of QMAKE_COPY_DIR of course doesn't work the same as Mac/Linux. It will only
# copy the contents of the source directory. It doesn't create the top level source directory
# in the target.
WindowsBuild {
    # Make sure to keep both side of this if using the same set of directories
29 30
    DESTDIR_COPY_RESOURCE_LIST = $$replace(DESTDIR,"/","\\")
    BASEDIR_COPY_RESOURCE_LIST = $$replace(BASEDIR,"/","\\")
31
    QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\resources\\flightgear\" \"$$DESTDIR_COPY_RESOURCE_LIST\\flightgear\"
Don Gagne's avatar
Don Gagne committed
32
} else {
dogmaphobic's avatar
dogmaphobic committed
33
    !MobileBuild {
dogmaphobic's avatar
dogmaphobic committed
34
        # Make sure to keep both sides of this if using the same set of directories
35
        QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/resources/flightgear $$DESTDIR_COPY_RESOURCE_LIST
dogmaphobic's avatar
dogmaphobic committed
36
    }
Don Gagne's avatar
Don Gagne committed
37
}
Don Gagne's avatar
Don Gagne committed
38 39 40 41 42

#
# Perform platform specific setup
#

DonLakeFlyer's avatar
DonLakeFlyer committed
43
MacBuild {
44 45 46 47 48
    # Update version info in bundle
    QMAKE_POST_LINK += && /usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $${MAC_VERSION}\" $$DESTDIR/$${TARGET}.app/Contents/Info.plist
    QMAKE_POST_LINK += && /usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $${MAC_BUILD}\" $$DESTDIR/$${TARGET}.app/Contents/Info.plist
}

Don Gagne's avatar
Don Gagne committed
49
MacBuild {
dogmaphobic's avatar
dogmaphobic committed
50
    # Copy non-standard frameworks into app package
51
    QMAKE_POST_LINK += && rsync -a --delete $$BASEDIR/libs/lib/Frameworks $$DESTDIR/$${TARGET}.app/Contents/
52 53
    # SDL2 Framework
    QMAKE_POST_LINK += && install_name_tool -change "@rpath/SDL2.framework/Versions/A/SDL2" "@executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2" $$DESTDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
Gus Grubba's avatar
Gus Grubba committed
54 55
    # AirMap
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
56
        QMAKE_POST_LINK += && rsync -a $$BASEDIR/libs/airmapd/macOS/Qt.5.11.0/* $$DESTDIR/$${TARGET}.app/Contents/Frameworks/
Gus Grubba's avatar
Gus Grubba committed
57
        QMAKE_POST_LINK += && install_name_tool -change "@rpath/libairmap-qt.0.0.1.dylib" "@executable_path/../Frameworks/libairmap-qt.0.0.1.dylib" $$DESTDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
Gus Grubba's avatar
Gus Grubba committed
58
    }
Don Gagne's avatar
Don Gagne committed
59 60 61
}

WindowsBuild {
62 63
    BASEDIR_WIN = $$replace(BASEDIR, "/", "\\")
    DESTDIR_WIN = $$replace(DESTDIR, "/", "\\")
64
    QT_BIN_DIR  = $$dirname(QMAKE_QMAKE)
Don Gagne's avatar
Don Gagne committed
65

66 67
    # Copy dependencies
    DebugBuild: DLL_QT_DEBUGCHAR = "d"
68
    ReleaseBuild: DLL_QT_DEBUGCHAR = ""
Don Gagne's avatar
Don Gagne committed
69
    COPY_FILE_LIST = \
70
        $$BASEDIR\\libs\\lib\\sdl2\\msvc\\lib\\x86\\SDL2.dll \
birchera's avatar
birchera committed
71 72
        $$BASEDIR\\deploy\\libeay32.dll \
        $$BASEDIR_WIN\\deploy\\ssleay32.dll
73

Don Gagne's avatar
Don Gagne committed
74
    for(COPY_FILE, COPY_FILE_LIST) {
dogmaphobic's avatar
dogmaphobic committed
75
        QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$COPY_FILE\" \"$$DESTDIR_WIN\"
Don Gagne's avatar
Don Gagne committed
76 77
    }

78
    ReleaseBuild {
dogmaphobic's avatar
dogmaphobic committed
79 80 81 82 83
        # Copy Visual Studio DLLs
        # Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed.
        win32-msvc2010 {
            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\"
84 85

        } else:win32-msvc2012 {
dogmaphobic's avatar
dogmaphobic committed
86 87
            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\"
88 89

        } else:win32-msvc2013 {
dogmaphobic's avatar
dogmaphobic committed
90 91
            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\"
92 93

        } else:win32-msvc2015 {
Don Gagne's avatar
Don Gagne committed
94 95
            QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp140.dll\"  \"$$DESTDIR_WIN\"
            QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\vcruntime140.dll\"  \"$$DESTDIR_WIN\"
96 97

        } else {
dogmaphobic's avatar
dogmaphobic committed
98 99 100
            error("Visual studio version not supported, installation cannot be completed.")
        }
    }
101 102

    DEPLOY_TARGET = $$shell_quote($$shell_path($$DESTDIR_WIN\\$${TARGET}.exe))
103
    QMAKE_POST_LINK += $$escape_expand(\\n) $$QT_BIN_DIR\\windeployqt --no-compiler-runtime --qmldir=$${BASEDIR_WIN}\\src $${DEPLOY_TARGET}
Don Gagne's avatar
Don Gagne committed
104
}
105

106
LinuxBuild {
107 108 109 110
    QMAKE_POST_LINK += && mkdir -p $$DESTDIR/Qt/libs && mkdir -p $$DESTDIR/Qt/plugins

    # QT_INSTALL_LIBS
    QT_LIB_LIST = \
DonLakeFlyer's avatar
DonLakeFlyer committed
111
        libQt5Charts.so.5 \
112 113 114 115 116
        libQt5Core.so.5 \
        libQt5DBus.so.5 \
        libQt5Gui.so.5 \
        libQt5Location.so.5 \
        libQt5Multimedia.so.5 \
117
        libQt5MultimediaQuick.so.5 \
118 119 120
        libQt5Network.so.5 \
        libQt5OpenGL.so.5 \
        libQt5Positioning.so.5 \
121
        libQt5PositioningQuick.so.5 \
122 123 124
        libQt5PrintSupport.so.5 \
        libQt5Qml.so.5 \
        libQt5Quick.so.5 \
Don Gagne's avatar
Don Gagne committed
125
        libQt5QuickControls2.so.5 \
DonLakeFlyer's avatar
DonLakeFlyer committed
126 127
        libQt5QuickTemplates2.so.5 \
        libQt5QuickWidgets.so.5 \
128 129 130 131 132
        libQt5SerialPort.so.5 \
        libQt5Sql.so.5 \
        libQt5Svg.so.5 \
        libQt5Test.so.5 \
        libQt5Widgets.so.5 \
133
        libQt5XcbQpa.so.5 \
DonLakeFlyer's avatar
DonLakeFlyer committed
134
        libQt5Xml.so.5 \
135
        libQt5TextToSpeech.so.5
136 137 138

    !contains(DEFINES, __rasp_pi2__) {
        QT_LIB_LIST += \
139 140 141
            libicudata.so \
            libicui18n.so \
            libicuuc.so
142
    }
ChukRhodes's avatar
ChukRhodes committed
143

144 145 146
    for(QT_LIB, QT_LIB_LIST) {
        QMAKE_POST_LINK += && $$QMAKE_COPY --dereference $$[QT_INSTALL_LIBS]/$$QT_LIB $$DESTDIR/Qt/libs/
    }
147

148 149 150 151 152 153 154 155 156
    # QT_INSTALL_PLUGINS
    QT_PLUGIN_LIST = \
        bearer \
        geoservices \
        iconengines \
        imageformats \
        platforminputcontexts \
        platforms \
        position \
DonLakeFlyer's avatar
DonLakeFlyer committed
157 158
        sqldrivers \
        texttospeech
159 160 161 162

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

164 165 166
    for(QT_PLUGIN, QT_PLUGIN_LIST) {
        QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_PLUGINS]/$$QT_PLUGIN $$DESTDIR/Qt/plugins/
    }
167

168 169
    # QT_INSTALL_QML
    QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_QML] $$DESTDIR/Qt/
170

171 172
    # Airmap
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
173
        QMAKE_POST_LINK += && $$QMAKE_COPY $$PWD/libs/airmapd/linux/Qt.5.11.0/libairmap-qt.so.0.0.1 $$DESTDIR/Qt/libs/
174 175
    }

176 177 178 179
    # QGroundControl start script
    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
180
}