summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@nokia.com>2011-05-10 15:15:15 +0200
committerLiang Qi <liang.qi@nokia.com>2011-05-10 15:15:15 +0200
commit45cdd701fa9e9e491bebde2b6fa11d7dd9250e1d (patch)
tree43c448e6678b2fd535a8305ed66e8e2fb1c31a95
parent44b7877c879faabe83310df697d1ec2f013ee8b5 (diff)
downloadqtbase-45cdd701fa9e9e491bebde2b6fa11d7dd9250e1d.tar.gz
Add QT_xxx_VERSION macros for each library in qtbase
Provide version info for each library like QTCORE_VERSION and etc. Task-number: QTMODULARIZATION-44 Reviewed-by: axis
-rw-r--r--.gitignore10
-rwxr-xr-xbin/syncqt40
-rw-r--r--src/corelib/corelib.pro3
-rw-r--r--src/dbus/dbus.pro3
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/network/network.pro3
-rw-r--r--src/opengl/opengl.pro2
-rw-r--r--src/openvg/openvg.pro2
-rw-r--r--src/sql/sql.pro2
-rw-r--r--src/testlib/testlib.pro3
-rw-r--r--src/xml/xml.pro2
-rw-r--r--sync.profile9
12 files changed, 81 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 5b4d2f2440..0db34fab52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -119,6 +119,16 @@ translations/*.qm
translations/*_untranslated.ts
qrc_*.cpp
+src/corelib/qtcoreversion.h
+src/dbus/qtdbusversion.h
+src/gui/qtguiversion.h
+src/network/qtnetworkversion.h
+src/opengl/qtopenglversion.h
+src/openvg/qtopenvgversion.h
+src/sql/qtsqlversion.h
+src/testlib/qttestversion.h
+src/xml/qtxmlversion.h
+
# Test generated files
QObject.log
tst_*
diff --git a/bin/syncqt b/bin/syncqt
index 3d25ecc817..2ac67fe51d 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -47,6 +47,7 @@ my $copy_headers = 0;
my $create_uic_class_map = 0;
my $create_private_headers = 1;
my $no_module_fwd = 0;
+my $no_module_version_header = 0;
my @modules_to_sync ;
$force_relative = 1 if ( -d "/System/Library/Frameworks" );
@@ -77,6 +78,8 @@ sub showUsage
print " Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n";
print " -private Force copy private headers (default: " . ($create_private_headers ? "yes" : "no") . ")\n";
print " -no-module-fwd Don't create fwd includes for module pri files\n";
+ print " -no-module-version-header\n";
+ print " Don't create module version header file\n";
print " -help This help\n";
exit 0;
}
@@ -619,6 +622,9 @@ while ( @ARGV ) {
} elsif($arg eq "-no-module-fwd") {
$var = "no_module_fwd";
$val = "yes";
+ } elsif($arg eq "-no-module-version-header") {
+ $var = "no_module_version_header";
+ $val = "yes";
} elsif($arg =~/^-/) {
print "Unknown option: $arg\n\n" if(!$var);
showUsage();
@@ -696,6 +702,8 @@ while ( @ARGV ) {
}
} elsif ($var eq "no_module_fwd") {
$no_module_fwd = 1;
+ } elsif ($var eq "no_module_version_header") {
+ $no_module_version_header = 1;
} elsif ($var eq "output") {
my $outdir = $val;
if(checkRelative($outdir)) {
@@ -748,6 +756,9 @@ foreach my $lib (@modules_to_sync) {
#iteration info
my $dir = $modules{$lib};
my $module_version = "";
+ my $module_major_version = "";
+ my $module_minor_version = "";
+ my $module_patch_version = "";
if (-e "$modulepris{$lib}") {
my $content = fileContents($modulepris{$lib});
@@ -758,6 +769,13 @@ foreach my $lib (@modules_to_sync) {
chomp $module_version;
$module_version =~ s/^\s*QT\..*\.VERSION\s*=\s*([^#]+).*$/$1/;
$module_version =~ s/\s+$//;
+ my @versions = split(/\./, $module_version);
+ $module_major_version = $versions[0];
+ chomp $module_major_version;
+ $module_minor_version = $versions[1];
+ chomp $module_minor_version;
+ $module_patch_version = $versions[2];
+ chomp $module_patch_version;
}
}
print "WARNING: Module $lib\'s pri missing QT.<module>.VERSION variable! Private headers not versioned!\n" if (!$module_version);
@@ -1045,6 +1063,28 @@ foreach my $lib (@modules_to_sync) {
print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating forwarding pri for $lib.\n";
}
}
+
+ # create the version header files for each module
+ unless ($no_module_version_header) {
+ my $modulepri = $modulepris{$lib};
+ if (-e $modulepri) {
+ my $modulepriname = basename($modulepri);
+ my $moduleversionheader = "$modules{$lib}/" . lc($lib) . "version.h";
+ my $modulehexstring = sprintf("0x%02X%02X%02X", int($module_major_version), int($module_minor_version), int($module_patch_version));
+ open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader";
+ print MODULE_VERSION_HEADER_FILE "/* This file was generated by syncqt with the info from sync.profile. */\n";
+ print MODULE_VERSION_HEADER_FILE "#ifndef QT_". uc($lib) . "_VERSION_H\n";
+ print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n";
+ print MODULE_VERSION_HEADER_FILE "\n";
+ print MODULE_VERSION_HEADER_FILE "#define " .uc($lib) . "_VERSION_STR \"" . $module_version . "\"\n";
+ print MODULE_VERSION_HEADER_FILE "\n";
+ print MODULE_VERSION_HEADER_FILE "#define " .uc($lib) . "_VERSION $modulehexstring\n", ;
+ print MODULE_VERSION_HEADER_FILE "\n";
+ print MODULE_VERSION_HEADER_FILE "#endif // QT_". uc($lib) . "_VERSION_H\n";
+ } elsif ($modulepri) {
+ print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating module version header for $lib.\n";
+ }
+ }
}
}
unless($showonly || !$create_uic_class_map) {
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index a31d1e5b7f..1e1e4dacf6 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -11,6 +11,9 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
include(../qbase.pri)
+
+HEADERS += $$QT_SOURCE_TREE/src/corelib/qtcoreversion.h
+
include(animation/animation.pri)
include(arch/arch.pri)
include(concurrent/concurrent.pri)
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index e73fa05a74..731d20a893 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -32,6 +32,9 @@ win32 {
else:LIBS_PRIVATE += -ldbus-1
}
include(../qbase.pri)
+
+HEADERS += $$QT_SOURCE_TREE/src/dub/qtdbusversion.h
+
PUB_HEADERS = qdbusargument.h \
qdbusconnectioninterface.h \
qdbusmacros.h \
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 072553a05c..7e9d78d0bb 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -15,6 +15,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri)
+HEADERS += $$QT_SOURCE_TREE/src/gui/qtguiversion.h
+
contains(QT_CONFIG, x11sm):CONFIG += x11sm
#platforms
diff --git a/src/network/network.pro b/src/network/network.pro
index fc5d08d936..4ee71b028e 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -19,6 +19,9 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri)
+
+HEADERS += $$QT_SOURCE_TREE/src/network/qtnetworkversion.h
+
include(access/access.pri)
include(bearer/bearer.pri)
include(kernel/kernel.pri)
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 849bd9ebc7..b30d4057db 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -15,6 +15,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
include(../qbase.pri)
+HEADERS += $$QT_SOURCE_TREE/src/opengl/qtopenglversion.h
+
!win32:!embedded:!mac:!symbian:!qpa:CONFIG += x11
contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles1):CONFIG += opengles1
diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
index dbe1620f80..0e22503c3b 100644
--- a/src/openvg/openvg.pro
+++ b/src/openvg/openvg.pro
@@ -52,6 +52,8 @@ symbian {
include(../qbase.pri)
+HEADERS += $$QT_SOURCE_TREE/src/openvg/qtopenvgversion.h
+
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
symbian:TARGET.UID3 = 0x2001E62F
diff --git a/src/sql/sql.pro b/src/sql/sql.pro
index f1bdd6bda1..c7cbbc4985 100644
--- a/src/sql/sql.pro
+++ b/src/sql/sql.pro
@@ -13,6 +13,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri)
+HEADERS += $$QT_SOURCE_TREE/src/sql/qtsqlversion.h
+
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 311c79379b..3408c91420 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -85,6 +85,9 @@ qpa:mac: {
}
include(../qbase.pri)
+
+HEADERS += $$QT_SOURCE_TREE/src/testlib/qttestlibversion.h
+
QMAKE_TARGET_PRODUCT = QTestLib
QMAKE_TARGET_DESCRIPTION = Qt \
Unit \
diff --git a/src/xml/xml.pro b/src/xml/xml.pro
index 68bb20b009..986e478b69 100644
--- a/src/xml/xml.pro
+++ b/src/xml/xml.pro
@@ -12,6 +12,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri)
+HEADERS += $$QT_SOURCE_TREE/src/xml/qtxmlversion.h
+
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
win32-borland {
diff --git a/sync.profile b/sync.profile
index 8d838041f2..d180458445 100644
--- a/sync.profile
+++ b/sync.profile
@@ -28,6 +28,15 @@
"qtconcurrentmap.h" => "QtConcurrentMap",
"qtconcurrentfilter.h" => "QtConcurrentFilter",
"qtconcurrentrun.h" => "QtConcurrentRun",
+ "qtcoreversion.h" => "QtCoreVersion",
+ "qtdbusversion.h" => "QtDBusVersion",
+ "qtguiversion.h" => "QtGuiVersion",
+ "qtnetworkversion.h" => "QtNetworkVersion",
+ "qtopenglversion.h" => "QtOpenGLVersion",
+ "qtopenvgversion.h" => "QtOpenVGVersion",
+ "qtsqlversion.h" => "QtSqlVersion",
+ "qttestversion.h" => "QtTestVersion",
+ "qtxmlversion.h" => "QtXmlVersion",
);
%mastercontent = (
"core" => "#include <QtCore/QtCore>\n",