Skip to content

Commit

Permalink
rework syncqt interaction regarding cross-tree paths
Browse files Browse the repository at this point in the history
instead of relying on more or less accidental qmake behaviors regarding
the base dir for relative paths (esp. if a file does not exist yet),
make everything explicit. to that effect, clearly define the base tree
(source or build) for every syncqt-generated variable, and write only
in-tree relative paths to the variables. on the receiving end, resolve
the paths as soon as headers.pri was read.

Task-number: QTBUG-67111
Change-Id: I32ae5760fb62ebc650fdb69e46aac786a8141564
Reviewed-by: Lars Knoll <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
ossilator committed Apr 12, 2018
1 parent 1a71fe0 commit 9c4c136
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
17 changes: 8 additions & 9 deletions bin/syncqt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ ($$)
$allheadersprivate = 1 if $allmoduleheadersprivate{$lib};

#information used after the syncing
my $pri_install_classes = "";
my $pri_install_gfiles = "";
my $pri_install_files = "";
my $pri_install_ifiles = "";
my $pri_install_pfiles = "";
Expand Down Expand Up @@ -1086,9 +1086,9 @@ ($$)
# if ($class =~ m/::/) {
# $class =~ s,::,/,g;
# }
my $class_header = fixPaths("$out_basedir/include/$lib/$class", $dir) . " ";
$pri_install_classes .= $class_header
unless($pri_install_classes =~ $class_header);
my $class_header = "$class ";
$pri_install_gfiles .= $class_header
unless($pri_install_gfiles =~ $class_header);
$injection .= ":$class";
}

Expand Down Expand Up @@ -1198,7 +1198,7 @@ ($$)
}
}

$pri_install_files .= fixPaths($header_path, $dir) . " ";
$pri_install_gfiles .= "$header ";
}
if ($verbose_level < 3) {
print " }\n" unless ($first);
Expand All @@ -1208,8 +1208,7 @@ ($$)
my $vheader = "$out_basedir/include/$lib/".lc($lib)."version.h";
my $VHeader = "$out_basedir/include/$lib/${lib}Version";
syncHeader($lib, $VHeader, $vheader, 0);
$pri_install_files .= fixPaths($vheader, $dir) . " ";
$pri_install_classes .= fixPaths($VHeader, $dir) . " ";
$pri_install_gfiles .= lc($lib)."version.h ${lib}Version ";
my @versions = split(/\./, $module_version);
my $modulehexstring = sprintf("0x%02X%02X%02X", $versions[0], $versions[1], $versions[2]);
my $vhdrcont =
Expand All @@ -1225,7 +1224,7 @@ ($$)
writeFile($vheader, $vhdrcont, $lib, "version header");

my $master_include = "$out_basedir/include/$lib/$lib";
$pri_install_files .= fixPaths($master_include, $dir) . " ";
$pri_install_gfiles .= "$lib ";
writeFile($master_include, $master_contents, $lib, "master header");
}

Expand All @@ -1234,7 +1233,7 @@ ($$)
my $headers_pri_contents = "";
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
$headers_pri_contents .= "SYNCQT.INJECTED_HEADER_FILES = $pri_install_ifiles\n";
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
$headers_pri_contents .= "SYNCQT.GENERATED_HEADER_FILES = $pri_install_gfiles\n";
$headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
$headers_pri_contents .= "SYNCQT.INJECTED_PRIVATE_HEADER_FILES = $pri_install_ipfiles\n";
$headers_pri_contents .= "SYNCQT.QPA_HEADER_FILES = $pri_install_qpafiles\n";
Expand Down
6 changes: 3 additions & 3 deletions mkspecs/features/qt_installs.prf
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

