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>
This commit is contained in:
parent
0519129c59
commit
96557bc389
@ -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"
|
||||
@ -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";
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user