LP-106 Setup Wizard refresh : Add dual servo setup (dual aileron or
[librepilot.git] / ground / gcs / gcs.pri
blobbbe138e0fe975c7c6fd500a9e1ddeb95dda34812
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(GCS_LIBRARY_BASENAME):GCS_LIBRARY_BASENAME = lib
145 macx {
146     GCS_APP_TARGET   = $$GCS_BIG_NAME
147     GCS_PATH = $$GCS_BUILD_TREE/$${GCS_APP_TARGET}.app/Contents
148     GCS_APP_PATH = $$GCS_PATH/MacOS
149     GCS_LIBRARY_PATH = $$GCS_PATH/Plugins
150     GCS_PLUGIN_PATH  = $$GCS_LIBRARY_PATH
151     GCS_QT_QML_PATH = $$GCS_PATH/Imports
152     GCS_DATA_PATH    = $$GCS_PATH/Resources
153     GCS_DOC_PATH     = $$GCS_DATA_PATH/doc
154     copydata = 1
155     copyqt = 1
156 } else {
157     GCS_APP_TARGET = $$GCS_SMALL_NAME
158     GCS_PATH         = $$GCS_BUILD_TREE
159     GCS_APP_PATH     = $$GCS_PATH/bin
160     GCS_LIBRARY_PATH = $$GCS_PATH/$$GCS_LIBRARY_BASENAME/$$GCS_SMALL_NAME
161     GCS_PLUGIN_PATH  = $$GCS_LIBRARY_PATH/plugins
162     GCS_DATA_PATH    = $$GCS_PATH/share/$$GCS_SMALL_NAME
163     GCS_DOC_PATH     = $$GCS_PATH/share/doc
165     !isEqual(GCS_SOURCE_TREE, $$GCS_BUILD_TREE):copydata = 1
167     win32 {
168         SDL_DIR = $$(SDL_DIR)
169         isEmpty(SDL_DIR):SDL_DIR = $${TOOLS_DIR}/SDL-1.2.15
171         OPENSSL_DIR = $$(OPENSSL_DIR)
172         isEmpty(OPENSSL_DIR):OPENSSL_DIR = $${TOOLS_DIR}/openssl-1.0.1e-win32
174         MESAWIN_DIR = $$(MESAWIN_DIR)
175         isEmpty(MESAWIN_DIR):MESAWIN_DIR = $${TOOLS_DIR}/mesawin
177         GCS_QT_PLUGINS_PATH = $$GCS_APP_PATH
178         GCS_QT_QML_PATH = $$GCS_APP_PATH
180         copyqt = $$copydata
181     } else {
182         GCS_QT_BASEPATH = $$GCS_LIBRARY_PATH/qt5
183         GCS_QT_LIBRARY_PATH = $$GCS_QT_BASEPATH/lib
184         GCS_QT_PLUGINS_PATH = $$GCS_QT_BASEPATH/plugins
185         GCS_QT_QML_PATH = $$GCS_QT_BASEPATH/qml
187         QT_INSTALL_DIR = $$clean_path($$[QT_INSTALL_LIBS]/../../../..)
188         equals(QT_INSTALL_DIR, $$TOOLS_DIR) {
189             copyqt = 1
190         } else {
191             copyqt = 0
192         }
193     }
197 INCLUDEPATH += \
198     $$GCS_SOURCE_TREE/src/libs
200 DEPENDPATH += \
201     $$GCS_SOURCE_TREE/src/libs
203 LIBS += -L$$GCS_LIBRARY_PATH
205 DEFINES += ORG_BIG_NAME=$$shell_quote(\"$$ORG_BIG_NAME\")
206 DEFINES += GCS_BIG_NAME=$$shell_quote(\"$$GCS_BIG_NAME\")
207 DEFINES += ORG_SMALL_NAME=$$shell_quote(\"$$ORG_SMALL_NAME\")
208 DEFINES += GCS_SMALL_NAME=$$shell_quote(\"$$GCS_SMALL_NAME\")
210 # DEFINES += QT_NO_CAST_FROM_ASCII
211 DEFINES += QT_NO_CAST_TO_ASCII
212 #DEFINES += QT_USE_FAST_OPERATOR_PLUS
213 #DEFINES += QT_USE_FAST_CONCATENATION
215 unix {
216     CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
217     CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
219     CONFIG(debug, debug|release):MOC_DIR = $${OUT_PWD}/.moc/debug-shared
220     CONFIG(release, debug|release):MOC_DIR = $${OUT_PWD}/.moc/release-shared
222     RCC_DIR = $${OUT_PWD}/.rcc
223     UI_DIR = $${OUT_PWD}/.uic
226 linux-g++-* {
227     # Bail out on non-selfcontained libraries. Just a security measure
228     # to prevent checking in code that does not compile on other platforms.
229     QMAKE_LFLAGS += -Wl,--allow-shlib-undefined -Wl,--no-undefined
232 win32 {
233     # Fix ((packed)) pragma handling issue introduced when upgrading MinGW from 4.4 to 4.8
234     # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
235     # The ((packet)) pragma is used in uav metadata struct and other places
236     QMAKE_CXXFLAGS += -mno-ms-bitfields
239 # Stricter warnigs turned on for OS X.
240 macx {
241     CONFIG += warn_on
242     !warn_off {
243         QMAKE_CXXFLAGS_WARN_ON += -Werror
244         QMAKE_CFLAGS_WARN_ON   += -Werror
245         QMAKE_CXXFLAGS_WARN_ON += -Wno-gnu-static-float-init
246     }
250 # use ccache when available
251 QMAKE_CC = $$(CCACHE) $$QMAKE_CC
252 QMAKE_CXX = $$(CCACHE) $$QMAKE_CXX