#headers
qt_install_headers {
class_headers.files = $$SYNCQT.HEADER_CLASSES
class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
INSTALLS += class_headers
gen_headers.files = $$SYNCQT.GENERATED_HEADER_FILES
gen_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
INSTALLS += gen_headers

targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_HEADER_FILES
targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
Expand Down
7 changes: 3 additions & 4 deletions mkspecs/features/qt_module.prf
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ lib_bundle {
if(if(!debug_and_release|CONFIG(release, debug|release))) {
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = \
$$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES $$SYNCQT.INJECTED_HEADER_FILES
$$SYNCQT.HEADER_FILES $$SYNCQT.GENERATED_HEADER_FILES $$SYNCQT.INJECTED_HEADER_FILES
FRAMEWORK_HEADERS.path = Headers
FRAMEWORK_PRIVATE_HEADERS.version = Versions
FRAMEWORK_PRIVATE_HEADERS.files = \
Expand Down Expand Up @@ -224,7 +224,7 @@ android: CONFIG += qt_android_deps no_linker_version_script
private_api_headers = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.QPA_HEADER_FILES

for(header, private_api_headers): \
verscript_content += " @FILE:$${_PRO_FILE_PWD_}/$$header@"
verscript_content += " @FILE:$$header@"
verscript_content += "};"

current = Qt_$$QT_MAJOR_VERSION
Expand All @@ -244,8 +244,7 @@ android: CONFIG += qt_android_deps no_linker_version_script
verscriptprocess.name = linker version script ${QMAKE_FILE_BASE}
verscriptprocess.input = verscript_in
verscriptprocess.CONFIG += no_link target_predeps
for(header, private_api_headers): \
verscriptprocess.depends += $${_PRO_FILE_PWD_}/$$header
verscriptprocess.depends = $$private_api_headers
verscriptprocess.output = $$verscript
verscriptprocess.commands = perl $${PWD}/data/unix/findclasslist.pl < ${QMAKE_FILE_IN} > $@
silent:verscriptprocess.commands = @echo creating linker version script ${QMAKE_FILE_BASE} && $$verscriptprocess.commands
Expand Down
19 changes: 16 additions & 3 deletions mkspecs/features/qt_module_headers.prf
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,26 @@ MODULE_PRIVATE_INCLUDES += $$MODULE_PRIVATE_AUX_INCLUDES

minimal_syncqt: return()

defineTest(syncQtResolve) {
out =
for (f, SYNCQT.$$1): \
out += $$absolute_path($$f, $$2)
SYNCQT.$$1 = $$out
export(SYNCQT.$$1)
}

#load up the headers info
git_build: \
INC_PATH = $$MODULE_BASE_OUTDIR
else: \
INC_PATH = $$MODULE_BASE_INDIR
include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true)
syncQtResolve(HEADER_FILES, $$_PRO_FILE_PWD_)
syncQtResolve(PRIVATE_HEADER_FILES, $$_PRO_FILE_PWD_)
syncQtResolve(QPA_HEADER_FILES, $$_PRO_FILE_PWD_)
syncQtResolve(GENERATED_HEADER_FILES, $$INC_PATH/include/$$MODULE_INCNAME)
syncQtResolve(INJECTED_HEADER_FILES, $$OUT_PWD)
syncQtResolve(INJECTED_PRIVATE_HEADER_FILES, $$OUT_PWD)
!lib_bundle: \ # Headers are embedded into the bundle, so don't install them separately.
CONFIG += qt_install_headers

Expand All @@ -114,9 +128,8 @@ exists($$OUT_PWD/qt$${MODULE}-config.h) {
SYNCQT.INJECTIONS += \
$$fwd_rel/qt$${MODULE}-config.h:qt$${MODULE}-config.h \
$$fwd_rel/qt$${MODULE}-config_p.h:$$MODULE_VERSION/$$MODULE_INCNAME/private/qt$${MODULE}-config_p.h
inst_rel = $$relative_path($$OUT_PWD, $$_PRO_FILE_PWD_)
SYNCQT.HEADER_FILES += $$inst_rel/qt$${MODULE}-config.h
SYNCQT.INJECTED_PRIVATE_HEADER_FILES += $$inst_rel/qt$${MODULE}-config_p.h
SYNCQT.INJECTED_HEADER_FILES += $$OUT_PWD/qt$${MODULE}-config.h
SYNCQT.INJECTED_PRIVATE_HEADER_FILES += $$OUT_PWD/qt$${MODULE}-config_p.h
}

for (injection, SYNCQT.INJECTIONS) {
Expand Down

0 comments on commit 9c4c136

Please sign in to comment.