Skip to content

Commit

Permalink
move module master header generation back to syncqt
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ossilator authored and The Qt Project committed Jun 3, 2013
1 parent 0519129 commit 96557bc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 25 deletions.
42 changes: 42 additions & 0 deletions bin/syncqt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,30 @@ sub checkRelative {
return 1;
}

######################################################################
# 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"
Expand Down Expand Up @@ -828,6 +852,12 @@ sub isQpaHeader
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 = ();
Expand Down Expand Up @@ -960,6 +990,9 @@ sub isQpaHeader
}

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);
Expand Down Expand Up @@ -1018,6 +1051,11 @@ sub isQpaHeader
}
}

# close the master include:
$master_contents .=
"#include \"".lc($lib)."version.h\"\n" .
"#endif\n";

unless ($showonly || $minimal) {
# create deprecated headers
my $first = 1;
Expand Down Expand Up @@ -1100,6 +1138,10 @@ sub isQpaHeader
"#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";
Expand Down
25 changes: 0 additions & 25 deletions mkspecs/features/qt_module_headers.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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). */"

Expand All @@ -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

0 comments on commit 96557bc

Please sign in to comment.