summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-05-28 20:57:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-03 17:59:42 +0200
commit96557bc389794abdcb15305c2a439f344ec2f0c3 (patch)
tree61adec31a54efc274ef5eb7e9e6290a6ee759361
parent0519129c5977280dfa2f8a47ca4aa93fe9fee84b (diff)
move module master header generation back to syncqt
now that we split out the part that depends on the project file, we can do it cleanly here. this way we can generate these headers at pre-build time already. and for git builds, perl is probably faster than qmake at this task. Change-Id: I343255c6de22329471a3ae2c2aac9ebeb160a501 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rwxr-xr-xbin/syncqt.pl42
-rw-r--r--mkspecs/features/qt_module_headers.prf25
2 files changed, 42 insertions, 25 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 1da3878695..497e8deb2c 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -172,6 +172,30 @@ sub checkRelative {
}
######################################################################
+# Syntax: shouldMasterInclude(iheader)
+# Params: iheader, string, filename to verify inclusion
+#
+# Purpose: Determines if header should be in the master include file.
+# Returns: 0 if file contains "#pragma qt_no_master_include" or not
+# able to open, else 1.
+######################################################################
+sub shouldMasterInclude {
+ my ($iheader) = @_;
+ return 0 if (basename($iheader) =~ /_/);
+ return 0 if (basename($iheader) =~ /qconfig/);
+ if (open(F, "<$iheader")) {
+ while (<F>) {
+ chomp;
+ return 0 if (/^\#pragma qt_no_master_include$/);
+ }
+ close(F);
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+######################################################################
# Syntax: classNames(iheader)
# Params: iheader, string, filename to parse for classname "symlinks"
#
@@ -828,6 +852,12 @@ foreach my $lib (@modules_to_sync) {
my $pri_install_pfiles = "";
my $pri_install_qpafiles = "";
+ my $libcapitals = uc($lib);
+ my $master_contents =
+ "#ifndef QT_".$libcapitals."_MODULE_H\n" .
+ "#define QT_".$libcapitals."_MODULE_H\n" .
+ "#include <$lib/${lib}Depends>\n";
+
#remove the old files
if($remove_stale) {
my %injections = ();
@@ -960,6 +990,9 @@ foreach my $lib (@modules_to_sync) {
}
if($public_header) {
+ #put it into the master file
+ $master_contents .= "#include \"$public_header\"\n" if (shouldMasterInclude($iheader));
+
#deal with the install directives
if($public_header) {
my $pri_install_iheader = fixPaths($iheader, $dir);
@@ -1018,6 +1051,11 @@ foreach my $lib (@modules_to_sync) {
}
}
+ # close the master include:
+ $master_contents .=
+ "#include \"".lc($lib)."version.h\"\n" .
+ "#endif\n";
+
unless ($showonly || $minimal) {
# create deprecated headers
my $first = 1;
@@ -1100,6 +1138,10 @@ foreach my $lib (@modules_to_sync) {
"#endif // QT_".uc($lib)."_VERSION_H\n";
writeFile($vheader, $vhdrcont, $lib, "version header");
+ my $master_include = "$out_basedir/include/$lib/$lib";
+ $pri_install_files .= fixPaths($master_include, $dir) . " ";
+ writeFile($master_include, $master_contents, $lib, "master header");
+
#handle the headers.pri for each module
my $headers_pri_contents = "";
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf
index 65e9a888f3..7591bffb19 100644
--- a/mkspecs/features/qt_module_headers.prf
+++ b/mkspecs/features/qt_module_headers.prf
@@ -31,15 +31,6 @@ minimal_syncqt: return()
#load up the headers info
include($$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/headers.pri, "", true)
-defineTest(shouldMasterInclude) {
- bn = $$basename(1)
- contains(bn, .*_.*):return(false)
- contains(bn, ^qconfig.*):return(false)
- lines = $$cat($$_PRO_FILE_PWD_/$$1, lines)
- contains(lines, $${LITERAL_HASH}pragma qt_no_master_include):return(false)
- return(true)
-}
-
autogen_warning = \
"/* This file was generated by qmake with the info from <root>/$$relative_path($$_PRO_FILE_, $$MODULE_BASE_DIR). */"
@@ -55,20 +46,4 @@ MODULE_MASTER_DEPS_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$${MOD
}
SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER
-# Create a module master header
-MODULE_MASTER_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$$MODULE_INCNAME
-!build_pass {
- MODULE_MASTER_HEADER_CONT = \
- $$autogen_warning \
- "$${LITERAL_HASH}ifndef QT_$${ucmodule}_MODULE_H" \
- "$${LITERAL_HASH}define QT_$${ucmodule}_MODULE_H" \
- "$${LITERAL_HASH}include <$$MODULE_INCNAME/$${MODULE_INCNAME}Depends>"
- for(hdr, SYNCQT.HEADER_FILES): \
- shouldMasterInclude($$hdr): \
- MODULE_MASTER_HEADER_CONT += "$${LITERAL_HASH}include \"$$replace(hdr, .*/, )\""
- MODULE_MASTER_HEADER_CONT += "$${LITERAL_HASH}endif"
- write_file($$MODULE_MASTER_HEADER, MODULE_MASTER_HEADER_CONT)|error("Aborting.")
-}
-SYNCQT.HEADER_FILES += $$MODULE_MASTER_HEADER
-
CONFIG += qt_install_headers