Moved question mark to code & added missing define
[librepilot.git] / ground / gcs / gcs.pri
blob143b34daa8c5a6b14d716745bd0834e2267904c1
1 defineReplace(cleanPath) {
2     win32:1 ~= s|\\\\|/|g
3     contains(1, ^/.*):pfx = /
4     else:pfx =
5     segs = $$split(1, /)
6     out =
7     for(seg, segs) {
8         equals(seg, ..):out = $$member(out, 0, -2)
9         else:!equals(seg, .):out += $$seg
10     }
11     return($$join(out, /, $$pfx))
14 defineReplace(addNewline) { 
15     return($$escape_expand(\\n\\t))
18 defineReplace(qtLibraryName) {
19    unset(LIBRARY_NAME)
20    LIBRARY_NAME = $$1
21    CONFIG(debug, debug|release) {
22       !debug_and_release|build_pass {
23           mac:RET = $$member(LIBRARY_NAME, 0)_debug
24               else:win32:RET = $$member(LIBRARY_NAME, 0)d
25       }
26    }
27    isEmpty(RET):RET = $$LIBRARY_NAME
28    return($$RET)
31 defineTest(addCopyFileTarget) {
32     file = $$1
33     src  = $$2/$$1
34     dest = $$3/$$1
36     $${file}.target    = $$dest
37     $${file}.depends   = $$src
39     # create directory. Better would be an order only dependency
40     $${file}.commands  = -@$(MKDIR) \"$$dirname(dest)\" $$addNewline()
41     $${file}.commands += $(COPY_FILE) \"$$src\" \"$$dest\"
43     QMAKE_EXTRA_TARGETS += $$file
44     POST_TARGETDEPS += $$eval($${file}.target)
46     export($${file}.target)
47     export($${file}.depends)
48     export($${file}.commands)
49     export(QMAKE_EXTRA_TARGETS)
50     export(POST_TARGETDEPS)
52     return(true)
55 defineTest(addCopyDirTarget) {
56     dir  = $$1
57     src  = $$2/$$1
58     dest = $$3/$$1
60     $${dir}.target    = $$dest
61     $${dir}.depends   = $$src
62     # Windows does not update directory timestamp if files are modified
63     win32: $${dir}.depends += FORCE
65     $${dir}.commands  = @rm -rf \"$$dest\" $$addNewline()
66     # create directory. Better would be an order only dependency
67     $${dir}.commands += -@$(MKDIR) \"$$dirname(dest)\" $$addNewline()
68     $${dir}.commands += $(COPY_DIR) \"$$src\" \"$$dest\"
70     QMAKE_EXTRA_TARGETS += $$dir
71     POST_TARGETDEPS += $$eval($${dir}.target)
73     export($${dir}.target)
74     export($${dir}.depends)
75     export($${dir}.commands)
76     export(QMAKE_EXTRA_TARGETS)
77     export(POST_TARGETDEPS)
79     return(true)
82 # For use in custom compilers which just copy files
83 win32:i_flag = i
84 defineReplace(stripSrcDir) {
85     win32 {
86         !contains(1, ^.:.*):1 = $$OUT_PWD/$$1
87     } else {
88         !contains(1, ^/.*):1 = $$OUT_PWD/$$1
89     }
90     out = $$cleanPath($$1)
91     out ~= s|^$$re_escape($$_PRO_FILE_PWD_/)||$$i_flag
92     return($$out)
95 isEmpty(TEST):CONFIG(debug, debug|release) {
96     !debug_and_release|build_pass {
97         TEST = 1
98     }
101 equals(TEST, 1) {
102     QT +=testlib
103     DEFINES += WITH_TESTS
106 #ideally, we would want a qmake.conf patch, but this does the trick...
107 win32:!isEmpty(QMAKE_SH):QMAKE_COPY_DIR = cp -r -f
109 GCS_SOURCE_TREE = $$PWD
110 ROOT_DIR = $$GCS_SOURCE_TREE/../..
112 isEmpty(GCS_BUILD_TREE) {
113     sub_dir = $$_PRO_FILE_PWD_
114     sub_dir ~= s,^$$re_escape($$PWD),,
115     GCS_BUILD_TREE = $$cleanPath($$OUT_PWD)
116     GCS_BUILD_TREE ~= s,$$re_escape($$sub_dir)$,,
119 # Find the tools directory,
120 # try from Makefile (not run by Qt Creator),
121 isEmpty(TOOLS_DIR):TOOLS_DIR = $$(TOOLS_DIR)
122 isEmpty(TOOLS_DIR):TOOLS_DIR = $$clean_path($$ROOT_DIR/tools)
124 # Set the default name of the application
125 isEmpty(GCS_SMALL_NAME):GCS_SMALL_NAME = gcs
127 isEmpty(GCS_BIG_NAME) {
128     GCS_BIG_NAME = GCS
129 } else {
130     # Requote for safety and because of QTBUG-46224
131     GCS_BIG_NAME = "$$GCS_BIG_NAME"
134 isEmpty(ORG_SMALL_NAME):ORG_SMALL_NAME = unknown
136 isEmpty(ORG_BIG_NAME) {
137     ORG_BIG_NAME = Unknown
138 } else {
139     # Requote for safety and because of QTBUG-46224
140     ORG_BIG_NAME = "$$ORG_BIG_NAME"
143 isEmpty(WIKI_URL_ROOT) {
144     WIKI_URL_ROOT = Unknown
145 } else {
146     WIKI_URL_ROOT = "$$WIKI_URL_ROOT"
149 isEmpty(GCS_LIBRARY_BASENAME):GCS_LIBRARY_BASENAME = lib
151 macx {
152     GCS_APP_TARGET   = $$GCS_BIG_NAME
153     GCS_PATH = $$GCS_BUILD_TREE/$${GCS_APP_TARGET}.app/Contents
154     GCS_APP_PATH = $$GCS_PATH/MacOS
155     GCS_LIBRARY_PATH = $$GCS_PATH/Plugins
156     GCS_PLUGIN_PATH  = $$GCS_LIBRARY_PATH
157     GCS_QT_QML_PATH = $$GCS_PATH/Imports
158     GCS_DATA_PATH    = $$GCS_PATH/Resources
159     GCS_DOC_PATH     = $$GCS_DATA_PATH/doc
160     copydata = 1
161     copyqt = 1
162     copyosg = 1
163 } else {
164     GCS_APP_TARGET = $$GCS_SMALL_NAME
165     GCS_PATH         = $$GCS_BUILD_TREE
166     GCS_APP_PATH     = $$GCS_PATH/bin
167     GCS_LIBRARY_PATH = $$GCS_PATH/$$GCS_LIBRARY_BASENAME/$$GCS_SMALL_NAME
168     GCS_PLUGIN_PATH  = $$GCS_LIBRARY_PATH/plugins
169     GCS_DATA_PATH    = $$GCS_PATH/share/$$GCS_SMALL_NAME
170     GCS_DOC_PATH     = $$GCS_PATH/share/doc
172     !isEqual(GCS_SOURCE_TREE, $$GCS_BUILD_TREE):copydata = 1
174     win32 {
175         SDL_DIR = $$(SDL_DIR)
176         isEmpty(SDL_DIR):SDL_DIR = $${TOOLS_DIR}/SDL-1.2.15
178         OPENSSL_DIR = $$(OPENSSL_DIR)
179         isEmpty(OPENSSL_DIR):OPENSSL_DIR = $${TOOLS_DIR}/openssl-1.0.1e-win32
181         MESAWIN_DIR = $$(MESAWIN_DIR)
182         isEmpty(MESAWIN_DIR):MESAWIN_DIR = $${TOOLS_DIR}/mesawin
184         GCS_QT_PLUGINS_PATH = $$GCS_APP_PATH
185         GCS_QT_QML_PATH = $$GCS_APP_PATH
187         copyqt = $$copydata
188         copyosg = $$copydata
189     } else {
190         GCS_QT_BASEPATH = $$GCS_LIBRARY_PATH/qt5
191         GCS_QT_LIBRARY_PATH = $$GCS_QT_BASEPATH/lib
192         GCS_QT_PLUGINS_PATH = $$GCS_QT_BASEPATH/plugins
193         GCS_QT_QML_PATH = $$GCS_QT_BASEPATH/qml
195         QT_INSTALL_DIR = $$clean_path($$[QT_INSTALL_LIBS]/../../../..)
196         equals(QT_INSTALL_DIR, $$TOOLS_DIR) {
197             copyqt = 1
198         } else {
199             copyqt = 0
200         }
201         copyosg = 1
202     }
206 INCLUDEPATH += \
207     $$GCS_SOURCE_TREE/src/libs
209 DEPENDPATH += \
210     $$GCS_SOURCE_TREE/src/libs
212 LIBS += -L$$GCS_LIBRARY_PATH
214 DEFINES += ORG_BIG_NAME=$$shell_quote(\"$$ORG_BIG_NAME\")
215 DEFINES += GCS_BIG_NAME=$$shell_quote(\"$$GCS_BIG_NAME\")
216 DEFINES += ORG_SMALL_NAME=$$shell_quote(\"$$ORG_SMALL_NAME\")
217 DEFINES += GCS_SMALL_NAME=$$shell_quote(\"$$GCS_SMALL_NAME\")
218 DEFINES += WIKI_URL_ROOT=$$shell_quote(\"$$WIKI_URL_ROOT\")
220 # DEFINES += QT_NO_CAST_FROM_ASCII
221 DEFINES += QT_NO_CAST_TO_ASCII
222 #DEFINES += QT_USE_FAST_OPERATOR_PLUS
223 #DEFINES += QT_USE_FAST_CONCATENATION
225 unix {
226     CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
227     CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
229     CONFIG(debug, debug|release):MOC_DIR = $${OUT_PWD}/.moc/debug-shared
230     CONFIG(release, debug|release):MOC_DIR = $${OUT_PWD}/.moc/release-shared
232     RCC_DIR = $${OUT_PWD}/.rcc
233     UI_DIR = $${OUT_PWD}/.uic
236 linux-g++-* {
237     # Bail out on non-selfcontained libraries. Just a security measure
238     # to prevent checking in code that does not compile on other platforms.
239     QMAKE_LFLAGS += -Wl,--allow-shlib-undefined -Wl,--no-undefined
242 win32 {
243     # Fix ((packed)) pragma handling issue introduced when upgrading MinGW from 4.4 to 4.8
244     # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
245     # The ((packet)) pragma is used in uav metadata struct and other places
246     QMAKE_CXXFLAGS += -mno-ms-bitfields
249 # Stricter warnigs turned on for OS X.
250 macx {
251     CONFIG += warn_on
252     !warn_off {
253         QMAKE_CXXFLAGS_WARN_ON += -Werror
254         QMAKE_CFLAGS_WARN_ON   += -Werror
255         QMAKE_CXXFLAGS_WARN_ON += -Wno-gnu-static-float-init
256     }
260 # use ccache when available
261 QMAKE_CC = $$(CCACHE) $$QMAKE_CC
262 QMAKE_CXX = $$(CCACHE) $$QMAKE_CXX