From 2b467e8ea7b1250bd80cbc791084bb87b0ef3336 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 26 Jul 2017 12:44:52 +0200 Subject: [PATCH] Fix compilation breakage with mingw / windres The replacement of string defines in the .rc file that was introduced in commit b5703bcd029fd does not work with windres. Here the string literals have to be explicitly quoted by STRINGIFY. Also, we need to replace literal spaces with \x20. Task-number: QTCREATORBUG-18635 Change-Id: Ie01886ea680c3c07c4e0a031f12b6fe60e896263 Reviewed-by: Oswald Buddenhagen Reviewed-by: Christian Kandeler --- src/app/app.pro | 6 ++++-- src/app/app.qbs | 6 ++++-- src/app/qtcreator.rc | 9 ++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/app/app.pro b/src/app/app.pro index 1414e7d7fca..ed2de942343 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -23,9 +23,11 @@ win32 { # We need the version in two separate formats for the .rc file # RC_VERSION=4,3,82,0 (quadruple) # RC_VERSION_STRING="4.4.0-beta1" (free text) + # Also, we need to replace space with \x20 to be able to work with both rc and windres + COPYRIGHT = "2008-$${QTCREATOR_COPYRIGHT_YEAR} The Qt Company Ltd" DEFINES += RC_VERSION=$$replace(QTCREATOR_VERSION, "\\.", ","),0 \ - RC_VERSION_STRING=\\\"$${QTCREATOR_DISPLAY_VERSION}\\\" \ - RC_COPYRIGHT='"\\\"2008-$${QTCREATOR_COPYRIGHT_YEAR} The Qt Company Ltd\\\""' + RC_VERSION_STRING=\"$${QTCREATOR_DISPLAY_VERSION}\" \ + RC_COPYRIGHT=\"$$replace(COPYRIGHT, " ", "\\x20")\" RC_FILE = qtcreator.rc } else:macx { LIBS += -framework CoreFoundation diff --git a/src/app/app.qbs b/src/app/app.qbs index b3023fcbe74..b67ff28a2c4 100644 --- a/src/app/app.qbs +++ b/src/app/app.qbs @@ -54,9 +54,11 @@ QtcProduct { // We need the version in two separate formats for the .rc file // RC_VERSION=4,3,82,0 (quadruple) // RC_VERSION_STRING="4.4.0-beta1" (free text) + // Also, we need to replace space with \x20 to be able to work with both rc and windres cpp.defines: outer.concat(["RC_VERSION=" + qtc.qtcreator_version.replace(/\./g, ",") + ",0", - "RC_VERSION_STRING=\"" + qtc.qtcreator_display_version + "\"", - "RC_COPYRIGHT=\"2008-" + qtc.qtcreator_copyright_year + " The Qt Company Ltd\""]) + "RC_VERSION_STRING=" + qtc.qtcreator_display_version, + "RC_COPYRIGHT=2008-" + qtc.qtcreator_copyright_year + + " The Qt Company Ltd".replace(/ /g, "\\x20")]) files: "qtcreator.rc" } diff --git a/src/app/qtcreator.rc b/src/app/qtcreator.rc index 89f03c4708c..bcc6e7f8ab8 100644 --- a/src/app/qtcreator.rc +++ b/src/app/qtcreator.rc @@ -1,5 +1,8 @@ #include +#define STRINGIFY1(x) #x +#define STRINGIFY(x) STRINGIFY1(x) + IDI_ICON1 ICON DISCARDABLE "qtcreator.ico" IDI_ICON2 ICON DISCARDABLE "winicons/c.ico" IDI_ICON3 ICON DISCARDABLE "winicons/cpp.ico" @@ -19,10 +22,10 @@ VS_VERSION_INFO VERSIONINFO BLOCK "040904E4" { VALUE "FileDescription", "Qt Creator" - VALUE "FileVersion", RC_VERSION_STRING + VALUE "FileVersion", STRINGIFY(RC_VERSION_STRING) VALUE "ProductName", "Qt Creator" - VALUE "ProductVersion", RC_VERSION_STRING - VALUE "LegalCopyright", RC_COPYRIGHT + VALUE "ProductVersion", STRINGIFY(RC_VERSION_STRING) + VALUE "LegalCopyright", STRINGIFY(RC_COPYRIGHT) } } BLOCK "VarFileInfo"