Make architecture detection more robust.
Any message/error in mkspecs or qmake feature files ends up confusing the current arch detection logic. Instead, search for "Project MESSAGE: .* Architecture: <arch>". Change-Id: I308932a5b75f3a1fcbc4fe30c74faf2e83b2d752 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
31f9df5205
commit
4cc9523a31
@ -55,29 +55,29 @@
|
||||
#undef sparc
|
||||
#undef unknown
|
||||
#if defined(Q_PROCESSOR_ALPHA)
|
||||
alpha
|
||||
Architecture: alpha
|
||||
#elif defined(Q_PROCESSOR_ARM)
|
||||
arm
|
||||
Architecture: arm
|
||||
#elif defined(Q_PROCESSOR_AVR32)
|
||||
avr32
|
||||
Architecture: avr32
|
||||
#elif defined(Q_PROCESSOR_BLACKFIN)
|
||||
bfin
|
||||
Architecture: bfin
|
||||
#elif defined(Q_PROCESSOR_X86_32)
|
||||
i386
|
||||
Architecture: i386
|
||||
#elif defined(Q_PROCESSOR_X86_64)
|
||||
x86_64
|
||||
Architecture: x86_64
|
||||
#elif defined(Q_PROCESSOR_IA64)
|
||||
ia64
|
||||
Architecture: ia64
|
||||
#elif defined(Q_PROCESSOR_MIPS)
|
||||
mips
|
||||
Architecture: mips
|
||||
#elif defined(Q_PROCESSOR_POWER)
|
||||
power
|
||||
Architecture: power
|
||||
#elif defined(Q_PROCESSOR_S390)
|
||||
s390
|
||||
Architecture: s390
|
||||
#elif defined(Q_PROCESSOR_SH)
|
||||
sh
|
||||
Architecture: sh
|
||||
#elif defined(Q_PROCESSOR_SPARC)
|
||||
sparc
|
||||
Architecture: sparc
|
||||
#else
|
||||
unknown
|
||||
Architecture: unknown
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
CONFIG -= qt debug_and_release
|
||||
# Detect target by preprocessing a file that uses Q_PROCESSOR_* macros from qprocessordetection.h
|
||||
COMMAND = $$QMAKE_CXX $$QMAKE_CXXFLAGS -E $$PWD/arch.cpp
|
||||
# 'false' as second argument to system() prevents qmake from stripping newlines
|
||||
COMPILER_ARCH = $$system($$COMMAND, false)
|
||||
# system function converts newline in output into spaces
|
||||
COMPILER_ARCH = $$system($$COMMAND)
|
||||
# Message back to configure so that it can set QT_ARCH and QT_HOST_ARCH
|
||||
message($$COMPILER_ARCH)
|
||||
|
5
configure
vendored
5
configure
vendored
@ -3933,11 +3933,12 @@ fi # Build qmake
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Use config.tests/arch/arch.pro to has the compiler tell us what the target architecture is
|
||||
CFG_ARCH=`"$outpath/bin/qmake" -spec "$XQMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -e "s,^Project MESSAGE: ,," -e "s,^#.*$,,g" | grep -v "^$"`
|
||||
CFG_ARCH=`"$outpath/bin/qmake" -spec "$XQMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9]*\).*,\1,p'`
|
||||
|
||||
[ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
|
||||
if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
|
||||
# Do the same test again, using the host compiler
|
||||
CFG_HOST_ARCH=`"$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -e "s,^Project MESSAGE: ,," -e "s,^#.*$,,g" | grep -v "^$"`
|
||||
CFG_HOST_ARCH=`"$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9]*\).*,\1,p'`
|
||||
[ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
|
||||
else
|
||||
# not cross compiling, host == target
|
||||
|
@ -2584,32 +2584,9 @@ void Configure::detectArch()
|
||||
if (output.isEmpty())
|
||||
continue;
|
||||
|
||||
// strip everything up to and including 'Project MESSAGE: '
|
||||
QString ProjectMESSAGE = QStringLiteral("Project MESSAGE: ");
|
||||
int at = output.indexOf(ProjectMESSAGE);
|
||||
if (at != -1)
|
||||
output = output.mid(at + ProjectMESSAGE.length());
|
||||
|
||||
// strip lines beginning with a #
|
||||
at = 0;
|
||||
while ((at = output.indexOf('#', at)) != -1) {
|
||||
if (at > 0 && output.at(at - 1) != '\n') {
|
||||
// # isnt' at the beginning of a line, skip it
|
||||
++at;
|
||||
continue;
|
||||
}
|
||||
|
||||
int eol = output.indexOf('\n', at);
|
||||
if (eol == -1) {
|
||||
// end of string
|
||||
output.remove(at, output.length() - at);
|
||||
break;
|
||||
}
|
||||
|
||||
output.remove(at, eol - at + 1);
|
||||
}
|
||||
|
||||
dictionary[key] = output.simplified();
|
||||
QRegExp re("Project MESSAGE:.*Architecture: ([a-zA-Z0-9]*)");
|
||||
if (re.indexIn(output) != -1)
|
||||
dictionary[key] = re.cap(1);
|
||||
}
|
||||
|
||||
if (!dictionary.contains("QT_HOST_ARCH"))
|
||||
|
Loading…
Reference in New Issue
Block a user