summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-09-17 18:17:40 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-10-14 20:12:57 +0000
commit2d2cb6434f1d6e00f421c98b20467ff3f4388319 (patch)
treefeae43744e8bbcd35f5f4d30fbc0b348051c73a6 /tools
parente9121328866efa6ba3eb78a991fef785338fd55e (diff)
Move the official Qt version from qglobal.h to .qmake.conf
It's easier to parse than qglobal.h. The objective is actually to have macros with parts of the version number, so the major or minor numbers could be used in other preprocessor macros. Change-Id: I42e7ef1a481840699a8dffff1404eda1dd5c308d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/Makefile.mingw2
-rw-r--r--tools/configure/Makefile.win322
-rw-r--r--tools/configure/configureapp.cpp37
3 files changed, 24 insertions, 17 deletions
diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw
index f4513c64d6..5bdfc3f32c 100644
--- a/tools/configure/Makefile.mingw
+++ b/tools/configure/Makefile.mingw
@@ -4,7 +4,7 @@ CONFSRC = $(TOOLSRC)/configure
RAW_PCH = configure_pch.h
PCH = $(RAW_PCH).gch/c++
-DEFINES = -DUNICODE -DQT_NO_DATASTREAM -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE
+DEFINES = -DUNICODE -DQT_NO_DATASTREAM -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DQT_VERSION_STR=\"$(QTVERSION)\" -DQT_VERSION_MAJOR=$(QT_VERSION_MAJOR) -DQT_VERSION_MINOR=$(QT_VERSION_MINOR) -DQT_VERSION_PATCH=$(QT_VERSION_PATCH)
INCPATH = -I"../../include" -I"../../include/QtCore" -I"../../include/QtCore/$(QTVERSION)" -I"../../include/QtCore/$(QTVERSION)/QtCore" -I"$(TOOLSRC)/shared" -I"$(QTSRC)mkspecs/win32-g++"
CXXFLAGS_BARE = -fno-rtti -fno-exceptions -mthreads -Wall -Wextra $(DEFINES) $(INCPATH)
CXXFLAGS = -include $(RAW_PCH) $(CXXFLAGS_BARE)
diff --git a/tools/configure/Makefile.win32 b/tools/configure/Makefile.win32
index da5b430bb1..d3a28e73ab 100644
--- a/tools/configure/Makefile.win32
+++ b/tools/configure/Makefile.win32
@@ -3,7 +3,7 @@ TOOLSRC = $(QTSRC)tools
CONFSRC = $(TOOLSRC)\configure
PCH = configure_pch.pch
-DEFINES = -DUNICODE -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE
+DEFINES = -DUNICODE -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DQT_VERSION_STR=\"$(QTVERSION)\" -DQT_VERSION_MAJOR=$(QT_VERSION_MAJOR) -DQT_VERSION_MINOR=$(QT_VERSION_MINOR) -DQT_VERSION_PATCH=$(QT_VERSION_PATCH)
INCPATH = -I"..\..\include" -I"..\..\include\QtCore" -I"..\..\include\QtCore\$(QTVERSION)" -I"..\..\include\QtCore\$(QTVERSION)\QtCore" -I"$(TOOLSRC)\shared" -I"$(QTSRC)mkspecs\win32-msvc2008"
CXXFLAGS_BARE = -nologo -Zc:wchar_t -W3 -GR -EHsc -w34100 -w34189 $(CFLAGS_CRT) $(EXTRA_CXXFLAGS) $(DEFINES) $(INCPATH)
CXXFLAGS = -FIconfigure_pch.h -Yuconfigure_pch.h -Fp$(PCH) -MP $(CXXFLAGS_BARE)
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