2012-12-11 21:22:23 +00:00
|
|
|
# This file is loaded by qmake right after loading the actual project file.
|
|
|
|
|
2012-04-10 12:18:20 +00:00
|
|
|
contains(TEMPLATE, ".*(lib|app)"):CONFIG += have_target
|
|
|
|
|
2012-04-03 17:27:55 +00:00
|
|
|
!have_target:!force_qt: CONFIG -= qt
|
|
|
|
|
2013-02-15 17:15:18 +00:00
|
|
|
load(resolve_config)
|
2012-05-30 10:09:00 +00:00
|
|
|
|
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
|
|
|
exclusive_builds: load(exclusive_builds_post)
|
|
|
|
|
2013-10-07 15:55:45 +00:00
|
|
|
# If the TARGET looks like a path, split it into DESTDIR and the resulting TARGET
|
|
|
|
target_dir_part = $$dirname(TARGET)
|
|
|
|
!isEmpty(target_dir_part) {
|
|
|
|
isEmpty(DESTDIR): \
|
|
|
|
DESTDIR = $$target_dir_part
|
|
|
|
else: \
|
|
|
|
DESTDIR = $$DESTDIR/$$target_dir_part
|
|
|
|
|
|
|
|
TARGET = $$basename(TARGET)
|
|
|
|
DESTDIR = $$clean_path($$DESTDIR)
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH)
|
|
|
|
!isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ...
|
2013-02-15 17:15:22 +00:00
|
|
|
!static:release:have_target: \ # is it applicable?
|
2011-04-27 10:05:43 +00:00
|
|
|
!contains(TARGET, .*phony_target.*): \ # monster hack, you don't really see this here, right? ;)
|
|
|
|
system($$QT_BREAKPAD_ROOT_PATH/qtbreakpadsymbols --breakpad-exists) { # do we really have it?
|
2012-08-07 20:22:38 +00:00
|
|
|
CONFIG += breakpad force_debug_info
|
2011-04-27 10:05:43 +00:00
|
|
|
CONFIG -= no_debug_info separate_debug_info
|
2012-08-07 20:22:38 +00:00
|
|
|
}
|
|
|
|
|
2013-11-18 20:39:08 +00:00
|
|
|
force_debug_info|debug: \
|
|
|
|
CONFIG += debug_info
|
|
|
|
|
2012-08-07 20:22:38 +00:00
|
|
|
force_debug_info {
|
2011-04-27 10:05:43 +00:00
|
|
|
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
|
|
|
|
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
|
|
|
|
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
|
|
|
|
}
|
|
|
|
|
2017-04-07 13:49:10 +00:00
|
|
|
optimize_size {
|
|
|
|
!isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_SIZE) {
|
|
|
|
QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE
|
|
|
|
QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE
|
|
|
|
QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_SIZE
|
|
|
|
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_SIZE
|
|
|
|
}
|
|
|
|
} else: optimize_full {
|
2014-02-14 12:57:35 +00:00
|
|
|
!isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_FULL) {
|
|
|
|
QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE
|
|
|
|
QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE
|
|
|
|
QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL
|
|
|
|
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-17 14:01:59 +00:00
|
|
|
optimize_debug {
|
|
|
|
QMAKE_CFLAGS_DEBUG += $$QMAKE_CFLAGS_OPTIMIZE_DEBUG
|
|
|
|
QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_OPTIMIZE_DEBUG
|
|
|
|
}
|
|
|
|
|
2013-02-15 17:15:18 +00:00
|
|
|
debug {
|
|
|
|
QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG
|
|
|
|
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
|
|
|
|
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
|
|
|
|
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
|
|
|
|
} else {
|
|
|
|
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
|
|
|
|
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
|
|
|
|
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
|
|
|
|
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
|
|
|
|
}
|
|
|
|
|
2017-04-24 13:53:57 +00:00
|
|
|
stack_protector_strong {
|
|
|
|
QMAKE_CFLAGS += $$QMAKE_CFLAGS_STACK_PROTECTOR_STRONG
|
|
|
|
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_STACK_PROTECTOR_STRONG
|
|
|
|
}
|
|
|
|
|
2015-05-19 19:30:21 +00:00
|
|
|
# disable special linker flags for host builds (no proper test for host support yet)
|
2017-01-19 20:54:41 +00:00
|
|
|
!host_build|!cross_compile {
|
2015-05-19 19:30:21 +00:00
|
|
|
use_gold_linker: QMAKE_LFLAGS += $$QMAKE_LFLAGS_USE_GOLD
|
|
|
|
enable_new_dtags: QMAKE_LFLAGS += $$QMAKE_LFLAGS_NEW_DTAGS
|
|
|
|
}
|
2014-07-01 09:46:50 +00:00
|
|
|
|
2013-02-15 17:15:18 +00:00
|
|
|
dll:win32: QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL
|
|
|
|
static:mac: QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB
|
|
|
|
staticlib:unix {
|
|
|
|
QMAKE_CFLAGS += $$QMAKE_CFLAGS_STATIC_LIB
|
|
|
|
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
incredibuild_xge {
|
|
|
|
CONFIG -= incredibuild_xge
|
|
|
|
CONFIG = incredibuild_xge $$CONFIG
|
|
|
|
}
|
|
|
|
|
2013-03-14 14:51:37 +00:00
|
|
|
silent {
|
|
|
|
# Ensure that we process silent.prf last, as it will mangle QMAKE_CXX
|
|
|
|
# and friends in a way that some of the other features (sdk.prf and
|
|
|
|
# simd.prf eg) do not handle.
|
|
|
|
CONFIG -= silent
|
|
|
|
CONFIG = silent $$CONFIG
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:22:38 +00:00
|
|
|
breakpad {
|
|
|
|
load(resolve_target)
|
2014-04-29 18:15:21 +00:00
|
|
|
DEBUGFILENAME = $$shell_quote($$system_path($$QMAKE_RESOLVED_TARGET))
|
|
|
|
PROJECTPATH = $$shell_quote($$system_path($$OUT_PWD))
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)
|
2012-07-12 09:16:53 +00:00
|
|
|
QMAKE_POST_LINK = $$QMAKE_POST_LINK$$quote($${QT_BREAKPAD_ROOT_PATH}$${QMAKE_DIR_SEP}qtbreakpadsymbols $$DEBUGFILENAME $$PROJECTPATH)
|
|
|
|
!isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME)
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2017-03-04 17:33:35 +00:00
|
|
|
!c++11:!c++14:!c++1z {
|
|
|
|
# Qt requires C++11 since 5.7, check if we need to force a compiler option
|
|
|
|
QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
|
|
|
|
!greaterThan(QT_COMPILER_STDCXX_no_L, 199711): CONFIG += c++11
|
|
|
|
}
|
2015-07-09 00:21:30 +00:00
|
|
|
c++11|c++14|c++1z {
|
2016-03-10 15:39:05 +00:00
|
|
|
# Disable special compiler flags for host builds
|
|
|
|
!host_build|!cross_compile {
|
|
|
|
c++1z: cxxstd = CXX1Z
|
|
|
|
else: c++14: cxxstd = CXX14
|
|
|
|
else: cxxstd = CXX11
|
|
|
|
} else {
|
|
|
|
# Fall back to c++11, because since 5.7 c++11 is required everywhere,
|
|
|
|
# including host builds
|
|
|
|
cxxstd = CXX11
|
|
|
|
}
|
2015-07-09 00:21:30 +00:00
|
|
|
|
2017-05-03 20:07:18 +00:00
|
|
|
# Check if we should disable compiler extensions or not
|
|
|
|
isEmpty(QMAKE_CXXFLAGS_GNU$$cxxstd) {
|
|
|
|
strict_c++: QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STRICTCXX
|
|
|
|
} else {
|
|
|
|
!strict_c++: cxxstd = GNU$$cxxstd
|
|
|
|
}
|
2015-07-09 00:21:30 +00:00
|
|
|
|
|
|
|
QMAKE_CXXFLAGS += $$eval(QMAKE_CXXFLAGS_$$cxxstd)
|
|
|
|
QMAKE_LFLAGS += $$eval(QMAKE_LFLAGS_$$cxxstd)
|
|
|
|
|
|
|
|
unset(cxxstd)
|
|
|
|
}
|
|
|
|
|
2017-01-30 08:13:59 +00:00
|
|
|
utf8_source {
|
|
|
|
QMAKE_CFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE
|
|
|
|
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE
|
|
|
|
}
|
|
|
|
|
2014-01-06 15:41:53 +00:00
|
|
|
!precompile_header: SOURCES += $$NO_PCH_SOURCES
|