diff options
Diffstat (limited to 'tools/configure/configureapp.cpp')
-rw-r--r-- | tools/configure/configureapp.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d4ea0f6d04..62af1970fe 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -198,20 +198,18 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; QString version; - QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h"); - if (qglobal_h.open(QFile::ReadOnly)) { - QTextStream read(&qglobal_h); - QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\""); - QString line; - while (!read.atEnd()) { - line = read.readLine(); - if (version_regexp.exactMatch(line)) { - version = version_regexp.cap(1).trimmed(); - if (!version.isEmpty()) - break; - } + QFile qmake_conf(sourcePath + "/.qmake.conf"); + if (qmake_conf.open(QFile::ReadOnly)) { + while (!qmake_conf.atEnd()) { + static const char beginning[] = "MODULE_VERSION = "; + QByteArray line = qmake_conf.readLine(); + if (!line.startsWith(beginning)) + continue; + + version = qMove(line).mid(int(strlen(beginning))).trimmed(); + break; } - qglobal_h.close(); + qmake_conf.close(); } if (version.isEmpty()) @@ -3632,6 +3630,12 @@ void Configure::generateConfigfiles() { FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.h"); + tmpStream << "#define QT_VERSION_MAJOR " << dictionary["VERSION_MAJOR"] << endl + << "#define QT_VERSION_MINOR " << dictionary["VERSION_MINOR"] << endl + << "#define QT_VERSION_PATCH " << dictionary["VERSION_PATCH"] << endl + << "#define QT_VERSION_STR \"" << dictionary["VERSION"] << "\"\n" + << endl; + if (dictionary[ "QCONFIG" ] == "full") { tmpStream << "/* Everything */" << endl; } else { @@ -4031,7 +4035,7 @@ void Configure::generateHeaders() QStringList args; args << "perl" << "-w"; args += sourcePath + "/bin/syncqt.pl"; - args << "-minimal" << "-module" << "QtCore"; + args << "-version" << dictionary["VERSION"] << "-minimal" << "-module" << "QtCore"; args += sourcePath; int retc = Environment::execute(args, QStringList(), QStringList()); if (retc) { @@ -4294,7 +4298,10 @@ void Configure::buildQmake() << "INC_PATH = " << QDir::toNativeSeparators( (QFile::exists(sourcePath + "/.git") ? ".." : sourcePath) + "/include") << endl; - stream << "QT_VERSION = " << dictionary["VERSION"] << endl; + stream << "QT_VERSION = " << dictionary["VERSION"] << endl + << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl + << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl + << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) { stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\win32-g++" << endl << "EXTRA_CFLAGS = -DUNICODE -ffunction-sections" << endl |