1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# This file is a template commmon for all qmake projects.
#
# To use it, define ROOT_DIR variable and include($$ROOT_DIR/common.pri)
# our own version variables
VERSION_MAJOR = 2
VERSION_MINOR = 4
# qt's variable
VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}
# Additional include directories, common to most projects.
INCLUDEPATH *= $$ROOT_DIR/3party/boost
# hack for Qt5 qmake to make it faster
CONFIG -= depend_includepath
CONFIG *= c++11
# Automatically enable release config for production
CONFIG(production) {
CONFIG *= release
}
CONFIG(release, debug|release) {
DEFINES *= RELEASE _RELEASE NDEBUG
CONFIG(production) {
CONFIG_NAME = production
} else {
CONFIG_NAME = release
}
} else {
DEFINES *= DEBUG _DEBUG
CONFIG_NAME = debug
}
BINARIES_PATH = $$ROOT_DIR/out/$$CONFIG_NAME
TEMP_PATH = $$ROOT_DIR/out/$$CONFIG_NAME/tmp/$$TARGET
DESTDIR = $$BINARIES_PATH
OBJECTS_DIR = $$TEMP_PATH
RCC_DIR = $$TEMP_PATH
MOC_DIR = $$TEMP_PATH
UI_DIR = $$TEMP_PATH
QMAKE_LIBDIR *= $$BINARIES_PATH
# By default, do not include base QT classes in any project.
QT -= core gui
# Libraries' dependencies hack.
win32-msvc*|symbian {
LIB_EXT = .lib
LIB_PREFIX =
}
unix|win32-g++|tizen* {
LIB_EXT = .a
LIB_PREFIX = lib
}
# Add libraries' dependencies.
for(project, DEPENDENCIES) {
equals(project,expat):linux* {
} else {
PRE_TARGETDEPS += $$BINARIES_PATH/$$LIB_PREFIX$$project$$LIB_EXT
}
LIBS += -l$$project
}
#INCLUDEPATH += $$ROOT_DIR/3party/protobuf/src/
# Windows-specific options for all projects
win32 {
DEFINES += _WIN32_WINNT=0x0501
DEFINES += WINVER=0x0501
DEFINES += _WIN32_IE=0x0501
DEFINES += WIN32_LEAN_AND_MEAN=1
DEFINES += NTDDI_VERSION=0x05010000
}
win32-msvc* {
QMAKE_CLEAN += *.user
DEFINES += _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS NOMINMAX NO_MIN_MAX
QMAKE_CXXFLAGS += /Fd$${DESTDIR}/$${TARGET}.pdb /Zi /fp:fast
QMAKE_CFLAGS += /Fd$${DESTDIR}/$${TARGET}.pdb /Zi /fp:fast
QMAKE_CXXFLAGS_RELEASE -= /O2
# don't set -GL - bug in msvc2008
QMAKE_CXXFLAGS_RELEASE += /Ox /GF
# don't set /LTCG - bug in msvc2008
QMAKE_LFLAGS_RELEASE += /MACHINE:X86
QMAKE_LFLAGS *= /OPT:REF
QMAKE_LFLAGS_RELEASE *= /OPT:ICF
QMAKE_LFLAGS_DEBUG *= /OPT:NOICF
CONFIG(release, debug|release) {
DEFINES += _SECURE_SCL=0
}
}
win32-msvc201* {
# disable tr1 and c++0x features to avoid build errors
DEFINES += _HAS_CPP0X=0
DEFINES += BOOST_NO_CXX11_HDR_ARRAY BOOST_NO_CXX11_HDR_TYPEINDEX BOOST_NO_CXX11_SMART_PTR
QMAKE_CFLAGS_RELEASE += /GL
QMAKE_CXXFLAGS_RELEASE += /GL
QMAKE_LFLAGS_RELEASE += /LTCG
QMAKE_LIB += /LTCG
}
# unix also works for Android
unix|win32-g++ {
QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare -Wno-strict-aliasing -Wno-unused-parameter \
-Werror=return-type
*-clang {
QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-conversion
}
tizen{
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O1
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O1
QMAKE_CFLAGS_RELEASE *= -ffast-math
QMAKE_CXXFLAGS_RELEASE *= -ffast-math
} else {
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O3
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3
QMAKE_CFLAGS_RELEASE *= -ffast-math
QMAKE_CXXFLAGS_RELEASE *= -ffast-math
}
}
linux-g++* {
QMAKE_CFLAGS *= -fdata-sections -ffunction-sections
QMAKE_CXXFLAGS *= -fdata-sections -ffunction-sections
QMAKE_LFLAGS *= -Wl,--gc-sections -Wl,-Bsymbolic-functions
QMAKE_CFLAGS_RELEASE *= -ffloat-store
QMAKE_CXXFLAGS_RELEASE *= -ffloat-store
# debian build requirements
CONFIG(production) {
QMAKE_CFLAGS_RELEASE = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
QMAKE_CXXFLAGS_RELEASE = -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
QMAKE_LFLAGS *= -Wl,-z,relro
}
}
android-g++ {
QMAKE_CFLAGS *= -fdata-sections -ffunction-sections
QMAKE_CXXFLAGS *= -fdata-sections -ffunction-sections
QMAKE_LFLAGS *= -Wl,--gc-sections
}
win32-g++ {
QMAKE_CFLAGS *= -Wextra
QMAKE_CXXFLAGS *= -Wextra
QMAKE_LFLAGS *= -s
QMAKE_LFLAGS_RELEASE *= -O
}
macx-* {
# minimum supported Mac OS X version
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
QMAKE_CFLAGS *= -mmacosx-version-min=10.6
QMAKE_CXXFLAGS *= -mmacosx-version-min=10.6
# replace 10.5 with 10.6
QMAKE_CFLAGS_X86_64 -= -mmacosx-version-min=10.5
QMAKE_CXXFLAGS_X86_64 -= -mmacosx-version-min=10.5
QMAKE_CFLAGS_X86_64 += -mmacosx-version-min=10.6 # CXX is made based on CFLAGS
QMAKE_OBJECTIVE_CFLAGS_X86_64 -= -mmacosx-version-min=10.5
QMAKE_OBJECTIVE_CFLAGS_X86_64 += -mmacosx-version-min=10.6
QMAKE_LFLAGS_X86_64 -= -mmacosx-version-min=10.5
QMAKE_LFLAGS_X86_64 += -mmacosx-version-min=10.6
QMAKE_LFLAGS *= -dead_strip
# macx-clang {
# QMAKE_CFLAGS_RELEASE -= -O3
# QMAKE_CFLAGS_RELEASE += -O4 -flto
# QMAKE_CXXFLAGS_RELEASE -= -O3
# QMAKE_CXXFLAGS_RELEASE += -O4 -flto
# QMAKE_LFLAGS_RELEASE += -O4 -flto
# }
}
CONFIG(production) {
DEFINES += OMIM_PRODUCTION
} else {
# enable debugging information for non-production release builds
unix|win32-g++ {
QMAKE_CFLAGS_RELEASE += -g
QMAKE_CXXFLAGS_RELEASE += -g
} win32-msvc* {
QMAKE_LFLAGS += /PDB:$${DESTDIR}/$${TARGET}.pdb /DEBUG
}
}
# Fix boost compilation error
win32* {
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc.exe -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
} else {
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
}
|