Add query of default include/library paths for QNX

Change-Id: Iafc5a573a2ddb277d2a786cb6b48521985defe44
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
James McDonnell 2017-06-06 15:34:56 -04:00
parent 6dd61b4e62
commit b2ec7317c8

View File

@ -25,9 +25,11 @@ isEmpty($${target_prefix}.INCDIRS) {
!equals(QMAKE_HOST.os, Windows) {
cmd_prefix = "LC_ALL=C"
cmd_suffix = "</dev/null >/dev/null"
null_file = /dev/null
} else {
cmd_prefix = "set LC_ALL=C&"
cmd_suffix = "<NUL >NUL"
null_file = NUL
}
cxx_flags = $$QMAKE_CXXFLAGS
@ -40,7 +42,10 @@ isEmpty($${target_prefix}.INCDIRS) {
# QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass.
darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH
clang: \
rim_qcc: \
# Need the cc1plus and ld command lines to pick up the paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v
else: clang: \
# Need to link to pick up library paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v
else: \
@ -50,35 +55,59 @@ isEmpty($${target_prefix}.INCDIRS) {
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
!equals(ec, 0): \
error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?")
add_includes = false
add_libraries = false
for (line, output) {
line ~= s/^[ \\t]*// # 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, "Library search paths:") {
add_libraries = true
} else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
add_includes = true
} else: contains(line, "End of search.*") {
add_includes = false
} else: $$add_libraries {
# We assume all library search paths are absolute
!contains(line, "^/.*") {
add_libraries = false
next()
rim_qcc {
for (line, output) {
contains(line, "^[^ ]*cc1plus .*") {
take_next = false
for (parameter, $$list($$line)) {
$$take_next {
QMAKE_DEFAULT_INCDIRS += $$clean_path($$parameter)
take_next = false
} else: equals(parameter, "-isystem") {
take_next = true
}
}
} else: contains(line, "^[^ ]*-ld .*") {
for (parameter, $$list($$line)) {
contains(parameter, "^-L.*") {
parameter ~= s/^-L//
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$parameter)
}
}
}
}
} else {
add_includes = false
add_libraries = false
for (line, output) {
line ~= s/^[ \\t]*// # 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, "Library search paths:") {
add_libraries = true
} else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
add_includes = true
} else: contains(line, "End of search.*") {
add_includes = false
} else: $$add_libraries {
# We assume all library search paths are absolute
!contains(line, "^/.*") {
add_libraries = false
next()
}
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line)
} else: $$add_includes {
!contains(line, ".* \\(framework directory\\)"): \
QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
}
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line)
} else: $$add_includes {
!contains(line, ".* \\(framework directory\\)"): \
QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
}
}
isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \
!if(qnx|integrity): \
!integrity: \
error("failed to parse default search paths from compiler output")
QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS)
} else: msvc {