Add the -qreal option to the Qt ABI information

If -qreal float is passed, fullCpuArchitecture() will now include
"-qreal_float". If something else other than "float" is passed to
-qreal, we'll try to encode it (e.g., -qreal "fixed<int, 7>").

Change-Id: Ie33fd1a643f4376e6f01a7966e01c7c34e6fcffd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Thiago Macieira 2014-06-13 15:12:28 -07:00
parent 65a1e1e412
commit 5f6af9de48
4 changed files with 43 additions and 3 deletions

18
configure vendored
View File

@ -1149,6 +1149,23 @@ while [ "$#" -gt 0 ]; do
;;
qreal)
CFG_QREAL="$VAL"
if [ "$CFG_QREAL" = "float" ]; then
CFG_QREAL_STRING="\"float\""
elif [ "$CFG_QREAL" != "double" ]; then
if [ -z "$PERL" ]; then
echo "configure needs perl in \$PATH if the -qreal option is used with" >&2
echo "a value different from \"float\"" >&2
exit 1
fi
CFG_QREAL_STRING=`perl -e '$_ = $ARGV[0];
s/ +/ /g; s/^ +//; s/ +$//;
while (/(.)/g) {
$c = $1;
if ($c =~ /[a-zA-Z0-9]/) { $result .= $c; }
else { $result .= "_" . unpack("H*", $c); }
}
print "\"$result\"";' "$CFG_QREAL"`
fi
;;
sysroot)
CFG_SYSROOT="$VAL"
@ -6002,6 +6019,7 @@ fi
if [ "$CFG_QREAL" != double ]; then
echo "#define QT_COORD_TYPE $CFG_QREAL" >>"$outpath/src/corelib/global/qconfig.h.new"
echo "#define QT_COORD_TYPE_STRING $CFG_QREAL_STRING" >>"$outpath/src/corelib/global/qconfig.h.new"
fi
if [ "$CFG_FRAMEWORK" = "yes" ]; then

View File

@ -87,6 +87,13 @@
# define ARCH_POINTER "ilp32"
#endif
// qreal type, if not double (includes the dash)
#ifdef QT_COORD_TYPE_STRING
# define ARCH_COORD_TYPE "-qreal_" QT_COORD_TYPE_STRING
#else
# define ARCH_COORD_TYPE ""
#endif
// secondary: ABI string (includes the dash)
#if defined(__ARM_EABI__) || defined(__mips_eabi)
# define ARCH_ABI1 "-eabi"
@ -111,4 +118,4 @@
#define ARCH_ABI ARCH_ABI1 ARCH_ABI2
#define ARCH_FULL ARCH_PROCESSOR "-" ARCH_ENDIANNESS "-" ARCH_POINTER ARCH_ABI
#define ARCH_FULL ARCH_PROCESSOR "-" ARCH_ENDIANNESS "-" ARCH_POINTER ARCH_COORD_TYPE ARCH_ABI

View File

@ -2221,6 +2221,11 @@ QString QSysInfo::cpuArchitecture()
component is the main ABI (such as "eabi", "o32", "n32", "o64"); another is
whether the calling convention is using hardware floating point registers ("hardfloat"
is present).
Additionally, if Qt was configured with \c{-qreal float}, the ABI option tag "qreal_float"
will be present. If Qt was configured with another type as qreal, that type is present after
"qreal_", with all characters other than letters and digits escaped by an underscore, followed
by two hex digits. For example, \c{-qreal long double} becomes "qreal_long_20double".
\endtable
\sa QSysInfo::cpuArchitecture()

View File

@ -431,7 +431,15 @@ void Configure::parseCmdLine()
++i;
if (i == argCount)
break;
dictionary[ "QREAL" ] = configCmdLine.at(i);
QString s = dictionary[ "QREAL" ] = configCmdLine.at(i);
if (s == "float") {
dictionary[ "QREAL_STRING" ] = "\"float\"";
} else {
// escape
s = s.simplified();
s = '"' + s.toLatin1().toPercentEncoding(QByteArray(), "-._~", '_') + '"';
dictionary[ "QREAL_STRING" ] = s;
}
}
else if (configCmdLine.at(i) == "-release") {
@ -3492,8 +3500,10 @@ void Configure::generateConfigfiles()
if (dictionary[ "IWMMXT" ] == "yes")
tmpStream << "#define QT_COMPILER_SUPPORTS_IWMMXT 1" << endl;
if (dictionary["QREAL"] != "double")
if (dictionary["QREAL"] != "double") {
tmpStream << "#define QT_COORD_TYPE " << dictionary["QREAL"] << endl;
tmpStream << "#define QT_COORD_TYPE_STRING " << dictionary["QREAL_STRING"] << endl;
}
tmpStream << endl << "// Compile time features" << endl;