Add module specific pris, and make syncqt create fwd includes

The module specific pris define the modules
    name
    version
    dependencies
    include paths
    lib paths
    additional CONFIGs and DEFINES
They are located in the modules source directory, with fwd
includes created in QtBase/mkspecs/modules build directory.
The pris use
    QT_MODULE_INCLUDE_BASE
    QT_MODULE_LIB_BASE
to specify the locations for includes and libs. These paths
are normally based on
    QT_INSTALL_HEADERS
    QT_INSTALL_LIBS
for installed modules, but overridden to the module's build
directory by syncqt for the fwd included pris.
The path of the pris must be specified in the sync.profile
for syncqt to create the fwding pris in QtBase.
This commit is contained in:
Marius Storm-Olsen 2010-11-24 20:21:06 -06:00 committed by axis
parent 94e8d3b686
commit 00c5f39081
13 changed files with 191 additions and 4 deletions

View File

@ -23,8 +23,16 @@ our $basedir;
our $quoted_basedir;
# try to figure out where QtBase is located
# normally the script location should be enough, if not fall back to
# QTDIR environment variable. If that doesn't work, later ask the
# user to use the -qtdir option explicitly.
my $qtbasedir = dirname(dirname($0));
$qtbasedir = $ENV{"QTDIR"} if ($qtbasedir !~ /qtbase/);
$qtbasedir =~ s=\\=/=g if (defined $qtbasedir);
# will be defined based on the modules sync.profile
our (%modules, %moduleheaders, %classnames, %mastercontent);
our (%modules, %moduleheaders, %classnames, %mastercontent, %modulepris);
# global variables (modified by options)
my $isunix = 0;
@ -38,6 +46,7 @@ my $check_includes = 0;
my $copy_headers = 0;
my $create_uic_class_map = 1;
my $create_private_headers = 1;
my $no_module_fwd = 0;
my @modules_to_sync ;
$force_relative = 1 if ( -d "/System/Library/Frameworks" );
@ -62,9 +71,12 @@ sub showUsage
print " -windows Force platform to Windows (default: " . ($force_win ? "yes" : "no") . ")\n";
print " -showonly Show action but not perform (default: " . ($showonly ? "yes" : "no") . ")\n";
print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n";
print " -qtdir <PATH> Set the path to QtBase (detected: " . (defined $qtbasedir ? $qtbasedir : "-none-") . ")\n";
print " -quiet Only report problems, not activity (default: " . ($quiet ? "yes" : "no") . ")\n";
print " -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR> Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n";
print " -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR>\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 " -no-module-fwd Don't create fwd includes for module pri files\n";
print " -help This help\n";
exit 0;
}
@ -558,7 +570,7 @@ while ( @ARGV ) {
#parse
my $arg = shift @ARGV;
if ($arg eq "-h" || $arg eq "-help" || $arg eq "?") {
if ($arg eq "-h" || $arg eq "-help" || $arg eq "-?" || $arg eq "?") {
$var = "show_help";
$val = "yes";
} elsif($arg eq "-copy") {
@ -593,10 +605,16 @@ while ( @ARGV ) {
} elsif($arg eq "-private") {
$var = "create_private_headers";
$val = "yes";
} elsif($arg eq "-qtdir") {
$var = "qtdir";
$val = shift @ARGV;
} elsif($arg eq "-base-dir") {
# skip, it's been dealt with at the top of the file
shift @ARGV;
next;
} elsif($arg eq "-no-module-fwd") {
$var = "no_module_fwd";
$val = "yes";
} elsif($arg =~/^-/) {
print "Unknown option: $arg\n\n" if(!$var);
showUsage();
@ -664,6 +682,15 @@ while ( @ARGV ) {
push @modules_to_sync, $module;
$moduleheaders{$module} = $headerdir;
$create_uic_class_map = 0;
} elsif ($var eq "qtdir") {
if($val) {
$qtbasedir = $val;
$qtbasedir =~ s=\\=/=g;
} else {
die "The -qtdir option requires an argument";
}
} elsif ($var eq "no_module_fwd") {
$no_module_fwd = 1;
} elsif ($var eq "output") {
my $outdir = $val;
if(checkRelative($outdir)) {
@ -678,6 +705,15 @@ while ( @ARGV ) {
}
}
# if the $qtbasedir neither has 'qtbase' somewhere in its path, nor a
# '.qmake.cache' file in its directory, we assume it's not a valid path
# (remember that a yet-to-be-built qtbase doesn't have this file either,
# thus the 'qtbase' path check!)
die "Cannot automatically detect/use provided path to QtBase's build directory!\n" .
"QTDIR detected/provided: " . (defined $qtbasedir ? $qtbasedir : "-none-") . "\n" .
"Please -qtdir option to provide the correct path.\nsyncqt failed"
if (!defined $qtbasedir || (!-e "$qtbasedir/.qmake.cache" && $qtbasedir !~ /qtbase/));
# if we have no $basedir we cannot be sure which sources you want, so die
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
@ -962,6 +998,23 @@ foreach my $lib (@modules_to_sync) {
print HEADERS_PRI_FILE $headers_pri_contents;
close HEADERS_PRI_FILE;
}
# create forwarding module pri in qtbase/mkspecs/modules
unless ($no_module_fwd) {
my $modulepri = $modulepris{$lib};
if (-e $modulepri) {
my $modulepriname = basename($modulepri);
my $moduleprifwd = "$qtbasedir/mkspecs/modules/$modulepriname";
open MODULE_PRI_FILE, ">$moduleprifwd";
print MODULE_PRI_FILE "QT_MODULE_INCLUDE_BASE = $out_basedir/include\n";
print MODULE_PRI_FILE "QT_MODULE_LIB_BASE = $out_basedir/lib\n";
print MODULE_PRI_FILE "include($modulepri)\n";
close MODULE_PRI_FILE;
utime(time, (stat($modulepri))[9], $moduleprifwd);
} elsif ($modulepri) {
print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating forwarding pri for $lib.\n";
}
}
}
}
unless($showonly || !$create_uic_class_map) {

View File

@ -14,7 +14,14 @@ isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) {
for(dir, $$list($$unique($$list($$dirname(QMAKE_QT_CONFIG) \
$$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))))) {
debug(1, "Loading modules from $${dir}")
for(mod, $$list($$files($$dir/modules/qt_*.pri))):include($$mod)
for(mod, $$list($$files($$dir/modules/qt_*.pri))) {
# For installed Qt these paths will be common for all modules
# For development these will vary per module, and syncqt will override the value in the
# qt_<module>.pri forwarding file
QT_MODULE_INCLUDE_BASE = $$[QT_INSTALL_HEADERS]
QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS]
include($$mod)
}
}
}

11
src/modules/qt_core.pri Normal file
View File

@ -0,0 +1,11 @@
QT_CORE_VERSION = $$QT_VERSION
QT_CORE_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_CORE_MINOR_VERSION = $$QT_MINOR_VERSION
QT_CORE_PATCH_VERSION = $$QT_PATCH_VERSION
QT.core.name = QtCore
QT.core.includes = $$QT_MODULE_INCLUDE_BASE/QtCore
QT.core.libs = $$QT_MODULE_LIB_BASE
QT.core.depends =
QT_CONFIG += core

12
src/modules/qt_dbus.pri Normal file
View File

@ -0,0 +1,12 @@
QT_DBUS_VERSION = $$QT_VERSION
QT_DBUS_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_DBUS_MINOR_VERSION = $$QT_MINOR_VERSION
QT_DBUS_PATCH_VERSION = $$QT_PATCH_VERSION
QT.dbus.name = QtDBus
QT.dbus.includes = $$QT_MODULE_INCLUDE_BASE/QtDBus
QT.dbus.libs = $$QT_MODULE_LIB_BASE
QT.dbus.depends = core xml
QT.dbus.CONFIG = dbusadaptors dbusinterfaces
QT_CONFIG += dbus

11
src/modules/qt_gui.pri Normal file
View File

@ -0,0 +1,11 @@
QT_GUI_VERSION = $$QT_VERSION
QT_GUI_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_GUI_MINOR_VERSION = $$QT_MINOR_VERSION
QT_GUI_PATCH_VERSION = $$QT_PATCH_VERSION
QT.gui.name = QtGui
QT.gui.includes = $$QT_MODULE_INCLUDE_BASE/QtGui
QT.gui.libs = $$QT_MODULE_LIB_BASE
QT.gui.depends = core network
QT_CONFIG += gui

View File

@ -0,0 +1,11 @@
QT_CORE_VERSION = $$QT_VERSION
QT_NETWORK_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_NETWORK_MINOR_VERSION = $$QT_MINOR_VERSION
QT_NETWORK_PATCH_VERSION = $$QT_PATCH_VERSION
QT.network.name = QtNetwork
QT.network.includes = $$QT_MODULE_INCLUDE_BASE/QtNetwork
QT.network.libs = $$QT_MODULE_LIB_BASE
QT.network.depends = core
QT_CONFIG += network

12
src/modules/qt_opengl.pri Normal file
View File

@ -0,0 +1,12 @@
QT_OPENGL_VERSION = $$QT_VERSION
QT_OPENGL_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_OPENGL_MINOR_VERSION = $$QT_MINOR_VERSION
QT_OPENGL_PATCH_VERSION = $$QT_PATCH_VERSION
QT.opengl.name = QtOpenGL
QT.opengl.includes = $$QT_MODULE_INCLUDE_BASE/QtOpenGL
QT.opengl.libs = $$QT_MODULE_LIB_BASE
QT.opengl.depends = core gui
QT.opengl.CONFIG = opengl
QT_CONFIG += opengl

12
src/modules/qt_openvg.pri Normal file
View File

@ -0,0 +1,12 @@
QT_OPENVG_VERSION = $$QT_VERSION
QT_OPENVG_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_OPENVG_MINOR_VERSION = $$QT_MINOR_VERSION
QT_OPENVG_PATCH_VERSION = $$QT_PATCH_VERSION
QT.openvg.name = QtOpenVG
QT.openvg.includes = $$QT_MODULE_INCLUDE_BASE/QtOpenVG
QT.openvg.libs = $$QT_MODULE_LIB_BASE
QT.openvg.depends = core gui
QT.openvg.CONFIG = openvg
QT_CONFIG += openvg

11
src/modules/qt_sql.pri Normal file
View File

@ -0,0 +1,11 @@
QT_SQL_VERSION = $$QT_VERSION
QT_SQL_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_SQL_MINOR_VERSION = $$QT_MINOR_VERSION
QT_SQL_PATCH_VERSION = $$QT_PATCH_VERSION
QT.sql.name = QtSql
QT.sql.includes = $$QT_MODULE_INCLUDE_BASE/QtSql
QT.sql.libs = $$QT_MODULE_LIB_BASE
QT.sql.depends = core
QT_CONFIG += sql

11
src/modules/qt_svg.pri Normal file
View File

@ -0,0 +1,11 @@
QT_SVG_VERSION = $$QT_VERSION
QT_SVG_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_SVG_MINOR_VERSION = $$QT_MINOR_VERSION
QT_SVG_PATCH_VERSION = $$QT_PATCH_VERSION
QT.svg.name = QtSvg
QT.svg.includes = $$QT_MODULE_INCLUDE_BASE/QtSvg
QT.svg.libs = $$QT_MODULE_LIB_BASE
QT.svg.depends = core gui
QT_CONFIG += svg

View File

@ -0,0 +1,12 @@
QT_TEST_VERSION = $$QT_VERSION
QT_TEST_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_TEST_MINOR_VERSION = $$QT_MINOR_VERSION
QT_TEST_PATCH_VERSION = $$QT_PATCH_VERSION
QT.testlib.name = QtTest
QT.testlib.includes = $$QT_MODULE_INCLUDE_BASE/QtTest
QT.testlib.libs = $$QT_MODULE_LIB_BASE
QT.testlib.depends = core
QT.testlib.CONFIG = console
QT_CONFIG += testlib

11
src/modules/qt_xml.pri Normal file
View File

@ -0,0 +1,11 @@
QT_XML_VERSION = $$QT_VERSION
QT_XML_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_XML_MINOR_VERSION = $$QT_MINOR_VERSION
QT_XML_PATCH_VERSION = $$QT_PATCH_VERSION
QT.xml.name = QtXml
QT.xml.includes = $$QT_MODULE_INCLUDE_BASE/QtXml
QT.xml.libs = $$QT_MODULE_LIB_BASE
QT.xml.depends = core
QT_CONFIG += xml

View File

@ -37,6 +37,19 @@
"openvg" => "#include <QtOpenVG/QtOpenVG>\n",
"xml" => "#include <QtXml/QtXml>\n",
);
%modulepris = (
"QtCore" => "$basedir/src/modules/qt_core.pri",
"QtDBus" => "$basedir/src/modules/qt_dbus.pri",
"QtGui" => "$basedir/src/modules/qt_gui.pri",
"QtNetwork" => "$basedir/src/modules/qt_network.pri",
"QtOpenGL" => "$basedir/src/modules/qt_opengl.pri",
"QtOpenVG" => "$basedir/src/modules/qt_openvg.pri",
"QtSql" => "$basedir/src/modules/qt_sql.pri",
"QtSvg" => "$basedir/src/modules/qt_svg.pri",
"QtTest" => "$basedir/src/modules/qt_testlib.pri",
"QtXml" => "$basedir/src/modules/qt_xml.pri",
);
@ignore_for_master_contents = ( "qt.h", "qpaintdevicedefs.h" );
@ignore_for_include_check = ( "qatomic.h" );
@ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h" );