qgroundcontrol.pri 24.9 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
# MAC OS X
Lorenz Meier's avatar
Lorenz Meier committed
32
macx|macx-g++42|macx-g++|macx-llvm: {
33

34 35
        CONFIG += x86_64 cocoa phonon
        CONFIG -= x86
36 37 38

	QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6

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

Lorenz Meier's avatar
Lorenz Meier committed
41
        LIBS += -framework IOKit \
42
                -F$$BASEDIR/libs/lib/Frameworks \
Lorenz Meier's avatar
Lorenz Meier committed
43 44 45 46
                -framework SDL \
                -framework CoreFoundation \
                -framework ApplicationServices \
                -lm
47

48
	ICON = $$BASEDIR/files/images/icons/macx.icns
49 50

	# Copy contributed files
Don Gagne's avatar
Don Gagne committed
51
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/$${TARGET}.app/Contents/MacOS
52
	# Copy google earth starter file
Don Gagne's avatar
Don Gagne committed
53
        QMAKE_POST_LINK += && cp -f $$BASEDIR/files/images/earth.html $$TARGETDIR/$${TARGET}.app/Contents/MacOS
54
	# Copy CSS stylesheets
Don Gagne's avatar
Don Gagne committed
55 56
        QMAKE_POST_LINK += && cp -f $$BASEDIR/files/styles/style-dark.css $$TARGETDIR/$${TARGET}.app/Contents/MacOS/style-dark.css
        QMAKE_POST_LINK += && cp -f $$BASEDIR/files/styles/style-light.css $$TARGETDIR/$${TARGET}.app/Contents/MacOS/style-light.css
57
        # Copy support files
Don Gagne's avatar
Don Gagne committed
58
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/$${TARGET}.app/Contents/MacOS
59
        # Copy MAVLink
Don Gagne's avatar
Don Gagne committed
60
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/libs/mavlink $$TARGETDIR/$${TARGET}.app/Contents/MacOS
61
	# Copy libraries
Don Gagne's avatar
Don Gagne committed
62 63
        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
64
        # Copy frameworks
Don Gagne's avatar
Don Gagne committed
65 66
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/Frameworks
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/libs/lib/Frameworks/* $$TARGETDIR/$${TARGET}.app/Contents/Frameworks
67

Lorenz Meier's avatar
Lorenz Meier committed
68 69
        # Copy QML stuff
        message(BASEDIR $$BASEDIR)
Don Gagne's avatar
Don Gagne committed
70 71
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/qml/*.qml $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml
72

Don Gagne's avatar
Don Gagne committed
73 74
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml/components/
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/qml/components/*.qml $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml/components
75

Don Gagne's avatar
Don Gagne committed
76 77 78 79
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml/resources
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml/resources/qgroundcontrol
        QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml/resources/qgroundcontrol/toolbar
        QMAKE_POST_LINK += && cp -rf $$BASEDIR/qml/resources/qgroundcontrol/toolbar/*.png $$TARGETDIR/$${TARGET}.app/Contents/MacOS/qml/resources/qgroundcontrol/toolbar
80 81


82
	# Fix library paths inside executable
Don Gagne's avatar
Don Gagne committed
83 84 85 86 87 88 89
        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}
90 91 92 93

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

	# OSG GA LIBRARY
Don Gagne's avatar
Don Gagne committed
94 95 96 97 98
        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
99 100

	# OSG DB LIBRARY
Don Gagne's avatar
Don Gagne committed
101 102 103 104
        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
105 106

	# OSG TEXT LIBRARY
Don Gagne's avatar
Don Gagne committed
107 108 109 110 111
        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
112 113

	# OSG UTIL LIBRARY
Don Gagne's avatar
Don Gagne committed
114 115
        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
116 117 118


	# OSG VIEWER LIBRARY
Don Gagne's avatar
Don Gagne committed
119 120 121 122 123 124
        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
125 126

	# OSG WIDGET LIBRARY
Don Gagne's avatar
Don Gagne committed
127 128 129 130 131 132 133
        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
134 135

	# CORE OSG LIBRARY
Don Gagne's avatar
Don Gagne committed
136
        QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/$${TARGET}.app/Contents/libs/libosg.dylib
137

138
        # SDL Framework
Don Gagne's avatar
Don Gagne committed
139
        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}
140

141 142 143 144 145 146 147
	# 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 \
148
        $$BASEDIR/libs/lib/mac64/include
149 150 151

	LIBS += -framework GLUT \
        -framework Cocoa \
152
        -L$$BASEDIR/libs/lib/mac64/lib \
153
        -L$$BASEDIR/libs/lib/mac32/lib \
154 155 156 157 158 159 160 161
        -lOpenThreads \
        -losg \
        -losgViewer \
        -losgGA \
        -losgDB \
        -losgText \
        -losgWidget

162 163 164 165 166 167 168 169 170 171 172
        #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
173

174 175 176 177 178 179 180
	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
	}
181 182 183
}

# GNU/Linux
184
linux-g++|linux-g++-64{
185

186
	CONFIG -= console
James Goppert's avatar
James Goppert committed
187
	DEFINES += __STDC_LIMIT_MACROS
188 189 190 191 192 193 194

	release {
		DEFINES += QT_NO_DEBUG
	}

	INCLUDEPATH += /usr/include \
        /usr/local/include \
Geoff Fink's avatar
Geoff Fink committed
195 196
        /usr/include/qt4/phonon \
	/usr/include/phonon
197 198 199 200 201 202 203 204 205 206

	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
207 208
		-lSDLmain \
		-lasound
209 210 211 212 213 214

	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
215 216 217 218 219 220
            -losgViewer \
            -losgGA \
            -losgDB \
            -losgText \
            -lOpenThreads

221 222 223 224 225 226 227 228 229 230 231
		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
	}

232 233
	exists(/usr/local/include/google/protobuf) |
	exists(/usr/include/google/protobuf) {
234 235 236 237
		message("Building support for Protocol Buffers")
		DEPENDENCIES_PRESENT += protobuf
		# Include Protocol Buffers libraries
		LIBS += -lprotobuf \
238 239 240
            -lprotobuf-lite \
            -lprotoc

241 242 243
		DEFINES += QGC_PROTOBUF_ENABLED
	}

Geoff Fink's avatar
Geoff Fink committed
244 245
	exists(/usr/local/include/libfreenect/libfreenect.h) |
	exists(/usr/include/libfreenect/libfreenect.h) {
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
		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
	QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR
	QMAKE_POST_LINK += && cp -rf $$BASEDIR/data $$TARGETDIR
261
	QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/files/images
262
	QMAKE_POST_LINK += && cp -rf $$BASEDIR/files/styles/Vera.ttf $$TARGETDIR/files/styles/Vera.ttf
263 264 265 266

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

269
linux-g++ {
270
	message("Building for GNU/Linux 32bit/i386")
271
}
272
linux-g++-64 {
273 274
	message("Building for GNU/Linux 64bit/x64 (g++-64)")
	exists(/usr/local/lib64) {
Geoff Fink's avatar
Geoff Fink committed
275
		LIBS += -L/usr/local/lib64 -L/usr/lib64
276
	}
277 278
}

279
# Windows (32bit), Visual Studio
280
win32-msvc2008|win32-msvc2010|win32-msvc2012 {
281

282 283 284 285 286 287
	win32-msvc2008 {
		message(Building for Windows Visual Studio 2008 (32bit))
	}
	win32-msvc2010 {
		message(Building for Windows Visual Studio 2010 (32bit))
	}
288 289 290 291 292
	
	# Specify multi-process compilation within Visual Studio.
	# (drastically improves compilation times for multi-core computers)
	QMAKE_CXXFLAGS_DEBUG += -MP
	QMAKE_CXXFLAGS_RELEASE += -MP
293

294 295 296
	# QAxContainer support is needed for the Internet Control
	# element showing the Google Earth window
	CONFIG += qaxcontainer
297

298 299 300
	# The EIGEN library needs this define
	# to make the internal min/max functions work
	DEFINES += NOMINMAX
301

302 303
	# QWebkit is not needed on MS-Windows compilation environment
	CONFIG -= webkit
Bryant's avatar
Bryant committed
304 305 306
	
	# Specify the inclusion of (U)INT*_(MAX/MIN) macros within Visual Studio
	DEFINES += __STDC_LIMIT_MACROS
lm's avatar
lm committed
307

308 309 310 311
	# For release builds remove support for various Qt debugging macros.
	CONFIG(release, debug|release) {
		DEFINES += QT_NO_DEBUG
	}
312

313 314
	# For debug releases we just want the debugging console.
	CONFIG(debug, debug|release) {
315 316
		CONFIG += console
	}
317

318 319
	INCLUDEPATH += $$BASEDIR/libs/lib/sdl/msvc/include \
        $$BASEDIR/libs/lib/opal/include \
320 321
        $$BASEDIR/libs/lib/msinttypes \
        $$(QTDIR)/src/activeqt/shared
322

323
	LIBS += -L$$BASEDIR/libs/lib/sdl/msvc/lib \
324 325 326
        -lSDLmain -lSDL \
        -lsetupapi

327
	exists($$BASEDIR/libs/lib/osg123) {
328 329 330 331
		message("Building support for OSG")
		DEPENDENCIES_PRESENT += osg

		# Include OpenSceneGraph
332 333 334
		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 \
335 336 337 338 339 340 341 342
			-losg \
			-losgViewer \
			-losgGA \
			-losgDB \
			-losgText \
			-lOpenThreads
		DEFINES += QGC_OSG_ENABLED
	}
343

344
	RC_FILE = $$BASEDIR/qgroundcontrol.rc
345

346 347 348
	# Copy dependencies
	BASEDIR_WIN = $$replace(BASEDIR,"/","\\")
	TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")
349

350
	CONFIG(debug, debug|release) {
351
		# Copy supporting library DLLs
352
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
353
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\mavlink" "$$TARGETDIR_WIN\\debug\\mavlink" /E /I $$escape_expand(\\n))
354 355
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))

356 357 358
		# Copy application resources
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\debug\\files" /E /I $$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /E /I $$escape_expand(\\n))
359
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\qml" "$$TARGETDIR_WIN\\debug\\qml" /E /I $$escape_expand(\\n))
360 361

		# Copy Qt DLLs
362 363 364 365 366 367 368 369 370
		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))
371
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtTestd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
372 373 374
		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))
375 376
		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))
377
	}
378

379
	CONFIG(release, debug|release) {
380 381 382 383 384
	
		# 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

385
		# Copy supporting library DLLs
386
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
387 388 389 390
		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
391
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\release\\files" /E /I $$escape_expand(\\n))
392
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\release\\models" /E /I $$escape_expand(\\n))
393
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\qml" "$$TARGETDIR_WIN\\release\\qml" /E /I $$escape_expand(\\n))
394 395

		# Copy Qt DLLs
396 397 398 399 400 401 402 403 404
		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))
405
		QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtTestd4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
406 407 408
		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))
409 410
		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))
411 412
		QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.exp"$$escape_expand(\\n))
		QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.lib"$$escape_expand(\\n))
413 414 415 416 417 418 419

		# 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))
		}
420
	}
421 422 423 424 425
}

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

426
	message(Building for Windows Platform (32bit))
427

428 429 430
	# Special settings for debug
	CONFIG += CONSOLE
	OUTPUT += CONSOLE
LM's avatar
LM committed
431

432 433 434
	# The EIGEN library needs this define
	# to make the internal min/max functions work
	DEFINES += NOMINMAX
435

436 437
	INCLUDEPATH += $$BASEDIR/libs/lib/sdl/include \
				$$BASEDIR/libs/lib/opal/include
438

439
	LIBS += -L$$BASEDIR/libs/lib/sdl/win32 \
440 441
			-lmingw32 -lSDLmain -lSDL -mwindows \
			-lsetupapi
442

443
	CONFIG += windows
444 445 446



447 448 449
	debug {
		CONFIG += console
	}
450

451 452 453 454
	release {
		CONFIG -= console
		DEFINES += QT_NO_DEBUG
	}
455

456 457 458 459 460 461 462 463
	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")
		debug {
464
			QMAKE_POST_LINK += && cp $$BASEDIR/libs/lib/sdl/win32/SDL.dll $$TARGETDIR/debug/SDL.dll
465
			QMAKE_POST_LINK += && cp -r $$BASEDIR/files $$TARGETDIR/debug/files
466
                        QMAKE_POST_LINK += && cp -r $$BASEDIR/libs/mavlink $$TARGETDIR/debug/mavlink
467 468 469 470
			QMAKE_POST_LINK += && cp -r $$BASEDIR/models $$TARGETDIR/debug/models
		}

		release {
471
			QMAKE_POST_LINK += && cp $$BASEDIR/libs/lib/sdl/win32/SDL.dll $$TARGETDIR/release/SDL.dll
472
			QMAKE_POST_LINK += && cp -r $$BASEDIR/files $$TARGETDIR/release/files
473
                        QMAKE_POST_LINK += && cp -r $$BASEDIR/libs/mavlink $$TARGETDIR/release/mavlink
474 475 476 477 478 479 480 481 482 483
			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) {
484
			QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\debug\\SDL.dll\"
485
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\files\" \"$$TARGETDIR_WIN\\debug\\files\\\" /S /E /Y
486 487
			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
488 489 490
		}

		exists($$TARGETDIR/release) {
491
			QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\libs\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\release\\SDL.dll\"
492
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\files\" \"$$TARGETDIR_WIN\\release\\files\\\" /S /E /Y
493
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\libs\\mavlink\" \"$$TARGETDIR_WIN\\release\\mavlink\\\" /S /E /Y
494 495
			QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\release\\models\\\" /S /E /Y
		}
496

497
	}
498

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