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