fix QMAKE_DEFAULT_*DIRS resolution with apple SDK, take 2
the code got factored out to an own toolchain.prf file, which is
load()ed from default_pre.prf, so no change at first.
however, on mac, we shadow toolchain.prf, and make it load() sdk.prf
first.
a side effect, it has become harder to disable the use of an sdk
altogether: putting CONFIG-=sdk into a project file or the qmake
command line has no effect now. instead, it's possible to put it into
.qmake.{conf,cache}.
to make it simpler again, it's conceivable to finally add qmake -pre,
which would allow setting variables before default_pre.prf is executed.
take 2: there was nothing wrong with the original patch, but in 5.8,
CONFIG+=simulator_and_device moved from qconfig.pri to various prf files
that would do it according to the simulator_and_device configure
feature, which would be way too late for the "pulled ahead" sdk.prf
loading. as simulator_and_device is now gone entirely, it is safe to
re-apply this patch (mostly) as-is.
Task-number: QTBUG-56144
Change-Id: I6cf484982eaed8af39f7a539c60f5a087a299914
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-14 11:14:13 +00:00
|
|
|
|
2016-11-24 17:41:57 +00:00
|
|
|
# In early configure setup; nothing useful to be done here.
|
|
|
|
isEmpty(QMAKE_CXX): return()
|
|
|
|
|
2016-10-17 19:18:57 +00:00
|
|
|
defineReplace(qtMakeExpand) {
|
|
|
|
out = "$$1"
|
|
|
|
for(ever) {
|
2016-10-20 08:10:25 +00:00
|
|
|
m = $$replace(out, ".*\\$\\(EXPORT_([^)]+)\\).*", \\1)
|
2016-10-17 19:18:57 +00:00
|
|
|
equals(m, $$out): \
|
|
|
|
return($$out)
|
2016-10-20 08:10:25 +00:00
|
|
|
out = $$replace(out, "\\$\\(EXPORT_$$m\\)", $$eval($$m))
|
2016-10-17 19:18:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-12 19:58:45 +00:00
|
|
|
cross_compile:host_build: \
|
determine QMAKE_DEFAULT_{INC,LIB}DIRS separately for host and target
note that in principle this leaves room for a race condition, as the
first project to determine the host config is not going to be the
top-level one.
in qtbase and qtdeclarative, this is naturally serialized via the common
bootstrapped libraries (bootstrap resp. qmldevtools). activeqt, qt3d,
qtscxml, and qtwayland all build only one bootstrapped tool each.
qtwebengine makes a fake host build to create files for gyp/gn; the
convert_dict tool is declared a host tool, but isn't actually built when
x-building anyway, and even if, it's serialized on the former. qttools
needs explicit serialization, though. no other host builds exist within
qt as of now.
Task-number: QTBUG-58126
Change-Id: I81a02a2d98f2bfe5d6aaa51119d5e7919549f119
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-12 19:52:51 +00:00
|
|
|
target_prefix = QMAKE_HOST_CXX
|
|
|
|
else: \
|
|
|
|
target_prefix = QMAKE_CXX
|
|
|
|
|
|
|
|
isEmpty($${target_prefix}.INCDIRS) {
|
fix QMAKE_DEFAULT_*DIRS resolution with apple SDK, take 2
the code got factored out to an own toolchain.prf file, which is
load()ed from default_pre.prf, so no change at first.
however, on mac, we shadow toolchain.prf, and make it load() sdk.prf
first.
a side effect, it has become harder to disable the use of an sdk
altogether: putting CONFIG-=sdk into a project file or the qmake
command line has no effect now. instead, it's possible to put it into
.qmake.{conf,cache}.
to make it simpler again, it's conceivable to finally add qmake -pre,
which would allow setting variables before default_pre.prf is executed.
take 2: there was nothing wrong with the original patch, but in 5.8,
CONFIG+=simulator_and_device moved from qconfig.pri to various prf files
that would do it according to the simulator_and_device configure
feature, which would be way too late for the "pulled ahead" sdk.prf
loading. as simulator_and_device is now gone entirely, it is safe to
re-apply this patch (mostly) as-is.
Task-number: QTBUG-56144
Change-Id: I6cf484982eaed8af39f7a539c60f5a087a299914
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-14 11:14:13 +00:00
|
|
|
#
|
|
|
|
# Get default include and library paths from compiler
|
|
|
|
#
|
|
|
|
gcc {
|
|
|
|
!equals(QMAKE_HOST.os, Windows) {
|
|
|
|
cmd_prefix = "LC_ALL=C"
|
|
|
|
cmd_suffix = "</dev/null >/dev/null"
|
|
|
|
} else {
|
|
|
|
cmd_prefix = "set LC_ALL=C&"
|
|
|
|
cmd_suffix = "<NUL >NUL"
|
|
|
|
}
|
2017-01-26 02:52:22 +00:00
|
|
|
|
|
|
|
cxx_flags = $$QMAKE_CXXFLAGS
|
|
|
|
|
|
|
|
# Manually inject the sysroot for Apple Platforms because its resolution
|
|
|
|
# normally does not happen until default_post.prf. This is especially
|
|
|
|
# important for moc to gain the correct default include directory list.
|
|
|
|
# While technically incorrect but without any likely practical effect,
|
|
|
|
# UIKit simulator platforms will see the device SDK's sysroot in
|
|
|
|
# QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass.
|
|
|
|
darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH
|
|
|
|
|
|
|
|
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ -E -v - 2>&1 $$cmd_suffix", lines)
|
fix QMAKE_DEFAULT_*DIRS resolution with apple SDK, take 2
the code got factored out to an own toolchain.prf file, which is
load()ed from default_pre.prf, so no change at first.
however, on mac, we shadow toolchain.prf, and make it load() sdk.prf
first.
a side effect, it has become harder to disable the use of an sdk
altogether: putting CONFIG-=sdk into a project file or the qmake
command line has no effect now. instead, it's possible to put it into
.qmake.{conf,cache}.
to make it simpler again, it's conceivable to finally add qmake -pre,
which would allow setting variables before default_pre.prf is executed.
take 2: there was nothing wrong with the original patch, but in 5.8,
CONFIG+=simulator_and_device moved from qconfig.pri to various prf files
that would do it according to the simulator_and_device configure
feature, which would be way too late for the "pulled ahead" sdk.prf
loading. as simulator_and_device is now gone entirely, it is safe to
re-apply this patch (mostly) as-is.
Task-number: QTBUG-56144
Change-Id: I6cf484982eaed8af39f7a539c60f5a087a299914
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-14 11:14:13 +00:00
|
|
|
add_includes = false
|
|
|
|
for (line, output) {
|
|
|
|
line ~= s/^ *// # remove leading spaces
|
|
|
|
contains(line, "LIBRARY_PATH=.*") {
|
|
|
|
line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH=
|
|
|
|
paths = $$split(line, $$QMAKE_DIRLIST_SEP)
|
|
|
|
for (path, paths): \
|
|
|
|
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path)
|
|
|
|
} else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
|
|
|
|
add_includes = true
|
|
|
|
} else: contains(line, "End of search.*") {
|
|
|
|
add_includes = false
|
|
|
|
} else: $$add_includes {
|
|
|
|
!contains(line, ".* \\(framework directory\\)"): \
|
|
|
|
QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS)
|
|
|
|
} else: msvc {
|
determine QMAKE_DEFAULT_{INC,LIB}DIRS separately for host and target
note that in principle this leaves room for a race condition, as the
first project to determine the host config is not going to be the
top-level one.
in qtbase and qtdeclarative, this is naturally serialized via the common
bootstrapped libraries (bootstrap resp. qmldevtools). activeqt, qt3d,
qtscxml, and qtwayland all build only one bootstrapped tool each.
qtwebengine makes a fake host build to create files for gyp/gn; the
convert_dict tool is declared a host tool, but isn't actually built when
x-building anyway, and even if, it's serialized on the former. qttools
needs explicit serialization, though. no other host builds exist within
qt as of now.
Task-number: QTBUG-58126
Change-Id: I81a02a2d98f2bfe5d6aaa51119d5e7919549f119
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-12 19:52:51 +00:00
|
|
|
# This doesn't differentiate between host and target,
|
|
|
|
# but neither do the compilers.
|
fix QMAKE_DEFAULT_*DIRS resolution with apple SDK, take 2
the code got factored out to an own toolchain.prf file, which is
load()ed from default_pre.prf, so no change at first.
however, on mac, we shadow toolchain.prf, and make it load() sdk.prf
first.
a side effect, it has become harder to disable the use of an sdk
altogether: putting CONFIG-=sdk into a project file or the qmake
command line has no effect now. instead, it's possible to put it into
.qmake.{conf,cache}.
to make it simpler again, it's conceivable to finally add qmake -pre,
which would allow setting variables before default_pre.prf is executed.
take 2: there was nothing wrong with the original patch, but in 5.8,
CONFIG+=simulator_and_device moved from qconfig.pri to various prf files
that would do it according to the simulator_and_device configure
feature, which would be way too late for the "pulled ahead" sdk.prf
loading. as simulator_and_device is now gone entirely, it is safe to
re-apply this patch (mostly) as-is.
Task-number: QTBUG-56144
Change-Id: I6cf484982eaed8af39f7a539c60f5a087a299914
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-14 11:14:13 +00:00
|
|
|
LIB = $$getenv("LIB")
|
|
|
|
QMAKE_DEFAULT_LIBDIRS = $$split(LIB, $$QMAKE_DIRLIST_SEP)
|
|
|
|
INCLUDE = $$getenv("INCLUDE")
|
|
|
|
QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP)
|
|
|
|
}
|
|
|
|
|
|
|
|
unix {
|
|
|
|
isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include
|
|
|
|
isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib
|
|
|
|
}
|
|
|
|
|
determine QMAKE_DEFAULT_{INC,LIB}DIRS separately for host and target
note that in principle this leaves room for a race condition, as the
first project to determine the host config is not going to be the
top-level one.
in qtbase and qtdeclarative, this is naturally serialized via the common
bootstrapped libraries (bootstrap resp. qmldevtools). activeqt, qt3d,
qtscxml, and qtwayland all build only one bootstrapped tool each.
qtwebengine makes a fake host build to create files for gyp/gn; the
convert_dict tool is declared a host tool, but isn't actually built when
x-building anyway, and even if, it's serialized on the former. qttools
needs explicit serialization, though. no other host builds exist within
qt as of now.
Task-number: QTBUG-58126
Change-Id: I81a02a2d98f2bfe5d6aaa51119d5e7919549f119
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-12 19:52:51 +00:00
|
|
|
cache($${target_prefix}.INCDIRS, set stash, QMAKE_DEFAULT_INCDIRS)
|
|
|
|
cache($${target_prefix}.LIBDIRS, set stash, QMAKE_DEFAULT_LIBDIRS)
|
|
|
|
} else {
|
|
|
|
QMAKE_DEFAULT_INCDIRS = $$eval($${target_prefix}.INCDIRS)
|
|
|
|
QMAKE_DEFAULT_LIBDIRS = $$eval($${target_prefix}.LIBDIRS)
|
fix QMAKE_DEFAULT_*DIRS resolution with apple SDK, take 2
the code got factored out to an own toolchain.prf file, which is
load()ed from default_pre.prf, so no change at first.
however, on mac, we shadow toolchain.prf, and make it load() sdk.prf
first.
a side effect, it has become harder to disable the use of an sdk
altogether: putting CONFIG-=sdk into a project file or the qmake
command line has no effect now. instead, it's possible to put it into
.qmake.{conf,cache}.
to make it simpler again, it's conceivable to finally add qmake -pre,
which would allow setting variables before default_pre.prf is executed.
take 2: there was nothing wrong with the original patch, but in 5.8,
CONFIG+=simulator_and_device moved from qconfig.pri to various prf files
that would do it according to the simulator_and_device configure
feature, which would be way too late for the "pulled ahead" sdk.prf
loading. as simulator_and_device is now gone entirely, it is safe to
re-apply this patch (mostly) as-is.
Task-number: QTBUG-56144
Change-Id: I6cf484982eaed8af39f7a539c60f5a087a299914
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-14 11:14:13 +00:00
|
|
|
}
|
2016-12-15 15:20:27 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Determine and cache the compiler version
|
|
|
|
#
|
|
|
|
|
|
|
|
defineReplace(qtVariablesFromMSVC) {
|
|
|
|
return($$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines))
|
|
|
|
}
|
|
|
|
|
|
|
|
defineReplace(qtVariablesFromGCC) {
|
|
|
|
null_device = /dev/null
|
|
|
|
equals(QMAKE_HOST.os, Windows): null_device = NUL
|
|
|
|
return($$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$null_device 2>$$null_device", lines))
|
|
|
|
}
|
|
|
|
|
|
|
|
isEmpty($${target_prefix}.COMPILER_MACROS) {
|
|
|
|
msvc {
|
2016-11-16 13:10:29 +00:00
|
|
|
clang_cl {
|
|
|
|
# We need to obtain the cl.exe version first
|
|
|
|
vars = $$qtVariablesFromMSVC(cl)
|
|
|
|
for (v, vars) {
|
|
|
|
isEmpty(v)|contains(v, $${LITERAL_HASH}.*): next()
|
|
|
|
eval($$v)
|
|
|
|
}
|
|
|
|
isEmpty(QMAKE_MSC_FULL_VER): error("Could not determine the Visual Studio version")
|
|
|
|
|
|
|
|
QMAKE_CFLAGS_MSVC_COMPAT = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", \
|
|
|
|
"-fms-compatibility-version=\\1.\\2.\\3")
|
|
|
|
cache($${target_prefix}.QMAKE_CFLAGS_MSVC_COMPAT, set stash, QMAKE_CFLAGS_MSVC_COMPAT)
|
|
|
|
$${target_prefix}.COMPILER_MACROS += QMAKE_CFLAGS_MSVC_COMPAT
|
|
|
|
vars = $$qtVariablesFromMSVC($$QMAKE_CXX, $$QMAKE_CFLAGS_MSVC_COMPAT)
|
|
|
|
} else {
|
|
|
|
vars = $$qtVariablesFromMSVC($$QMAKE_CXX)
|
|
|
|
}
|
2016-12-15 15:20:27 +00:00
|
|
|
} else: gcc {
|
|
|
|
vars = $$qtVariablesFromGCC($$QMAKE_CXX)
|
|
|
|
}
|
|
|
|
for (v, vars) {
|
|
|
|
isEmpty(v)|contains(v, $${LITERAL_HASH}.*): next()
|
|
|
|
# Set both <varname> for the outer scope ...
|
|
|
|
eval($$v)
|
|
|
|
v ~= s/ .*//
|
|
|
|
isEmpty($$v): error("Compiler produced empty value for $${v}.")
|
|
|
|
# ... and save QMAKE_(HOST_)?CXX.<varname> in the cache.
|
|
|
|
cache($${target_prefix}.$$v, set stash, $$v)
|
|
|
|
$${target_prefix}.COMPILER_MACROS += $$v
|
|
|
|
}
|
|
|
|
cache($${target_prefix}.COMPILER_MACROS, set stash)
|
|
|
|
} else {
|
|
|
|
# load from the cache
|
|
|
|
for (i, $${target_prefix}.COMPILER_MACROS): \
|
|
|
|
$$i = $$eval($${target_prefix}.$$i)
|
|
|
|
}
|
|
|
|
|
|
|
|
unset(target_prefix)
|
|
|
|
|
|
|
|
# Populate QMAKE_COMPILER_DEFINES and some compatibility variables.
|
|
|
|
# The $$format_number() calls strip leading zeros to avoid misinterpretation as octal.
|
2017-03-04 17:33:35 +00:00
|
|
|
QMAKE_COMPILER_DEFINES += __cplusplus=$$QT_COMPILER_STDCXX
|
2016-12-15 15:20:27 +00:00
|
|
|
!isEmpty(QMAKE_MSC_VER) {
|
|
|
|
QMAKE_COMPILER_DEFINES += _MSC_VER=$$QMAKE_MSC_VER _MSC_FULL_VER=$$QMAKE_MSC_FULL_VER
|
|
|
|
QT_MSVC_MAJOR_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\1")
|
|
|
|
QT_MSVC_MINOR_VERSION = $$format_number($$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\2"))
|
|
|
|
QT_MSVC_PATCH_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\3"))
|
|
|
|
}
|
|
|
|
!isEmpty(QMAKE_ICC_VER) {
|
|
|
|
QMAKE_COMPILER_DEFINES += __INTEL_COMPILER=$$QMAKE_ICC_VER __INTEL_COMPILER_UPDATE=$$QMAKE_ICC_UPDATE_VER
|
|
|
|
QT_ICC_MAJOR_VERSION = $$replace(QMAKE_ICC_VER, "(..)(..)", "\\1")
|
|
|
|
QT_ICC_MINOR_VERSION = $$format_number($$replace(QMAKE_ICC_VER, "(..)(..)", "\\2"))
|
|
|
|
QT_ICC_PATCH_VERSION = $$QMAKE_ICC_UPDATE_VER
|
|
|
|
}
|
|
|
|
!isEmpty(QMAKE_APPLE_CC): \
|
|
|
|
QMAKE_COMPILER_DEFINES += __APPLE_CC__=$$QMAKE_APPLE_CC
|
|
|
|
!isEmpty(QT_APPLE_CLANG_MAJOR_VERSION): \
|
|
|
|
QMAKE_COMPILER_DEFINES += __clang__ \
|
|
|
|
__clang_major__=$$QT_APPLE_CLANG_MAJOR_VERSION \
|
|
|
|
__clang_minor__=$$QT_APPLE_CLANG_MINOR_VERSION \
|
|
|
|
__clang_patchlevel__=$$QT_APPLE_CLANG_PATCH_VERSION
|
|
|
|
!isEmpty(QT_CLANG_MAJOR_VERSION): \
|
|
|
|
QMAKE_COMPILER_DEFINES += __clang__ \
|
|
|
|
__clang_major__=$$QT_CLANG_MAJOR_VERSION \
|
|
|
|
__clang_minor__=$$QT_CLANG_MINOR_VERSION \
|
|
|
|
__clang_patchlevel__=$$QT_CLANG_PATCH_VERSION
|
|
|
|
!isEmpty(QT_GCC_MAJOR_VERSION): \
|
|
|
|
QMAKE_COMPILER_DEFINES += \
|
|
|
|
__GNUC__=$$QT_GCC_MAJOR_VERSION \
|
|
|
|
__GNUC_MINOR__=$$QT_GCC_MINOR_VERSION \
|
|
|
|
__GNUC_PATCHLEVEL__=$$QT_GCC_PATCH_VERSION
|
2016-11-16 13:10:29 +00:00
|
|
|
|
|
|
|
QMAKE_CFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT
|
|
|
|
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT
|
2017-01-17 16:10:21 +00:00
|
|
|
|
|
|
|
msvc:!intel_icl:!clang_cl: include(../common/msvc-version.conf)
|