From 0e6be2aa5dcddbab4e13e55e7f84a1099972f194 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 18 May 2011 15:23:51 +0200 Subject: 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 Reviewed-by: Marius Storm-Olsen --- bin/syncqt | 62 +++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 15 deletions(-) (limited to 'bin/syncqt') diff --git a/bin/syncqt b/bin/syncqt index dbdac4d157..a955456fec 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -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" ); @@ -72,12 +74,18 @@ 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 Specify output directory for sync (default: $out_basedir)\n"; - print " -qtdir Set the path to QtBase (detected: " . (defined $qtbasedir ? $qtbasedir : "-none-") . ")\n"; + print " -qtdir 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 ::\n"; - print " Create headers for with original headers in relative to \n"; + print " Create headers for with original headers in\n"; + print " relative to \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 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"; } -- cgit v1.2.3