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>
This commit is contained in:
parent
4e945ea2f8
commit
418494ecb6
@ -23,49 +23,4 @@ CONFIG = \
|
||||
unset(today)
|
||||
}
|
||||
|
||||
isEmpty(QMAKE_DEFAULT_INCDIRS):!host_build {
|
||||
#
|
||||
# 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"
|
||||
}
|
||||
output = $$system("$$cmd_prefix $$QMAKE_CXX $$QMAKE_CXXFLAGS -xc++ -E -v - 2>&1 $$cmd_suffix", lines)
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
!isEmpty(QMAKE_DEFAULT_INCDIRS): cache(QMAKE_DEFAULT_INCDIRS, set stash)
|
||||
!isEmpty(QMAKE_DEFAULT_LIBDIRS): cache(QMAKE_DEFAULT_LIBDIRS, set stash)
|
||||
}
|
||||
load(toolchain)
|
||||
|
@ -35,7 +35,3 @@ cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
|
||||
cache(QMAKE_XCODE_VERSION, stash)
|
||||
|
||||
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
|
||||
|
||||
# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
|
||||
# and friends that other features/extra compilers may depend on.
|
||||
sdk: load(sdk)
|
||||
|
@ -1,4 +1,4 @@
|
||||
CONFIG = asset_catalogs sdk rez $$CONFIG
|
||||
CONFIG = asset_catalogs rez $$CONFIG
|
||||
load(default_pre)
|
||||
|
||||
isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
|
||||
|
5
mkspecs/features/mac/toolchain.prf
Normal file
5
mkspecs/features/mac/toolchain.prf
Normal file
@ -0,0 +1,5 @@
|
||||
# Ensure that we process sdk.prf first, as it will update QMAKE_CXX,
|
||||
# which the default path determination uses.
|
||||
sdk: load(sdk)
|
||||
|
||||
load(toolchain)
|
47
mkspecs/features/toolchain.prf
Normal file
47
mkspecs/features/toolchain.prf
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
isEmpty(QMAKE_DEFAULT_INCDIRS):!host_build {
|
||||
#
|
||||
# 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"
|
||||
}
|
||||
output = $$system("$$cmd_prefix $$QMAKE_CXX $$QMAKE_CXXFLAGS -xc++ -E -v - 2>&1 $$cmd_suffix", lines)
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
!isEmpty(QMAKE_DEFAULT_INCDIRS): cache(QMAKE_DEFAULT_INCDIRS, set stash)
|
||||
!isEmpty(QMAKE_DEFAULT_LIBDIRS): cache(QMAKE_DEFAULT_LIBDIRS, set stash)
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
|
||||
load(default_pre)
|
||||
|
||||
!isEmpty(QT_VERSION) {
|
||||
qtConfig(simulator_and_device)|contains(QMAKE_MAC_SDK, ^$${device.sdk}.*): \
|
||||
CONFIG += device $${device.sdk}
|
||||
@ -17,6 +15,8 @@ load(default_pre)
|
||||
}
|
||||
}
|
||||
|
||||
load(default_pre)
|
||||
|
||||
# Check for supported Xcode versions
|
||||
lessThan(QMAKE_XCODE_VERSION, "4.3"): \
|
||||
error("This mkspec requires Xcode 4.3 or later")
|
||||
|
Loading…
Reference in New Issue
Block a user