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
This commit is contained in:
Liang Qi 2011-05-10 15:15:15 +02:00
parent 44b7877c87
commit 45cdd701fa
12 changed files with 81 additions and 0 deletions

10
.gitignore vendored
View File

@ -119,6 +119,16 @@ translations/*.qm
translations/*_untranslated.ts translations/*_untranslated.ts
qrc_*.cpp 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 # Test generated files
QObject.log QObject.log
tst_* tst_*

View File

@ -47,6 +47,7 @@ my $copy_headers = 0;
my $create_uic_class_map = 0; my $create_uic_class_map = 0;
my $create_private_headers = 1; my $create_private_headers = 1;
my $no_module_fwd = 0; my $no_module_fwd = 0;
my $no_module_version_header = 0;
my @modules_to_sync ; my @modules_to_sync ;
$force_relative = 1 if ( -d "/System/Library/Frameworks" ); $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 " 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 " -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-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"; print " -help This help\n";
exit 0; exit 0;
} }
@ -619,6 +622,9 @@ while ( @ARGV ) {
} elsif($arg eq "-no-module-fwd") { } elsif($arg eq "-no-module-fwd") {
$var = "no_module_fwd"; $var = "no_module_fwd";
$val = "yes"; $val = "yes";
} elsif($arg eq "-no-module-version-header") {
$var = "no_module_version_header";
$val = "yes";
} elsif($arg =~/^-/) { } elsif($arg =~/^-/) {
print "Unknown option: $arg\n\n" if(!$var); print "Unknown option: $arg\n\n" if(!$var);
showUsage(); showUsage();
@ -696,6 +702,8 @@ while ( @ARGV ) {
} }
} elsif ($var eq "no_module_fwd") { } elsif ($var eq "no_module_fwd") {
$no_module_fwd = 1; $no_module_fwd = 1;
} elsif ($var eq "no_module_version_header") {
$no_module_version_header = 1;
} elsif ($var eq "output") { } elsif ($var eq "output") {
my $outdir = $val; my $outdir = $val;
if(checkRelative($outdir)) { if(checkRelative($outdir)) {
@ -748,6 +756,9 @@ foreach my $lib (@modules_to_sync) {
#iteration info #iteration info
my $dir = $modules{$lib}; my $dir = $modules{$lib};
my $module_version = ""; my $module_version = "";
my $module_major_version = "";
my $module_minor_version = "";
my $module_patch_version = "";
if (-e "$modulepris{$lib}") { if (-e "$modulepris{$lib}") {
my $content = fileContents($modulepris{$lib}); my $content = fileContents($modulepris{$lib});
@ -758,6 +769,13 @@ foreach my $lib (@modules_to_sync) {
chomp $module_version; chomp $module_version;
$module_version =~ s/^\s*QT\..*\.VERSION\s*=\s*([^#]+).*$/$1/; $module_version =~ s/^\s*QT\..*\.VERSION\s*=\s*([^#]+).*$/$1/;
$module_version =~ s/\s+$//; $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); 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"; 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) { unless($showonly || !$create_uic_class_map) {

View File

@ -11,6 +11,9 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/corelib/qtcoreversion.h
include(animation/animation.pri) include(animation/animation.pri)
include(arch/arch.pri) include(arch/arch.pri)
include(concurrent/concurrent.pri) include(concurrent/concurrent.pri)

View File

@ -32,6 +32,9 @@ win32 {
else:LIBS_PRIVATE += -ldbus-1 else:LIBS_PRIVATE += -ldbus-1
} }
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/dub/qtdbusversion.h
PUB_HEADERS = qdbusargument.h \ PUB_HEADERS = qdbusargument.h \
qdbusconnectioninterface.h \ qdbusconnectioninterface.h \
qdbusmacros.h \ qdbusmacros.h \

View File

@ -15,6 +15,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/gui/qtguiversion.h
contains(QT_CONFIG, x11sm):CONFIG += x11sm contains(QT_CONFIG, x11sm):CONFIG += x11sm
#platforms #platforms

View File

@ -19,6 +19,9 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/network/qtnetworkversion.h
include(access/access.pri) include(access/access.pri)
include(bearer/bearer.pri) include(bearer/bearer.pri)
include(kernel/kernel.pri) include(kernel/kernel.pri)

View File

@ -15,6 +15,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/opengl/qtopenglversion.h
!win32:!embedded:!mac:!symbian:!qpa:CONFIG += x11 !win32:!embedded:!mac:!symbian:!qpa:CONFIG += x11
contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles1):CONFIG += opengles1

View File

@ -52,6 +52,8 @@ symbian {
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/openvg/qtopenvgversion.h
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
symbian:TARGET.UID3 = 0x2001E62F symbian:TARGET.UID3 = 0x2001E62F

View File

@ -13,6 +13,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/sql/qtsqlversion.h
DEFINES += QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql SQL_P = sql

View File

@ -85,6 +85,9 @@ qpa:mac: {
} }
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/testlib/qttestlibversion.h
QMAKE_TARGET_PRODUCT = QTestLib QMAKE_TARGET_PRODUCT = QTestLib
QMAKE_TARGET_DESCRIPTION = Qt \ QMAKE_TARGET_DESCRIPTION = Qt \
Unit \ Unit \

View File

@ -12,6 +12,8 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
include(../qbase.pri) include(../qbase.pri)
HEADERS += $$QT_SOURCE_TREE/src/xml/qtxmlversion.h
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
win32-borland { win32-borland {

View File

@ -28,6 +28,15 @@
"qtconcurrentmap.h" => "QtConcurrentMap", "qtconcurrentmap.h" => "QtConcurrentMap",
"qtconcurrentfilter.h" => "QtConcurrentFilter", "qtconcurrentfilter.h" => "QtConcurrentFilter",
"qtconcurrentrun.h" => "QtConcurrentRun", "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 = ( %mastercontent = (
"core" => "#include <QtCore/QtCore>\n", "core" => "#include <QtCore/QtCore>\n",