qgroundcontrol.pri 23.4 KB
Newer Older
1
# -------------------------------------------------
2 3
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
4 5 6 7
# Maintainer:
# Lorenz Meier <lm@inf.ethz.ch>
# (c) 2009-2011 QGroundControl Developers
# This file is part of the open groundstation project
8 9 10 11 12 13 14 15 16 17
# QGroundControl is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# QGroundControl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with QGroundControl. If not, see <http://www.gnu.org/licenses/>.
18
# -------------------------------------------------
19 20 21

message(Qt version $$[QT_VERSION])

22
win32-msvc2008|win32-msvc2010|win32-msvc2012 {
23
	QMAKE_POST_LINK += $$quote(echo "Copying files"$$escape_expand(\\n))
24
} else {
25
	QMAKE_POST_LINK += $$quote(echo "Copying files")
26
}
27

28 29 30
# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

31 32 33
# This is the list of application resources which must be copied to the build target location
# We create one list and use it in each build type so that the various build flavors don't
# get out of sync.
34 35 36 37 38
COPY_RESOURCE_LIST = \
    $$BASEDIR/files \
    $$BASEDIR/qml \
    $$BASEDIR/data

39
# MAC OS X
Lorenz Meier's avatar
Lorenz Meier committed
40
macx|macx-g++42|macx-g++|macx-llvm: {
41

42 43
        CONFIG += x86_64 cocoa phonon
        CONFIG -= x86
44 45 46

	QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6

Lorenz Meier's avatar
Lorenz Meier committed
47
        INCLUDEPATH += $$BASEDIR/libs/lib/Frameworks/SDL.framework/Headers
48

Lorenz Meier's avatar
Lorenz Meier committed
49
        LIBS += -framework IOKit \
50
                -F$$BASEDIR/libs/lib/Frameworks \
Lorenz Meier's avatar
Lorenz Meier committed
51 52 53 54
                -framework SDL \
                -framework CoreFoundation \
                -framework ApplicationServices \
                -lm
55

56
	ICON = $$BASEDIR/files/images/icons/macx.icns
57

58
    # Copy application resources
59
    for(COPY_DIR, COPY_RESOURCE_LIST):QMAKE_POST_LINK += && cp -rf $${COPY_DIR} $$TARGETDIR/$${TARGET}.app/Contents/MacOS
60

61
        # Copy MAVLink
62
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/libs/mavlink $$TARGETDIR/$${TARGET}.app/Contents/MacOS
63
	# Copy libraries
64 65
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/libs
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/libs/lib/mac64/lib/* $$TARGETDIR/$${TARGET}.app/Contents/libs
66
        # Copy frameworks
67 68
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/Frameworks
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/libs/lib/Frameworks/* $$TARGETDIR/$${TARGET}.app/Contents/Frameworks
69

70

71
	# Fix library paths inside executable
72 73 74 75 76 77 78
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
        QMAKE_POST_LINK += && install_name_tool -change libosgViewer.dylib "@executable_path/../libs/libosgViewer.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
        QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
        QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
        QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
        QMAKE_POST_LINK += && install_name_tool -change libosgWidget.dylib "@executable_path/../libs/libosgWidget.dylib" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
79 80 81 82

	# Fix library paths within libraries (inter-library dependencies)

	# OSG GA LIBRARY
83 84 85 86 87
        QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgGA.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgGA.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgGA.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgGA.dylib
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgGA.dylib
88 89

	# OSG DB LIBRARY
90 91 92 93
        QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgDB.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgDB.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgDB.dylib
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgDB.dylib
94 95

	# OSG TEXT LIBRARY
96 97 98 99 100
        QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgText.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgText.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgText.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgText.dylib
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgText.dylib
101 102

	# OSG UTIL LIBRARY
103 104
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgUtil.dylib
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgUtil.dylib
105 106 107


	# OSG VIEWER LIBRARY
108 109 110 111 112 113
        QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib
114 115

	# OSG WIDGET LIBRARY
116 117 118 119 120 121 122
        QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
        QMAKE_POST_LINK += && install_name_tool -change libosgViewer.dylib "@executable_path/../libs/libosgViewer.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib
123 124

	# CORE OSG LIBRARY
125
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosg.dylib
126

127
        # SDL Framework
128
        QMAKE_POST_LINK += && install_name_tool -change "@rpath/SDL.framework/Versions/A/SDL" "@executable_path/../Frameworks/SDL.framework/Versions/A/SDL" $$TARGETDIR/$${TARGET}.app/Contents/MacOS/$${TARGET}
129

130 131 132 133 134 135 136
	# No check for GLUT.framework since it's a MAC default
	message("Building support for OpenSceneGraph")
	DEPENDENCIES_PRESENT += osg
	DEFINES += QGC_OSG_ENABLED
	# Include OpenSceneGraph libraries
	INCLUDEPATH += -framework GLUT \
        -framework Cocoa \
137
        $$BASEDIR/libs/lib/mac64/include
138 139 140

	LIBS += -framework GLUT \
        -framework Cocoa \
141
        -L$$BASEDIR/libs/lib/mac64/lib \
142
        -L$$BASEDIR/libs/lib/mac32/lib \
143 144 145 146 147 148 149 150
        -lOpenThreads \
        -losg \
        -losgViewer \
        -losgGA \
        -losgDB \
        -losgText \
        -losgWidget

151 152 153 154 155 156 157 158 159 160 161
        #exists(/usr/local/include/google/protobuf) {
        #	message("Building support for Protocol Buffers")
        #	DEPENDENCIES_PRESENT += protobuf
        #	# Include Protocol Buffers libraries
        #	LIBS += -L/usr/local/lib \
        #    -lprotobuf \
        #    -lprotobuf-lite \
        #    -lprotoc
        #
        #	DEFINES += QGC_PROTOBUF_ENABLED
        #}
LM's avatar
LM committed
162

163 164 165 166 167 168 169
	exists(/opt/local/include/libfreenect)|exists(/usr/local/include/libfreenect) {
		message("Building support for libfreenect")
		DEPENDENCIES_PRESENT += libfreenect
		# Include libfreenect libraries
		LIBS += -lfreenect
		DEFINES += QGC_LIBFREENECT_ENABLED
	}
170 171 172
}

# GNU/Linux
173
linux-g++|linux-g++-64{
174

175
	CONFIG -= console
James Goppert's avatar
James Goppert committed
176
	DEFINES += __STDC_LIMIT_MACROS
177

178
	CONFIG(release, debug|release) {
179 180 181 182 183
		DEFINES += QT_NO_DEBUG
	}

	INCLUDEPATH += /usr/include \
        /usr/local/include \
Geoff Fink's avatar
Geoff Fink committed
184 185
        /usr/include/qt4/phonon \
	/usr/include/phonon
186 187 188 189 190 191 192 193 194 195

	LIBS += \
		-L/usr/lib \
		-L/usr/local/lib64 \
		-lm \
		-lflite_cmu_us_kal \
		-lflite_usenglish \
		-lflite_cmulex \
		-lflite \
		-lSDL \
Thomas Gubler's avatar
Thomas Gubler committed
196 197
		-lSDLmain \
		-lasound
198 199 200 201 202 203

	exists(/usr/include/osg) | exists(/usr/local/include/osg) {
		message("Building support for OpenSceneGraph")
		DEPENDENCIES_PRESENT += osg
		# Include OpenSceneGraph libraries
		LIBS += -losg \
James Goppert's avatar
James Goppert committed
204 205 206 207 208 209
            -losgViewer \
            -losgGA \
            -losgDB \
            -losgText \
            -lOpenThreads

210 211 212 213 214 215 216 217 218 219 220
		DEFINES += QGC_OSG_ENABLED
	}

	exists(/usr/include/osg/osgQt) | exists(/usr/include/osgQt) |
	exists(/usr/local/include/osg/osgQt) | exists(/usr/local/include/osgQt) {
		message("Building support for OpenSceneGraph Qt")
		# Include OpenSceneGraph Qt libraries
		LIBS += -losgQt
		DEFINES += QGC_OSG_QT_ENABLED
	}

221 222
	exists(/usr/local/include/google/protobuf) |
	exists(/usr/include/google/protobuf) {
223 224 225 226
		message("Building support for Protocol Buffers")
		DEPENDENCIES_PRESENT += protobuf
		# Include Protocol Buffers libraries
		LIBS += -lprotobuf \
227 228 229
            -lprotobuf-lite \
            -lprotoc

230 231 232
		DEFINES += QGC_PROTOBUF_ENABLED
	}

Geoff Fink's avatar
Geoff Fink committed
233 234
	exists(/usr/local/include/libfreenect/libfreenect.h) |
	exists(/usr/include/libfreenect/libfreenect.h) {
235 236 237 238 239 240 241 242 243 244 245 246 247
		message("Building support for libfreenect")
		DEPENDENCIES_PRESENT += libfreenect
		INCLUDEPATH += /usr/include/libusb-1.0
		# Include libfreenect libraries
		LIBS += -lfreenect
		DEFINES += QGC_LIBFREENECT_ENABLED
	}

	# Validated copy commands
	!exists($$TARGETDIR){
		QMAKE_POST_LINK += && mkdir -p $$TARGETDIR
	}
	DESTDIR = $$TARGETDIR
248 249 250
    
    # Copy application resources
    for(COPY_DIR, COPY_RESOURCE_LIST):QMAKE_POST_LINK += && cp -rf $${COPY_DIR} $$TARGETDIR
251 252 253 254

	# osg/osgEarth dynamic casts might fail without this compiler option.
	# see http://osgearth.org/wiki/FAQ for details.
	QMAKE_CXXFLAGS += -Wl,-E
255 256
}

257
linux-g++ {
258
	message("Building for GNU/Linux 32bit/i386")
259
}
260
linux-g++-64 {
261 262
	message("Building for GNU/Linux 64bit/x64 (g++-64)")
	exists(/usr/local/lib64) {
Geoff Fink's avatar
Geoff Fink committed
263
		LIBS += -L/usr/local/lib64 -L/usr/lib64
264
	}
265 266
}

267
# Windows (32bit), Visual Studio
268
win32-msvc2008|win32-msvc2010|win32-msvc2012 {
269

270 271 272 273 274 275
	win32-msvc2008 {
		message(Building for Windows Visual Studio 2008 (32bit))
	}
	win32-msvc2010 {
		message(Building for Windows Visual Studio 2010 (32bit))
	}
276 277 278 279 280
	
	# Specify multi-process compilation within Visual Studio.
	# (drastically improves compilation times for multi-core computers)
	QMAKE_CXXFLAGS_DEBUG += -MP
	QMAKE_CXXFLAGS_RELEASE += -MP
281

282 283 284
	# QAxContainer support is needed for the Internet Control
	# element showing the Google Earth window
	CONFIG += qaxcontainer
285

286 287 288
	# The EIGEN library needs this define
	# to make the internal min/max functions work
	DEFINES += NOMINMAX
289

290 291
	# QWebkit is not needed on MS-Windows compilation environment
	CONFIG -= webkit
Bryant's avatar
Bryant committed
292 293 294
	
	# Specify the inclusion of (U)INT*_(MAX/MIN) macros within Visual Studio
	DEFINES += __STDC_LIMIT_MACROS
lm's avatar
lm committed
295

296 297 298 299
	# For release builds remove support for various Qt debugging macros.
	CONFIG(release, debug|release) {
		DEFINES += QT_NO_DEBUG
	}
300

301 302
	# For debug releases we just want the debugging console.
	CONFIG(debug, debug|release) {
303 304
		CONFIG += console
	}
305

306 307
	INCLUDEPATH += $$BASEDIR/libs/lib/sdl/msvc/include \
        $$BASEDIR/libs/lib/opal/include \
308 309
        $$BASEDIR/libs/lib/msinttypes \
        $$(QTDIR)/src/activeqt/shared
310

311
	LIBS += -L$$BASEDIR/libs/lib/sdl/msvc/lib \
312 313 314
        -lSDLmain -lSDL \
        -lsetupapi

315
	exists($$BASEDIR/libs/lib/osg123) {
316 317 318 319
		message("Building support for OSG")
		DEPENDENCIES_PRESENT += osg

		# Include OpenSceneGraph
320 321 322
		INCLUDEPATH += $$BASEDIR/libs/lib/osgEarth/win32/include \
			$$BASEDIR/libs/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/include
		LIBS += -L$$BASEDIR/libs/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/lib \
323 324 325 326 327 328 329 330
			-losg \
			-losgViewer \
			-losgGA \
			-losgDB \
			-losgText \
			-lOpenThreads
		DEFINES += QGC_OSG_ENABLED
	}
331

332
	RC_FILE = $$BASEDIR/qgroundcontrol.rc
333

334 335 336
	# Copy dependencies
	BASEDIR_WIN = $$replace(BASEDIR,"/","\\")
	TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")
337
    COPY_RESOURCE_LIST_WIN = $$replace(COPY_RESOURCE_LIST, "/","\\")
338

339
	CONFIG(debug, debug|release) {
340
		# Copy supporting library DLLs
341
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
342
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\mavlink" "$$TARGETDIR_WIN\\debug\\mavlink" /E /I $$escape_expand(\\n))
343 344
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))

345
		# Copy application resources
346
        for(COPY_DIR, COPY_RESOURCE_LIST):QMAKE_POST_LINK += $$quote(xcopy /D /Y "$${COPY_DIR}" "$$TARGETDIR_WIN\\debug" /E /I $$escape_expand(\\n))
347 348

		# Copy Qt DLLs
349 350 351 352 353 354 355 356 357
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I $$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\phonond4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtCored4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtGuid4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtMultimediad4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtNetworkd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtOpenGLd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSqld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSvgd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
358
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtTestd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
359 360 361
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
362 363
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtDeclaratived4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtScriptd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
364
	}
365

366
	CONFIG(release, debug|release) {
367 368 369 370 371
	
		# Use link time code generation for beteer optimization (I believe this is supported in msvc express, but not 100% sure)
		QMAKE_LFLAGS_LTCG = /LTCG
		QMAKE_CFLAGS_LTCG = -GL

372
		# Copy supporting library DLLs
373
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
374 375 376 377
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\mavlink" "$$TARGETDIR_WIN\\release\\mavlink" /E /I $$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))

		# Copy application resources
378
        for(COPY_DIR, COPY_RESOURCE_LIST_WIN):QMAKE_POST_LIST += $$quote(xcopy /D /Y "$${COPY_DIR}" "$$TARGETDIR_WIN\\release" /E /I $$escape_expand(\\n))
379 380

		# Copy Qt DLLs
381 382 383 384 385 386 387 388 389
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I $$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\phonon4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtCore4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtGui4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtMultimedia4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtNetwork4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtOpenGL4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSql4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSvg4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
390
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtTestd4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
391 392 393
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
394 395
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtDeclarative4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtScript4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
396 397
		QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\$${TARGET}.exp"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\$${TARGET}"$$escape_expand(\\n))
398 399 400 401 402 403 404

		# Copy Visual Studio DLLs
		# Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed.
		# I'm not certain of the path for VS2008, so this only works for VS2010.
		win32-msvc2010 {
			QMAKE_POST_LINK += $$quote(xcopy /D /Y "\"C:\\Program Files \(x86\)\\Microsoft Visual Studio 10.0\\VC\\redist\\x86\\Microsoft.VC100.CRT\\*.dll\""  "$$TARGETDIR_WIN\\release\\"$$escape_expand(\\n))
		}
405
	}
406 407 408 409 410
}

# Windows (32bit)
win32-g++ {

411
	message(Building for Windows Platform (32bit))
412

413 414 415
	# Special settings for debug
	CONFIG += CONSOLE
	OUTPUT += CONSOLE
LM's avatar
LM committed
416

417 418 419
	# The EIGEN library needs this define
	# to make the internal min/max functions work
	DEFINES += NOMINMAX
420

421 422
	INCLUDEPATH += $$BASEDIR/libs/lib/sdl/include \
				$$BASEDIR/libs/lib/opal/include
423

424
	LIBS += -L$$BASEDIR/libs/lib/sdl/win32 \
425 426
			-lmingw32 -lSDLmain -lSDL -mwindows \
			-lsetupapi
427

428
	CONFIG += windows
429 430 431



432
	CONFIG(debug, debug|release) {
433 434
		CONFIG += console
	}
435

436
	CONFIG(release, debug|release) {
437 438 439
		CONFIG -= console
		DEFINES += QT_NO_DEBUG
	}
440

441 442 443 444 445 446 447
	RC_FILE = $$BASEDIR/qgroundcontrol.rc

	# Copy dependencies

	system(cp): {
		# CP command is available, use it instead of copy / xcopy
		message("Using cp to copy image and audio files to executable")
448
		CONFIG(debug, debug|release) {
449
			QMAKE_POST_LINK += && cp $$BASEDIR/libs/lib/sdl/win32/SDL.dll $$TARGETDIR/debug/SDL.dll
450
			QMAKE_POST_LINK += && cp -r $$BASEDIR/files $$TARGETDIR/debug/files
451
                        QMAKE_POST_LINK += && cp -r $$BASEDIR/libs/mavlink $$TARGETDIR/debug/mavlink
452 453 454
			QMAKE_POST_LINK += && cp -r $$BASEDIR/models $$TARGETDIR/debug/models
		}

455
		CONFIG(release, debug|release) {
456
			QMAKE_POST_LINK += && cp $$BASEDIR/libs/lib/sdl/win32/SDL.dll $$TARGETDIR/release/SDL.dll
457
			QMAKE_POST_LINK += && cp -r $$BASEDIR/files $$TARGETDIR/release/files
458
                        QMAKE_POST_LINK += && cp -r $$BASEDIR/libs/mavlink $$TARGETDIR/release/mavlink
459 460 461 462 463 464 465 466 467 468
			QMAKE_POST_LINK += && cp -r $$BASEDIR/models $$TARGETDIR/release/models
		}

	} else {
		# No cp command available, go for copy / xcopy
		# Copy dependencies
		BASEDIR_WIN = $$replace(BASEDIR,"/","\\")
		TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")

		exists($$TARGETDIR/debug) {
469
			QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\debug\\SDL.dll\"
470
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\files\" \"$$TARGETDIR_WIN\\debug\\files\\\" /S /E /Y
471 472
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\libs\\mavlink\" \"$$TARGETDIR_WIN\\debug\\mavlink\\\" /S /E /Y
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\debug\\models\\\" /S /E /Y
473 474 475
		}

		exists($$TARGETDIR/release) {
476
			QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\release\\SDL.dll\"
477
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\files\" \"$$TARGETDIR_WIN\\release\\files\\\" /S /E /Y
478
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\libs\\mavlink\" \"$$TARGETDIR_WIN\\release\\mavlink\\\" /S /E /Y
479 480
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\release\\models\\\" /S /E /Y
		}
481

482
	}
483

484 485 486
	# osg/osgEarth dynamic casts might fail without this compiler option.
	# see http://osgearth.org/wiki/FAQ for details.
	QMAKE_CXXFLAGS += -Wl,-E
487
}