-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcommon.pri
76 lines (65 loc) · 2.96 KB
/
common.pri
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
# SPDX-FileCopyrightText: 2014-2019 Paul Colby <git@colby.id.au>
# SPDX-License-Identifier: GPL-3.0-or-later
VERSION = 0.6.1
SPECIAL_BUILD = Internal
TOPDIR = $$PWD
# Setup build number, where available.
isEmpty(VER_BUILD):VER_BUILD = $$(GITHUB_RUN_NUMBER)
isEmpty(VER_BUILD):VER_BUILD = 0
isEmpty(VER_PAT) {
# Qmake only automatically assigns VER_PAT on some platforms.
VER_PARTS = $$split(VERSION, .)
VER_PAT = $$member(VER_PARTS, 2)
}
win32:VERSION = $$VERSION"."$$VER_BUILD
# Validate the special build (for inclusion in TCX output).
!contains(SPECIAL_BUILD, ^(Internal|Alpha|Beta|Release)) {
error("SPECIAL_BUILD must be one of: Internal, Alpha, Beta, or Release")
}
# Disable automatic ASCII conversions (best practice for internationalization).
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
# Enable C++11 for older Qt versions (qmake does this by default for Qt 5.6+).
equals(QT_MAJOR_VERSION,5):lessThan(QT_MINOR_VERSION,6) {
CONFIG += c++11
}
# Enable all warnings for all targets.
CONFIG += warn_on
# Treat warnings as errors.
win32-msvc*:QMAKE_CXXFLAGS_WARN_ON += /WX
else: QMAKE_CXXFLAGS_WARN_ON += -Werror
# Neaten the output directories.
CONFIG(debug,debug|release) DESTDIR = debug
CONFIG(release,debug|release) DESTDIR = release
MOC_DIR = $$DESTDIR/tmp
OBJECTS_DIR = $$DESTDIR/tmp
RCC_DIR = $$DESTDIR/tmp
UI_DIR = $$DESTDIR/tmp
# Workaround a couple of known bugs with C++11 support for Qt with gcc on OSX.
macx-g++:contains(CONFIG, c++11) {
equals(QT_MAJOR_VERSION,5):equals(QT_MINOR_VERSION,2) {
# https://bugreports.qt.io/browse/QTBUG-28097
message(Setting OSX deployment target to 10.7 for for C++11 with $$QMAKE_CXX and $$QT_VERSION)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
message(Adding '-stdlib=libc++' flag for C++11 with $$QMAKE_CXX and $$QT_VERSION)
QMAKE_CXXFLAGS += -stdlib=libc++
}
# This is necessary for at least Qt 5.5 and 5.7 on OSX (with GCC). But not Qt 5.9.
equals(QT_MAJOR_VERSION,5):greaterThan(QT_MINOR_VERSION,4):lessThan(QT_MINOR_VERSION,8) {
message(Adding '-stdlib=libc++' flag for C++11 with $$QMAKE_CXX and $$QT_VERSION)
QMAKE_CXXFLAGS += -stdlib=libc++
}
}
# Workaround LLVM bug https://llvm.org/bugs/show_bug.cgi?id=26396 https://bugreports.qt.io/browse/QTBUG-52134
macx:equals(QT_MAJOR_VERSION,5):equals(QT_MINOR_VERSION,5) {
message(Adding '-Wno-return-stack-address' flag $$QT_VERSION)
QMAKE_CXXFLAGS_WARN_ON += -Wno-return-stack-address
}
# Disable deprecated-copy warnings for modern compilers with old Qt's.
*-clang:equals(QT_MAJOR_VERSION,5):lessThan(QT_MINOR_VERSION,15) {
message(Adding '-Wno-deprecated-copy-with-user-provided-copy' flag for $$QMAKE_CXX and $$QT_VERSION)
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy-with-user-provided-copy
}
*-g++:equals(QT_MAJOR_VERSION,5):lessThan(QT_MINOR_VERSION,13) {
message(Adding '-Wno-deprecated-copy' flag for $$QMAKE_CXX and $$QT_VERSION)
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy
}