2013-01-24 22:54:08 +00:00
|
|
|
#
|
|
|
|
# W A R N I N G
|
|
|
|
# -------------
|
|
|
|
#
|
|
|
|
# This file is not part of the Qt API. It exists purely as an
|
|
|
|
# implementation detail. It may change from version to version
|
|
|
|
# without notice, or even be removed.
|
|
|
|
#
|
|
|
|
# We mean it.
|
|
|
|
#
|
|
|
|
|
Rewrite qmake's exclusive-build feature
We used to compute the default exclusive build directory, eg 'debug', at
configure time, and then set OBJECTS_DIR, MOC_DIR, etc to include this
hard-coded default exclusive build directory. We then had to run a post-
process step where we replaced the 'debug' part with the current actual
exclusive build pass, eg 'release', resulting in long-standing bugs such
as QTBUG-491 where we end up replacing parts of the build output dirs
that were not part of the original exclusive build directory.
We now set the OBJECTS_DIR, MOC_DIR, etc defaults in configure like
before, but they do not include any exclusive-build information. The
exclusive build directory is handled as a separate step in default_post
where we adjust all entries in QMAKE_DIR_REPLACE to be exclusive
directories.
For backwards compatibility the new exclusive build behavior is only
enabled for variables named by QMAKE_DIR_REPLACE_SANE, which for Qt
itself applies globally to everything but DESTDIR, and for libs and
tools also applies to DESTDIR. The reason for leaving out DESTDIR in
the general case is because many tests and examples assume the old
behavior for DESTDIR. A side effect of including all the other
variables for Qt libs and tools is that the PCH output dir will be
uniformly set, which has been an issue on Windows in the past.
The addExclusiveBuilds function now takes two or more arguments,
each argument being the key for an exclusive build, which can be
customized eg. using $$key.{name,target,dir_affix}. Passing more
than two arguments results in three/four/etc-way exclusive builds,
eg debug/release/profile. Exclusive builds can also be combined, eg
static/shared + debug/release by making two calls to the function.
We also handle individual targets of combined exclusive builds,
eg static/shared + debug/release, meaning it is possible to run
'make debug' to build both static-debug and shared-debug.
Task-number: QTBUG-491
Change-Id: I02841dbbd065ac07d413dfb45cfcfe4c013674ac
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-10-08 17:41:16 +00:00
|
|
|
QMAKE_DIR_REPLACE_SANE += DESTDIR
|
|
|
|
CONFIG -= debug_and_release_target
|
|
|
|
|
2016-07-01 21:28:23 +00:00
|
|
|
DEFINES *= QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
|
|
|
|
2016-08-05 11:35:39 +00:00
|
|
|
qtConfig(c++11): CONFIG += c++11 strict_c++
|
|
|
|
qtConfig(c++14): CONFIG += c++14
|
|
|
|
qtConfig(c++1z): CONFIG += c++1z
|
2018-02-14 12:40:57 +00:00
|
|
|
qtConfig(c99): CONFIG += c99
|
|
|
|
qtConfig(c11): CONFIG += c11
|
2017-04-24 13:53:57 +00:00
|
|
|
qtConfig(stack-protector-strong): CONFIG += stack_protector_strong
|
2013-01-24 22:54:08 +00:00
|
|
|
contains(TEMPLATE, .*lib) {
|
|
|
|
# module and plugins
|
2017-01-19 20:54:41 +00:00
|
|
|
if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
|
2016-08-05 11:35:39 +00:00
|
|
|
unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions
|
|
|
|
qtConfig(separate_debug_info): CONFIG += separate_debug_info
|
2014-04-14 14:33:18 +00:00
|
|
|
|
|
|
|
!isEmpty(_QMAKE_SUPER_CACHE_): \
|
|
|
|
rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
|
|
|
|
else: \
|
|
|
|
rplbase = $$MODULE_BASE_OUTDIR
|
2014-11-28 13:00:07 +00:00
|
|
|
host_build {
|
|
|
|
qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
|
2014-04-14 15:32:23 +00:00
|
|
|
qt_libdir = $$[QT_HOST_LIBS]
|
2014-11-28 13:00:07 +00:00
|
|
|
} else {
|
|
|
|
qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
|
|
|
|
qt_libdir = $$[QT_INSTALL_LIBS]
|
|
|
|
}
|
2014-04-14 15:32:23 +00:00
|
|
|
contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
|
|
|
|
lib_replace.match = "[^ ']*$$rplbase/lib"
|
|
|
|
lib_replace.replace =
|
|
|
|
} else {
|
|
|
|
lib_replace.match = $$rplbase/lib
|
2014-11-28 13:00:07 +00:00
|
|
|
lib_replace.replace = $$qqt_libdir
|
2014-04-14 15:32:23 +00:00
|
|
|
}
|
2014-04-14 14:33:18 +00:00
|
|
|
lib_replace.CONFIG = path
|
|
|
|
QMAKE_PRL_INSTALL_REPLACE += lib_replace
|
2013-01-24 22:54:08 +00:00
|
|
|
}
|
2012-12-22 02:31:54 +00:00
|
|
|
|
2016-08-22 10:46:16 +00:00
|
|
|
# The remainder of this file must not apply to host tools/libraries,
|
2016-04-27 11:42:22 +00:00
|
|
|
# as the host compiler's version and capabilities are not checked.
|
2016-08-22 10:46:16 +00:00
|
|
|
host_build:cross_compile: return()
|
2016-04-27 11:42:22 +00:00
|
|
|
|
2015-03-07 17:09:11 +00:00
|
|
|
# Extra warnings for Qt non-example code, to ensure cleanliness of the sources.
|
|
|
|
# The block below may turn these warnings into errors for some Qt targets.
|
|
|
|
# -Wdate-time: warn if we use __DATE__ or __TIME__ (we want to be able to reproduce the exact same binary)
|
|
|
|
# -Wvla: use of variable-length arrays (an extension to C++)
|
|
|
|
clang {
|
2017-03-21 07:40:11 +00:00
|
|
|
clang_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
|
2018-02-01 18:35:25 +00:00
|
|
|
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
|
2017-03-21 07:40:11 +00:00
|
|
|
versionAtLeast(clang_ver, 3.5): \
|
2015-03-07 17:09:11 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Wdate-time
|
2017-09-22 07:42:38 +00:00
|
|
|
|
2018-02-01 18:35:25 +00:00
|
|
|
versionAtLeast(clang_ver, 3.6)|versionAtLeast(apple_ver, 6.3): \
|
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Winconsistent-missing-override
|
|
|
|
|
|
|
|
darwin {
|
2017-09-22 07:42:38 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON += \
|
2018-02-01 18:35:25 +00:00
|
|
|
-Wobjc-interface-ivars \
|
|
|
|
-Wobjc-method-access \
|
|
|
|
-Wobjc-multiple-method-names
|
|
|
|
|
|
|
|
# Clang/LLVM 5.0 and Xcode 9.0 introduced unguarded availability warnings.
|
|
|
|
# The same construct has been a hard error in Swift from the very beginning.
|
|
|
|
versionAtLeast(clang_ver, 5.0)|versionAtLeast(apple_ver, 9.0): \
|
|
|
|
QMAKE_CXXFLAGS_WARN_ON += \
|
|
|
|
-Werror=unguarded-availability \
|
|
|
|
-Werror=unguarded-availability-new \
|
|
|
|
-Werror=unsupported-availability-guard
|
|
|
|
}
|
2015-03-07 17:09:11 +00:00
|
|
|
} else: gcc:!intel_icc {
|
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Wvla
|
2018-06-15 13:11:11 +00:00
|
|
|
# GCC 5 fixed -Wmissing-field-initializers for when there are no initializers
|
|
|
|
lessThan(QT_GCC_MAJOR_VERSION, 5): QMAKE_CXXFLAGS_WARN_ON += -Wno-missing-field-initializers
|
2015-03-07 17:09:11 +00:00
|
|
|
# GCC 5 introduced -Wdate-time
|
|
|
|
greaterThan(QT_GCC_MAJOR_VERSION, 4): QMAKE_CXXFLAGS_WARN_ON += -Wdate-time
|
2016-05-08 04:59:01 +00:00
|
|
|
# GCC 6 introduced these
|
|
|
|
greaterThan(QT_GCC_MAJOR_VERSION, 5): QMAKE_CXXFLAGS_WARN_ON += -Wshift-overflow=2 -Wduplicated-cond
|
2017-06-03 06:29:11 +00:00
|
|
|
# GCC 7 has a lot of false positives relating to this, so disable completely
|
|
|
|
greaterThan(QT_GCC_MAJOR_VERSION, 6): QMAKE_CXXFLAGS_WARN_ON += -Wno-stringop-overflow
|
2015-03-07 17:09:11 +00:00
|
|
|
}
|
|
|
|
|
2012-12-22 02:31:54 +00:00
|
|
|
warnings_are_errors:warning_clean {
|
|
|
|
# If the module declares that it has does its clean-up of warnings, enable -Werror.
|
|
|
|
# This setting is compiler-dependent anyway because it depends on the version of the
|
|
|
|
# compiler.
|
2016-08-31 02:29:20 +00:00
|
|
|
clang {
|
2018-02-01 18:35:25 +00:00
|
|
|
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4,7.0-7.3,8.0-8.3,9.0-9.2
|
2018-04-28 00:54:27 +00:00
|
|
|
# Regular clang 3.x-6.0
|
2013-09-09 23:20:37 +00:00
|
|
|
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
|
|
|
|
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
|
2018-05-24 14:27:08 +00:00
|
|
|
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]|8\\.[0123]|9\\.[012]")|contains(reg_ver, "[345]\\.|6\\.0") {
|
2014-01-03 23:22:45 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
|
2012-12-22 02:31:54 +00:00
|
|
|
}
|
2013-08-19 22:30:56 +00:00
|
|
|
} else:intel_icc:linux {
|
2016-04-12 02:05:01 +00:00
|
|
|
# Intel CC 13.0 - 17.0, on Linux only
|
2013-08-19 22:30:56 +00:00
|
|
|
ver = $${QT_ICC_MAJOR_VERSION}.$${QT_ICC_MINOR_VERSION}
|
2016-04-12 02:05:01 +00:00
|
|
|
linux:contains(ver, "(1[3456]\\.|17\\.0)") {
|
2012-12-22 02:31:54 +00:00
|
|
|
# 177: function "entity" was declared but never referenced
|
|
|
|
# (too aggressive; ICC reports even for functions created due to template instantiation)
|
|
|
|
# 1224: #warning directive
|
2013-08-20 15:36:46 +00:00
|
|
|
# 1478: function "entity" (declared at line N) was declared deprecated
|
2012-12-22 02:31:54 +00:00
|
|
|
# 1881: argument must be a constant null pointer value
|
|
|
|
# (NULL in C++ is usually a literal 0)
|
2014-01-03 23:22:45 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Werror -ww177,1224,1478,1881 $$WERROR
|
2012-12-22 02:31:54 +00:00
|
|
|
}
|
2017-03-23 22:11:15 +00:00
|
|
|
} else:gcc:!clang:!intel_icc:!rim_qcc {
|
2016-03-05 00:50:54 +00:00
|
|
|
# GCC 4.6-4.9, 5.x, ...
|
2013-08-19 22:30:56 +00:00
|
|
|
ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION}
|
2016-03-05 00:50:54 +00:00
|
|
|
contains(ver, "(4\\.[6789]|[5-9]\\..)") {
|
2014-01-03 23:22:45 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=cpp -Wno-error=deprecated-declarations $$WERROR
|
2012-12-22 02:31:54 +00:00
|
|
|
|
|
|
|
# GCC prints this bogus warning, after it has inlined a lot of code
|
|
|
|
# error: assuming signed overflow does not occur when assuming that (X + c) < X is always false
|
2014-01-03 23:22:45 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-error=strict-overflow
|
2013-09-06 07:44:01 +00:00
|
|
|
|
2016-12-15 14:50:19 +00:00
|
|
|
# GCC 7 includes -Wimplicit-fallthrough in -Wextra, but Qt is not yet free of implicit fallthroughs.
|
|
|
|
greaterThan(QT_GCC_MAJOR_VERSION, 6): QMAKE_CXXFLAGS_WARN_ON += -Wno-error=implicit-fallthrough
|
|
|
|
|
2013-09-06 07:44:01 +00:00
|
|
|
# Work-around for bug https://code.google.com/p/android/issues/detail?id=58135
|
2014-01-03 23:22:45 +00:00
|
|
|
android: QMAKE_CXXFLAGS_WARN_ON += -Wno-error=literal-suffix
|
2012-12-22 02:31:54 +00:00
|
|
|
}
|
2016-06-16 23:52:08 +00:00
|
|
|
} else:msvc:!intel_icl {
|
|
|
|
# enable for MSVC 2012, MSVC 2013, MSVC 2015
|
|
|
|
contains(MSVC_VER, "1[124].0"): QMAKE_CXXFLAGS_WARN_ON += -WX
|
2012-12-22 02:31:54 +00:00
|
|
|
}
|
2013-08-19 22:30:56 +00:00
|
|
|
unset(ver)
|
2012-12-22 02:31:54 +00:00
|
|
|
}
|
2013-09-06 07:44:01 +00:00
|
|
|
|