-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcompiler_flags.pri
144 lines (131 loc) · 4.33 KB
/
compiler_flags.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
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
#
# Copyright (c) 2020, 219 Design, LLC
# See LICENSE.txt
#
# https://www.219design.com
# Software | Electrical | Mechanical | Product Design
#
linux:!android {
wants_clang {
QMAKE_CXX = clang++
QMAKE_LINK = clang++
QMAKE_CC = clang
} else {
greaterThan(QT_MAJOR_VERSION, 5) {
QMAKE_CXX = g++-9
QMAKE_LINK = g++-9
QMAKE_CC = gcc-9
} else {
QMAKE_CXX = g++-7
QMAKE_LINK = g++-7
QMAKE_CC = gcc-7
}
}
}
CONFIG += c++17
ios|macx {
# the lines below suppress warnings generated by Qt's header files: we tell
# Clang to treat Qt's (mac) Framework headers as "system headers":
QMAKE_CXXFLAGS += -iframework $$[QT_INSTALL_LIBS]
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_LIBS]/QtCore.framework/Headers
}
!win32 {
# the lines below suppress warnings generated by Qt's header files: we tell
# GCC/Clang to treat Qt's headers as "system headers" with the -isystem flag
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtConcurrent
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtCore
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtGui
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtHelp
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQml
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQmlDebug
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQmlModels
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQuick
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQuickControls2
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtQuickWidgets
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtTest
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtWidgets
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtXml
lessThan(QT_MAJOR_VERSION, 6) {
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]/QtFontDatabaseSupport
}
unix:!android {
# So the exe will launch if we put all our '*.so' dylibs side-by-side with it.
# Based on https://stackoverflow.com/a/27393241/10278
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
}
linux:!android {
!wants_clang {
QMAKE_CXXFLAGS += "\
-Wduplicated-branches \
-Wduplicated-cond \
-Wlogical-op \
-Wmisleading-indentation \
-Wrestrict \
-Wunused-but-set-parameter \
"
}
}
!android {
QMAKE_CXXFLAGS += "\
-Werror \
"
}
# some inspired by: https://kristerw.blogspot.com/2017/09/useful-gcc-warning-options-not-enabled.html
# others inspired by: https://stackoverflow.com/questions/5088460/flags-to-enable-thorough-and-verbose-g-warnings
QMAKE_CXXFLAGS += "\
-Wall \
-Wcast-align \
-Wcast-qual \
-Wconversion \
-Wdisabled-optimization \
-Werror=switch \
-Wextra \
-Wfloat-equal \
-Wformat-nonliteral \
-Wformat-security \
-Wformat=2 \
-Wimport \
-Winit-self \
-Winline \
-Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-format-attribute \
-Wmissing-include-dirs \
-Wmissing-noreturn \
-Wnon-virtual-dtor \
-Wnull-dereference \
-Wold-style-cast \
-Wpedantic \
-Wpointer-arith \
-Wredundant-decls \
-Wshadow \
-Wstack-protector \
-Wswitch-default \
-Wswitch-enum \
-Wundef \
-Wuninitialized \
-Wunreachable-code \
-Wunused \
-Wunused-parameter \
-Wvariadic-macros \
-Wwrite-strings \
"
# Do the 'no-' flags in their own statement, to ensure that they always happen last:
QMAKE_CXXFLAGS += "\
-Wno-error=format-nonliteral \
-Wno-error=inline \
-Wno-error=unknown-pragmas \
"
# Rationale for 'Wno-error=format-nonliteral': we trigger this in rc/minutil/logger.cc (TODO: eventually suppress this ONLY for that cc file)
# Rationale for 'Wno-error=inline' is that a failure to inline is information, and never truly 'wrong'
}
ios|macx {
# Disable a couple that are more onerous to comply with on Mac
QMAKE_CXXFLAGS += "\
-Wno-error=missing-noreturn \
-Wno-error=sign-conversion \
-Wno-unknown-pragmas \
"
}
!include($$top_srcdir/src/assert/assert.pri) { error() } # allows all code to include util-assert.h