Implemented module-local caching of module profiles.

We use syncqt to generate .qmake.cache also for submodules, which
contains the location of forwarding module profiles for that module.
This enables us to build without having to put module profiles into
mkspecs/modules until install time.

Also added support for -developer-build to syncqt.

What it does is to point build directories for binaries and
libraries to a common location in QtBase. This is more
convenient when doing development, since you don't need to set your
path to every module's bin/ directory, but it cannot be used with
release builds, since they need to build independently of QtBase,
in their own directory.

Change-Id: I959c62c11c644f2147a98da894a72452d9c44327
Task: QTBUG-19585
Task: QTBUG-19583
Reviewed-on: http://codereview.qt.nokia.com/232
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
This commit is contained in:
axis 2011-05-18 15:23:51 +02:00 committed by Qt Continuous Integration System
parent 55f2a05a20
commit 0e6be2aa5d
3 changed files with 58 additions and 22 deletions

View File

@ -46,7 +46,9 @@ my $check_includes = 0;
my $copy_headers = 0;
my $create_uic_class_map = 0;
my $create_private_headers = 1;
my $no_module_fwd = 0;
my $module_fwd = "";
my $cache_module_fwd = 0;
my $developer_build = 0;
my $no_module_version_header = 0;
my @modules_to_sync ;
$force_relative = 1 if ( -d "/System/Library/Frameworks" );
@ -75,9 +77,15 @@ sub showUsage
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>\n";
print " Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n";
print " Create headers for <NAME> with original headers in\n";
print " <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 " -module-fwd <PATH> Create fwd includes for module pri files in the given\n";
print " path (default: none)\n";
print " -cache-module-fwd Create a .qmake.cache file to cache the location of the\n";
print " fwd includes\n";
print " -developer-build Point libraries and binaries to a common directory for\n";
print " easy development\n";
print " -no-module-version-header\n";
print " Don't create module version header file\n";
print " -help This help\n";
@ -590,8 +598,14 @@ while ( @ARGV ) {
$arg eq "-relative" || $arg eq "-check-includes") {
$var = substr($arg, 1);
$val = "yes";
} elsif($arg eq "-no-module-fwd") {
$var = "no_module_fwd";
} elsif($arg eq "-module-fwd") {
$var = "module_fwd";
$val = shift @ARGV;
} elsif($arg eq "-cache-module-fwd") {
$var = "cache_module_fwd";
$val = "yes";
} elsif($arg eq "-developer-build") {
$var = "developer_build";
$val = "yes";
} elsif($arg eq "-no-module-version-header") {
$var = "no_module_version_header";
@ -700,8 +714,12 @@ while ( @ARGV ) {
} else {
die "The -qtdir option requires an argument";
}
} elsif ($var eq "no_module_fwd") {
$no_module_fwd = 1;
} elsif ($var eq "module_fwd") {
$module_fwd = $val;
} elsif ($var eq "cache_module_fwd") {
$cache_module_fwd = 1;
} elsif ($var eq "developer_build") {
$developer_build = 1;
} elsif ($var eq "no_module_version_header") {
$no_module_version_header = 1;
} elsif ($var eq "output") {
@ -1066,21 +1084,35 @@ foreach my $lib (@modules_to_sync) {
}
# create forwarding module pri in qtbase/mkspecs/modules
unless ($no_module_fwd) {
if ($module_fwd) {
my $modulepri = $modulepris{$lib};
if (-e $modulepri) {
my $modulepriname = basename($modulepri);
my $moduleprifwd = "$qtbasedir/mkspecs/modules/$modulepriname";
mkpath($module_fwd);
my $moduleprifwd = "$module_fwd/$modulepriname";
my $mod_base = $developer_build ? $basedir : $out_basedir;
my $mod_component_base = $developer_build ? $qtbasedir : $out_basedir;
open MODULE_PRI_FILE, ">$moduleprifwd" or die("Could not open $moduleprifwd for writing");
print MODULE_PRI_FILE "QT_MODULE_BASE = $basedir\n";
print MODULE_PRI_FILE "QT_MODULE_BIN_BASE = $qtbasedir/bin\n";
print MODULE_PRI_FILE "QT_MODULE_BASE = $mod_base\n";
print MODULE_PRI_FILE "QT_MODULE_BIN_BASE = $mod_component_base/bin\n";
print MODULE_PRI_FILE "QT_MODULE_INCLUDE_BASE = $out_basedir/include\n";
print MODULE_PRI_FILE "QT_MODULE_IMPORT_BASE = $qtbasedir/imports\n";
print MODULE_PRI_FILE "QT_MODULE_LIB_BASE = $qtbasedir/lib\n";
print MODULE_PRI_FILE "QT_MODULE_PLUGIN_BASE = $qtbasedir/plugins\n";
print MODULE_PRI_FILE "QT_MODULE_IMPORT_BASE = $mod_component_base/imports\n";
print MODULE_PRI_FILE "QT_MODULE_LIB_BASE = $mod_component_base/lib\n";
print MODULE_PRI_FILE "QT_MODULE_PLUGIN_BASE = $mod_component_base/plugins\n";
print MODULE_PRI_FILE "include($modulepri)\n";
close MODULE_PRI_FILE;
utime(time, (stat($modulepri))[9], $moduleprifwd);
if ($cache_module_fwd) {
my $cacheStatement = "QMAKE_EXTRA_MODULE_FORWARDS = \"$module_fwd\"";
my $cacheFile = "$out_basedir/.qmake.cache";
my $existingQmakeCache = fileContents($cacheFile);
# Skip if it's already there.
if ($existingQmakeCache !~ $cacheStatement) {
open QMAKE_CACHE_FILE, ">>$cacheFile" or die("Could not open $cacheFile for writing");
print QMAKE_CACHE_FILE "$cacheStatement\n";
close(QMAKE_CACHE_FILE);
}
}
} elsif ($modulepri) {
print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating forwarding pri for $lib.\n";
}

View File

@ -14,8 +14,12 @@ exists($$_PRO_FILE_PWD_/sync.profile) {
isEmpty(QTDIR):QTDIR = $$QT_BUILD_TREE
}
isEmpty(QTDIR):QTFWD="-no-module-fwd"
else:QTFWD="-qtdir $$QTDIR"
QTFWD =
isEmpty(QTDIR) {
QTFWD += -module-fwd $$OUT_PWD/module-paths/modules -cache-module-fwd
} else {
QTFWD += -qtdir $$QTDIR -module-fwd $$QTDIR/mkspecs/modules -developer-build
}
message("Running syncqt for $$PRO_BASENAME in $$OUT_PWD")
qtPrepareTool(QMAKE_SYNCQT, syncqt)

View File

@ -14,12 +14,12 @@ isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) {
debug(1, "Cannot load qconfig.pri!")
} else {
debug(1, "Loaded .qconfig.pri from ($$QMAKE_QT_CONFIG)")
for(dir, $$list($$unique($$list($$dirname(QMAKE_QT_CONFIG) \
$$replace($$list($$split($$list($$(QMAKEPATH)), $$DIRLIST_SEPARATOR)), $, /mkspecs) \
$$QMAKE_EXTRA_MODULE_FORWARDS \
)))) {
for(dir, $$list($$unique($$list($$replace($$list($$dirname(QMAKE_QT_CONFIG) \
$$replace($$list($$split($$list($$(QMAKEPATH)), $$DIRLIST_SEPARATOR)), $, /mkspecs)), \
$, /modules) \
$$QMAKE_EXTRA_MODULE_FORWARDS)))) {
debug(1, "Loading modules from $${dir}")
for(mod, $$list($$files($$dir/modules/qt_*.pri))) {
for(mod, $$list($$files($$dir/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