Skip to content

Commit

Permalink
move module version header generation back to syncqt
Browse files Browse the repository at this point in the history
there is no particular reason for it being done by qmake.
avoids that the logic is distributed over two source files,
and allows us to generate these headers at pre-build time already,
including not forwarding to a yet unexisting file (which would have a
yet unknown location).

Change-Id: I9c78ab425cf6f01d076c86fd1ee602626f231487
Reviewed-by: Joerg Bornemann <[email protected]>
  • Loading branch information
ossilator authored and The Qt Project committed Jun 3, 2013
1 parent 5c555e3 commit 5d8b8ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 29 deletions.
13 changes: 13 additions & 0 deletions bin/syncqt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,19 @@ sub isQpaHeader
syncHeader($lib, $VHeader, $vheader, 0);
$pri_install_files .= fixPaths($vheader, $dir) . " ";
$pri_install_classes .= fixPaths($VHeader, $dir) . " ";
my @versions = split(/\./, $module_version);
my $modulehexstring = sprintf("0x%02X%02X%02X", $versions[0], $versions[1], $versions[2]);
my $vhdrcont =
"/* This file was generated by syncqt. */\n".
"#ifndef QT_".uc($lib)."_VERSION_H\n".
"#define QT_".uc($lib)."_VERSION_H\n".
"\n".
"#define ".uc($lib)."_VERSION_STR \"".$module_version."\"\n".
"\n".
"#define ".uc($lib)."_VERSION ".$modulehexstring."\n".
"\n".
"#endif // QT_".uc($lib)."_VERSION_H\n";
writeFile($vheader, $vhdrcont, $lib, "version header");

#handle the headers.pri for each module
my $headers_pri_contents = "";
Expand Down
29 changes: 0 additions & 29 deletions mkspecs/features/qt_module_headers.prf
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ minimal_syncqt: return()
#load up the headers info
include($$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/headers.pri, "", true)

lctarget = $$lower($$MODULE_INCNAME)
uctarget = $$upper($$MODULE_INCNAME)

defineTest(shouldMasterInclude) {
bn = $$basename(1)
contains(bn, .*_.*):return(false)
Expand All @@ -46,32 +43,6 @@ defineTest(shouldMasterInclude) {
autogen_warning = \
"/* This file was generated by qmake with the info from <root>/$$relative_path($$_PRO_FILE_, $$MODULE_BASE_DIR). */"

# Create module version header
MODULE_VERSION_HEADER = $$find(SYNCQT.HEADER_FILES, (^|/)$${lctarget}version\\.h$)
count(MODULE_VERSION_HEADER, 1) {
MODULE_VERSION_HEADER = $$absolute_path($$MODULE_VERSION_HEADER, $$_PRO_FILE_PWD_)

!build_pass {
majorhexstr = $$format_number($$section(VERSION, ., 0, 0), width=2 zeropad obase=16)
minorhexstr = $$format_number($$section(VERSION, ., 1, 1), width=2 zeropad obase=16)
patchhexstr = $$format_number($$section(VERSION, ., 2, 2), width=2 zeropad obase=16)
modulehexstring = 0x$${majorhexstr}$${minorhexstr}$${patchhexstr}
MODULE_VERSION_HEADER_CONT = \
$$autogen_warning \
"$${LITERAL_HASH}ifndef QT_$${uctarget}_VERSION_H" \
"$${LITERAL_HASH}define QT_$${uctarget}_VERSION_H" \
"" \
"$${LITERAL_HASH}define $${uctarget}_VERSION_STR \"$$VERSION\"" \
"" \
"$${LITERAL_HASH}define $${uctarget}_VERSION $$modulehexstring" \
"" \
"$${LITERAL_HASH}endif // QT_$${uctarget}_VERSION_H"
write_file($$MODULE_VERSION_HEADER, MODULE_VERSION_HEADER_CONT)|error("Aborting.")
}

HEADERS += $$MODULE_VERSION_HEADER
}

# Create a module master header
MODULE_MASTER_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$$MODULE_INCNAME
!build_pass {
Expand Down

0 comments on commit 5d8b8ee

Please sign in to comment.