Allow to check for IFW version in code

Rename the IFW_VERSION to IFW_VERSION_STR, and add a new IFW_VERSION
define that encodes the version in hex. This follows the pattern of
QT_VERSION and QT_VERSION_STR, and allows easy checking of the IFW
version e.g. in macros.

Change-Id: I232c8aa53c9a04522810208cdd1ac595d8676879
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
This commit is contained in:
Kai Koehne 2014-11-11 16:44:55 +01:00
parent 26e4af07b1
commit c8ed41495f
4 changed files with 9 additions and 7 deletions

View File

@ -3,14 +3,14 @@
QDOC_BIN = $$[QT_INSTALL_BINS]/qdoc QDOC_BIN = $$[QT_INSTALL_BINS]/qdoc
win32:QDOC_BIN = $$replace(QDOC_BIN, "/", "\\") win32:QDOC_BIN = $$replace(QDOC_BIN, "/", "\\")
IFW_VERSION_TAG = $$replace(IFW_VERSION, "[-.]", ) IFW_VERSION_TAG = $$replace(IFW_VERSION_STR, "[-.]", )
defineReplace(cmdEnv) { defineReplace(cmdEnv) {
!equals(QMAKE_DIR_SEP, /): 1 ~= s,^(.*)$,(set \\1) &&,g !equals(QMAKE_DIR_SEP, /): 1 ~= s,^(.*)$,(set \\1) &&,g
return("$$1") return("$$1")
} }
QDOC = $$cmdEnv(SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html IFW_VERSION=$$IFW_VERSION IFW_VERSION_TAG=$$IFW_VERSION_TAG QT_INSTALL_DOCS=$$[QT_INSTALL_DOCS]) $$QDOC_BIN QDOC = $$cmdEnv(SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html IFW_VERSION=$$IFW_VERSION_STR IFW_VERSION_TAG=$$IFW_VERSION_TAG QT_INSTALL_DOCS=$$[QT_INSTALL_DOCS]) $$QDOC_BIN
unix { unix {
HELPGENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator HELPGENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator

View File

@ -3,7 +3,8 @@
} }
IFW_PRI_INCLUDED = 1 IFW_PRI_INCLUDED = 1
IFW_VERSION = 1.6.81 IFW_VERSION_STR = 1.6.81
IFW_VERSION = 0x010681
IFW_REPOSITORY_FORMAT_VERSION = 1.0.0 IFW_REPOSITORY_FORMAT_VERSION = 1.0.0
IFW_NEWLINE = $$escape_expand(\\n\\t) IFW_NEWLINE = $$escape_expand(\\n\\t)
@ -111,7 +112,8 @@ CONFIG(static, static|shared) {
CONFIG += depend_includepath no_private_qt_headers_warning c++11 CONFIG += depend_includepath no_private_qt_headers_warning c++11
GIT_SHA1 = $$system(git rev-list --abbrev-commit -n1 HEAD) GIT_SHA1 = $$system(git rev-list --abbrev-commit -n1 HEAD)
DEFINES += QT_NO_CAST_FROM_ASCII QT_USE_QSTRINGBUILDER "_GIT_SHA1_=$$GIT_SHA1" IFW_VERSION=$$IFW_VERSION DEFINES += QT_NO_CAST_FROM_ASCII QT_USE_QSTRINGBUILDER "_GIT_SHA1_=$$GIT_SHA1" \
IFW_VERSION_STR=$$IFW_VERSION_STR IFW_VERSION=$$IFW_VERSION
DEFINES += IFW_REPOSITORY_FORMAT_VERSION=$$IFW_REPOSITORY_FORMAT_VERSION DEFINES += IFW_REPOSITORY_FORMAT_VERSION=$$IFW_REPOSITORY_FORMAT_VERSION
static { static {

View File

@ -53,7 +53,7 @@
#define QUOTE_(x) #x #define QUOTE_(x) #x
#define QUOTE(x) QUOTE_(x) #define QUOTE(x) QUOTE_(x)
#define VERSION "IFW Version: \"" QUOTE(IFW_VERSION) "\"" #define VERSION "IFW Version: \"" QUOTE(IFW_VERSION_STR) "\""
#define BUILDDATE "Build date: " QUOTE(__DATE__) #define BUILDDATE "Build date: " QUOTE(__DATE__)
#define SHA "Installer Framework SHA1: \"" QUOTE(_GIT_SHA1_) "\"" #define SHA "Installer Framework SHA1: \"" QUOTE(_GIT_SHA1_) "\""
static const char PLACEHOLDER[32] = "MY_InstallerCreateDateTime_MY"; static const char PLACEHOLDER[32] = "MY_InstallerCreateDateTime_MY";
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
} }
if (parser.isSet(QLatin1String(CommandLineOptions::FrameworkVersion))) { if (parser.isSet(QLatin1String(CommandLineOptions::FrameworkVersion))) {
std::cout << QUOTE(IFW_VERSION) << std::endl; std::cout << QUOTE(IFW_VERSION_STR) << std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -172,7 +172,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
plistStream << QLatin1String(" <key>CFBundleGetInfoString</key>") << endl; plistStream << QLatin1String(" <key>CFBundleGetInfoString</key>") << endl;
#define QUOTE_(x) #x #define QUOTE_(x) #x
#define QUOTE(x) QUOTE_(x) #define QUOTE(x) QUOTE_(x)
plistStream << QLatin1String(" <string>") << QLatin1String(QUOTE(IFW_VERSION)) << ("</string>") plistStream << QLatin1String(" <string>") << QLatin1String(QUOTE(IFW_VERSION_STR)) << ("</string>")
<< endl; << endl;
#undef QUOTE #undef QUOTE
#undef QUOTE_ #undef QUOTE_