2013-04-05 22:46:56 +02:00
|
|
|
|
defineReplace(cleanPath) {
|
|
|
|
|
win32:1 ~= s|\\\\|/|g
|
|
|
|
|
contains(1, ^/.*):pfx = /
|
|
|
|
|
else:pfx =
|
|
|
|
|
segs = $$split(1, /)
|
|
|
|
|
out =
|
|
|
|
|
for(seg, segs) {
|
|
|
|
|
equals(seg, ..):out = $$member(out, 0, -2)
|
|
|
|
|
else:!equals(seg, .):out += $$seg
|
|
|
|
|
}
|
|
|
|
|
return($$join(out, /, $$pfx))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineReplace(addNewline) {
|
|
|
|
|
return($$escape_expand(\\n\\t))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineReplace(qtLibraryName) {
|
|
|
|
|
unset(LIBRARY_NAME)
|
|
|
|
|
LIBRARY_NAME = $$1
|
|
|
|
|
CONFIG(debug, debug|release) {
|
|
|
|
|
!debug_and_release|build_pass {
|
|
|
|
|
mac:RET = $$member(LIBRARY_NAME, 0)_debug
|
|
|
|
|
else:win32:RET = $$member(LIBRARY_NAME, 0)d
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isEmpty(RET):RET = $$LIBRARY_NAME
|
|
|
|
|
return($$RET)
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-25 02:46:52 +01:00
|
|
|
|
defineTest(addCopyFileTarget) {
|
|
|
|
|
file = $$1
|
|
|
|
|
src = $$2/$$1
|
|
|
|
|
dest = $$3/$$1
|
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
target = $${file}
|
|
|
|
|
$${target}.target = $$dest
|
|
|
|
|
$${target}.depends = $$src
|
2015-03-25 02:46:52 +01:00
|
|
|
|
|
|
|
|
|
# create directory. Better would be an order only dependency
|
2017-06-24 16:11:29 +02:00
|
|
|
|
$${target}.commands = -@$(MKDIR) \"$$dirname(dest)\" $$addNewline()
|
|
|
|
|
$${target}.commands += $(COPY_FILE) \"$$src\" \"$$dest\"
|
2015-03-25 02:46:52 +01:00
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
QMAKE_EXTRA_TARGETS += $$target
|
|
|
|
|
POST_TARGETDEPS += $$eval($${target}.target)
|
2015-03-25 02:46:52 +01:00
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
export($${target}.target)
|
|
|
|
|
export($${target}.depends)
|
|
|
|
|
export($${target}.commands)
|
|
|
|
|
export(QMAKE_EXTRA_TARGETS)
|
|
|
|
|
export(POST_TARGETDEPS)
|
|
|
|
|
|
|
|
|
|
return(true)
|
|
|
|
|
}
|
2017-06-24 16:10:16 +02:00
|
|
|
|
|
|
|
|
|
defineTest(addCopyDependenciesTarget) {
|
|
|
|
|
file = $$1
|
|
|
|
|
src = $$2/$$1
|
|
|
|
|
dest = $$3
|
|
|
|
|
|
|
|
|
|
target_file = $${OUT_PWD}/deps/$${file}.deps
|
|
|
|
|
|
|
|
|
|
target = $${file}_deps
|
|
|
|
|
$${target}.target = $$target_file
|
|
|
|
|
$${target}.depends = $$src
|
|
|
|
|
|
|
|
|
|
$${target}.commands = -@$(MKDIR) \"$$dirname(target_file)\" $$addNewline()
|
|
|
|
|
$${target}.commands += $$(PYTHON) $$(ROOT_DIR)/make/copy_dependencies.py --dest \"$$dest\" --files \"$$src\" --excludes OPENGL32.DLL > \"$$target_file\"
|
|
|
|
|
|
|
|
|
|
QMAKE_EXTRA_TARGETS += $$target
|
|
|
|
|
POST_TARGETDEPS += $$eval($${target}.target)
|
|
|
|
|
|
|
|
|
|
export($${target}.target)
|
|
|
|
|
export($${target}.depends)
|
|
|
|
|
export($${target}.commands)
|
2015-03-25 02:46:52 +01:00
|
|
|
|
export(QMAKE_EXTRA_TARGETS)
|
|
|
|
|
export(POST_TARGETDEPS)
|
|
|
|
|
|
|
|
|
|
return(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineTest(addCopyDirTarget) {
|
|
|
|
|
dir = $$1
|
|
|
|
|
src = $$2/$$1
|
|
|
|
|
dest = $$3/$$1
|
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
target = $${dir}
|
|
|
|
|
$${target}.target = $$dest
|
|
|
|
|
$${target}.depends = $$src
|
2015-04-11 13:20:30 +02:00
|
|
|
|
# Windows does not update directory timestamp if files are modified
|
2017-06-24 16:11:29 +02:00
|
|
|
|
win32:$${target}depends += FORCE
|
2015-03-25 02:46:52 +01:00
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
$${target}.commands = @rm -rf \"$$dest\" $$addNewline()
|
2015-03-25 02:46:52 +01:00
|
|
|
|
# create directory. Better would be an order only dependency
|
2017-06-24 16:11:29 +02:00
|
|
|
|
$${target}.commands += -@$(MKDIR) \"$$dirname(dest)\" $$addNewline()
|
|
|
|
|
$${target}.commands += $(COPY_DIR) \"$$src\" \"$$dest\"
|
2015-03-25 02:46:52 +01:00
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
QMAKE_EXTRA_TARGETS += $$target
|
|
|
|
|
POST_TARGETDEPS += $$eval($${target}.target)
|
2015-03-25 02:46:52 +01:00
|
|
|
|
|
2017-06-24 16:11:29 +02:00
|
|
|
|
export($${target}.target)
|
|
|
|
|
export($${target}.depends)
|
|
|
|
|
export($${target}.commands)
|
2015-03-25 02:46:52 +01:00
|
|
|
|
export(QMAKE_EXTRA_TARGETS)
|
|
|
|
|
export(POST_TARGETDEPS)
|
|
|
|
|
|
|
|
|
|
return(true)
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-05 22:46:56 +02:00
|
|
|
|
# For use in custom compilers which just copy files
|
|
|
|
|
win32:i_flag = i
|
|
|
|
|
defineReplace(stripSrcDir) {
|
|
|
|
|
win32 {
|
|
|
|
|
!contains(1, ^.:.*):1 = $$OUT_PWD/$$1
|
|
|
|
|
} else {
|
|
|
|
|
!contains(1, ^/.*):1 = $$OUT_PWD/$$1
|
|
|
|
|
}
|
|
|
|
|
out = $$cleanPath($$1)
|
2013-09-15 21:53:28 +02:00
|
|
|
|
out ~= s|^$$re_escape($$_PRO_FILE_PWD_/)||$$i_flag
|
2013-04-05 22:46:56 +02:00
|
|
|
|
return($$out)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isEmpty(TEST):CONFIG(debug, debug|release) {
|
|
|
|
|
!debug_and_release|build_pass {
|
|
|
|
|
TEST = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
equals(TEST, 1) {
|
|
|
|
|
QT +=testlib
|
|
|
|
|
DEFINES += WITH_TESTS
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-23 01:24:50 +01:00
|
|
|
|
# don't build both debug and release
|
|
|
|
|
CONFIG -= debug_and_release
|
|
|
|
|
|
2013-04-05 22:46:56 +02:00
|
|
|
|
#ideally, we would want a qmake.conf patch, but this does the trick...
|
|
|
|
|
win32:!isEmpty(QMAKE_SH):QMAKE_COPY_DIR = cp -r -f
|
|
|
|
|
|
|
|
|
|
GCS_SOURCE_TREE = $$PWD
|
2015-02-23 01:32:50 +01:00
|
|
|
|
ROOT_DIR = $$GCS_SOURCE_TREE/../..
|
|
|
|
|
|
2013-04-05 22:46:56 +02:00
|
|
|
|
isEmpty(GCS_BUILD_TREE) {
|
|
|
|
|
sub_dir = $$_PRO_FILE_PWD_
|
|
|
|
|
sub_dir ~= s,^$$re_escape($$PWD),,
|
|
|
|
|
GCS_BUILD_TREE = $$cleanPath($$OUT_PWD)
|
|
|
|
|
GCS_BUILD_TREE ~= s,$$re_escape($$sub_dir)$,,
|
|
|
|
|
}
|
2014-09-08 11:29:44 +02:00
|
|
|
|
|
2014-09-13 06:37:30 +02:00
|
|
|
|
# Find the tools directory,
|
|
|
|
|
# try from Makefile (not run by Qt Creator),
|
2015-07-31 16:51:04 +02:00
|
|
|
|
isEmpty(TOOLS_DIR):TOOLS_DIR = $$(TOOLS_DIR)
|
|
|
|
|
isEmpty(TOOLS_DIR):TOOLS_DIR = $$clean_path($$ROOT_DIR/tools)
|
2014-09-08 11:29:44 +02:00
|
|
|
|
|
2015-05-17 12:20:32 +02:00
|
|
|
|
# Set the default name of the application
|
2015-07-12 19:24:05 +02:00
|
|
|
|
isEmpty(GCS_SMALL_NAME):GCS_SMALL_NAME = gcs
|
2015-05-17 12:20:32 +02:00
|
|
|
|
|
|
|
|
|
isEmpty(GCS_BIG_NAME) {
|
2015-07-12 19:24:05 +02:00
|
|
|
|
GCS_BIG_NAME = GCS
|
2015-05-17 12:20:32 +02:00
|
|
|
|
} else {
|
|
|
|
|
# Requote for safety and because of QTBUG-46224
|
|
|
|
|
GCS_BIG_NAME = "$$GCS_BIG_NAME"
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-12 18:23:18 +02:00
|
|
|
|
isEmpty(ORG_SMALL_NAME):ORG_SMALL_NAME = unknown
|
|
|
|
|
|
|
|
|
|
isEmpty(ORG_BIG_NAME) {
|
|
|
|
|
ORG_BIG_NAME = Unknown
|
|
|
|
|
} else {
|
|
|
|
|
# Requote for safety and because of QTBUG-46224
|
|
|
|
|
ORG_BIG_NAME = "$$ORG_BIG_NAME"
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-19 22:15:32 +02:00
|
|
|
|
isEmpty(WIKI_URL_ROOT) {
|
|
|
|
|
WIKI_URL_ROOT = Unknown
|
|
|
|
|
} else {
|
|
|
|
|
WIKI_URL_ROOT = "$$WIKI_URL_ROOT"
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-26 22:30:41 +02:00
|
|
|
|
isEmpty(GCS_LIBRARY_BASENAME):GCS_LIBRARY_BASENAME = lib
|
|
|
|
|
|
2013-04-05 22:46:56 +02:00
|
|
|
|
macx {
|
2015-05-17 12:20:32 +02:00
|
|
|
|
GCS_APP_TARGET = $$GCS_BIG_NAME
|
2015-05-08 10:43:32 +02:00
|
|
|
|
GCS_PATH = $$GCS_BUILD_TREE/$${GCS_APP_TARGET}.app/Contents
|
|
|
|
|
GCS_APP_PATH = $$GCS_PATH/MacOS
|
|
|
|
|
GCS_LIBRARY_PATH = $$GCS_PATH/Plugins
|
2013-04-05 22:46:56 +02:00
|
|
|
|
GCS_PLUGIN_PATH = $$GCS_LIBRARY_PATH
|
2015-05-08 10:43:32 +02:00
|
|
|
|
GCS_QT_QML_PATH = $$GCS_PATH/Imports
|
|
|
|
|
GCS_DATA_PATH = $$GCS_PATH/Resources
|
2013-04-05 22:46:56 +02:00
|
|
|
|
GCS_DOC_PATH = $$GCS_DATA_PATH/doc
|
|
|
|
|
copydata = 1
|
2014-07-06 08:55:54 +02:00
|
|
|
|
copyqt = 1
|
2013-04-05 22:46:56 +02:00
|
|
|
|
} else {
|
2015-05-17 12:20:32 +02:00
|
|
|
|
GCS_APP_TARGET = $$GCS_SMALL_NAME
|
2015-05-08 10:43:32 +02:00
|
|
|
|
GCS_PATH = $$GCS_BUILD_TREE
|
|
|
|
|
GCS_APP_PATH = $$GCS_PATH/bin
|
2015-07-26 22:30:41 +02:00
|
|
|
|
GCS_LIBRARY_PATH = $$GCS_PATH/$$GCS_LIBRARY_BASENAME/$$GCS_SMALL_NAME
|
2015-01-09 23:17:28 +01:00
|
|
|
|
GCS_PLUGIN_PATH = $$GCS_LIBRARY_PATH/plugins
|
2015-05-17 12:20:32 +02:00
|
|
|
|
GCS_DATA_PATH = $$GCS_PATH/share/$$GCS_SMALL_NAME
|
2015-05-08 10:43:32 +02:00
|
|
|
|
GCS_DOC_PATH = $$GCS_PATH/share/doc
|
2015-01-09 23:17:28 +01:00
|
|
|
|
|
2014-07-06 08:55:54 +02:00
|
|
|
|
!isEqual(GCS_SOURCE_TREE, $$GCS_BUILD_TREE):copydata = 1
|
2015-01-09 23:17:28 +01:00
|
|
|
|
|
2013-04-05 22:46:56 +02:00
|
|
|
|
win32 {
|
2015-03-25 02:46:52 +01:00
|
|
|
|
GCS_QT_PLUGINS_PATH = $$GCS_APP_PATH
|
2015-03-21 03:35:11 +01:00
|
|
|
|
GCS_QT_QML_PATH = $$GCS_APP_PATH
|
|
|
|
|
|
2014-07-06 08:55:54 +02:00
|
|
|
|
copyqt = $$copydata
|
2013-04-05 22:46:56 +02:00
|
|
|
|
} else {
|
2015-01-09 23:17:28 +01:00
|
|
|
|
GCS_QT_BASEPATH = $$GCS_LIBRARY_PATH/qt5
|
2015-01-09 22:53:07 +01:00
|
|
|
|
GCS_QT_LIBRARY_PATH = $$GCS_QT_BASEPATH/lib
|
|
|
|
|
GCS_QT_PLUGINS_PATH = $$GCS_QT_BASEPATH/plugins
|
|
|
|
|
GCS_QT_QML_PATH = $$GCS_QT_BASEPATH/qml
|
2014-08-23 04:18:12 +02:00
|
|
|
|
|
2014-08-27 22:56:27 +02:00
|
|
|
|
QT_INSTALL_DIR = $$clean_path($$[QT_INSTALL_LIBS]/../../../..)
|
|
|
|
|
equals(QT_INSTALL_DIR, $$TOOLS_DIR) {
|
2014-07-06 08:55:54 +02:00
|
|
|
|
copyqt = 1
|
2014-08-20 22:49:39 +02:00
|
|
|
|
} else {
|
2015-01-09 12:19:40 +01:00
|
|
|
|
copyqt = 0
|
2014-07-06 08:55:54 +02:00
|
|
|
|
}
|
2013-04-05 22:46:56 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
INCLUDEPATH += \
|
|
|
|
|
$$GCS_SOURCE_TREE/src/libs
|
|
|
|
|
|
|
|
|
|
DEPENDPATH += \
|
|
|
|
|
$$GCS_SOURCE_TREE/src/libs
|
|
|
|
|
|
|
|
|
|
LIBS += -L$$GCS_LIBRARY_PATH
|
|
|
|
|
|
2015-07-19 22:27:16 +02:00
|
|
|
|
DEFINES += ORG_BIG_NAME=$$shell_quote(\"$$ORG_BIG_NAME\")
|
|
|
|
|
DEFINES += GCS_BIG_NAME=$$shell_quote(\"$$GCS_BIG_NAME\")
|
|
|
|
|
DEFINES += ORG_SMALL_NAME=$$shell_quote(\"$$ORG_SMALL_NAME\")
|
|
|
|
|
DEFINES += GCS_SMALL_NAME=$$shell_quote(\"$$GCS_SMALL_NAME\")
|
2015-08-19 22:15:32 +02:00
|
|
|
|
DEFINES += WIKI_URL_ROOT=$$shell_quote(\"$$WIKI_URL_ROOT\")
|
2015-07-19 22:27:16 +02:00
|
|
|
|
|
2013-04-05 22:46:56 +02:00
|
|
|
|
# DEFINES += QT_NO_CAST_FROM_ASCII
|
|
|
|
|
DEFINES += QT_NO_CAST_TO_ASCII
|
|
|
|
|
#DEFINES += QT_USE_FAST_OPERATOR_PLUS
|
|
|
|
|
#DEFINES += QT_USE_FAST_CONCATENATION
|
|
|
|
|
|
|
|
|
|
unix {
|
|
|
|
|
CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
|
|
|
|
|
CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
|
|
|
|
|
|
|
|
|
|
CONFIG(debug, debug|release):MOC_DIR = $${OUT_PWD}/.moc/debug-shared
|
|
|
|
|
CONFIG(release, debug|release):MOC_DIR = $${OUT_PWD}/.moc/release-shared
|
|
|
|
|
|
|
|
|
|
RCC_DIR = $${OUT_PWD}/.rcc
|
|
|
|
|
UI_DIR = $${OUT_PWD}/.uic
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
linux-g++-* {
|
|
|
|
|
# Bail out on non-selfcontained libraries. Just a security measure
|
|
|
|
|
# to prevent checking in code that does not compile on other platforms.
|
|
|
|
|
QMAKE_LFLAGS += -Wl,--allow-shlib-undefined -Wl,--no-undefined
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-15 23:39:48 +02:00
|
|
|
|
win32 {
|
|
|
|
|
# Fix ((packed)) pragma handling issue introduced when upgrading MinGW from 4.4 to 4.8
|
|
|
|
|
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
|
|
|
|
|
# The ((packet)) pragma is used in uav metadata struct and other places
|
|
|
|
|
QMAKE_CXXFLAGS += -mno-ms-bitfields
|
|
|
|
|
}
|
2015-07-12 17:34:45 +02:00
|
|
|
|
|
2016-03-30 11:28:01 +02:00
|
|
|
|
# Explicit setting of C++11
|
2016-03-30 13:42:33 +02:00
|
|
|
|
CONFIG += c++11
|
2016-03-30 11:28:01 +02:00
|
|
|
|
|
2016-06-14 22:05:01 +02:00
|
|
|
|
address_sanitizer {
|
|
|
|
|
# enable asan by adding "address_sanitizer" to your root config file
|
|
|
|
|
# see https://github.com/google/sanitizers
|
|
|
|
|
# see https://blog.qt.io/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
|
|
|
|
|
#
|
|
|
|
|
# to use, simply compile and run, asan will crash with a report if an error is found.
|
|
|
|
|
# if you don't see symbols, try this: ./build/librepilot-gcs_debug/bin/librepilot-gcs 2>&1 | ./make/scripts/asan_symbolize.py
|
|
|
|
|
#
|
|
|
|
|
# Note: asan will apply only to GCS and not to third party libraries (Qt, osg, ...).
|
|
|
|
|
|
|
|
|
|
QMAKE_CXXFLAGS += -fsanitize=address -g -fno-omit-frame-pointer
|
|
|
|
|
QMAKE_CFLAGS += -fsanitize=address -g -fno-omit-frame-pointer
|
|
|
|
|
QMAKE_LFLAGS += -fsanitize=address -g
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-30 13:42:33 +02:00
|
|
|
|
# Stricter warnings turned on for OS X.
|
2015-07-12 17:34:45 +02:00
|
|
|
|
macx {
|
|
|
|
|
CONFIG += warn_on
|
|
|
|
|
!warn_off {
|
|
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Werror
|
|
|
|
|
QMAKE_CFLAGS_WARN_ON += -Werror
|
|
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-gnu-static-float-init
|
|
|
|
|
}
|
2015-12-02 23:16:05 +01:00
|
|
|
|
# building with libc++ is needed when linking with osg/gdal
|
|
|
|
|
QMAKE_CXXFLAGS += -stdlib=libc++
|
|
|
|
|
QMAKE_LFLAGS += -stdlib=libc++
|
2015-07-12 17:34:45 +02:00
|
|
|
|
}
|
2015-07-17 23:21:01 +02:00
|
|
|
|
|
|
|
|
|
# use ccache when available
|
|
|
|
|
QMAKE_CC = $$(CCACHE) $$QMAKE_CC
|
|
|
|
|
QMAKE_CXX = $$(CCACHE) $$QMAKE_CXX
|