From f095ff85c5c3798161146244e2d5ed8f4724145c Mon Sep 17 00:00:00 2001
From: Oliver Wolff <oliver.wolff@qt.io>
Date: Wed, 18 May 2016 14:20:23 +0200
Subject: [PATCH] qmake: Introduce CE_PLATFORMNAME to fix creation of vcxproj
 files

While previous SDKs used the form "CE_SDK (CE_ARCH)" in their
configuration/platform names, this is not true fo the Toradex SDK.
Inside Visual Studio the platform is only called "Toradex_CE800"
instead of "Toradex_CE800 (ARMV7)".

In order not to break other SDKs CE_PLATFORMNAME is introduced and
used in the wince80colibri-armv7-msvc2012 mkspec. If the variable
is set qmake uses it as the platform name in its vcproj generator.

Change-Id: Icb501bf6446a9f617745a0d2c7a80b240680b043
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
---
 mkspecs/wince80colibri-armv7-msvc2012/qmake.conf | 1 +
 qmake/generators/win32/msvc_vcproj.cpp           | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
index 3712c947785..7af1ca828ef 100644
--- a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
+++ b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
@@ -7,6 +7,7 @@ include(../common/wince/qmake.conf)
 
 CE_SDK                  = Toradex_CE800   # replace with actual SDK name
 CE_ARCH                 = ARMV7
+CE_PLATFORMNAME         = Toradex_CE800
 QT_CONFIG              -= accessibility
 
 DEFINES                += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM QT_NO_WINCE_SHELLSDK QT_NO_WINCE_NUIOUSER
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 1d4f722e51e..d1fa6efbfbe 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -707,6 +707,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
     QString slnConf = _slnSolutionConf;
     if (!project->isEmpty("VCPROJ_ARCH")) {
         slnConf.replace(QLatin1String("|Win32"), "|" + project->first("VCPROJ_ARCH"));
+    } else if (!project->isEmpty("CE_PLATFORMNAME")) {
+        slnConf.replace(QLatin1String("|Win32"), "|" + project->first("CE_PLATFORMNAME"));
     } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) {
         QString slnPlatform = QString("|") + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
         slnConf.replace(QLatin1String("|Win32"), slnPlatform);
@@ -724,6 +726,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
         QString xplatform = platform;
         if (!project->isEmpty("VCPROJ_ARCH")) {
             xplatform = project->first("VCPROJ_ARCH").toQString();
+        } else if (!project->isEmpty("CE_PLATFORMNAME")) {
+            xplatform = project->first("CE_PLATFORMNAME").toQString();
         } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) {
             xplatform = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
         }
@@ -985,6 +989,8 @@ void VcprojGenerator::initProject()
     vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString();
     if (!project->isEmpty("VCPROJ_ARCH")) {
         vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString();
+    } else if (!project->isEmpty("CE_PLATFORMNAME")) {
+        vcProject.PlatformName = project->first("CE_PLATFORMNAME").toQString();
     } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
         vcProject.PlatformName = (is64Bit ? "x64" : "Win32");
     } else {
@@ -1069,6 +1075,8 @@ void VcprojGenerator::initConfiguration()
     conf.ConfigurationName = conf.Name;
     if (!project->isEmpty("VCPROJ_ARCH")) {
         conf.Name += "|" + project->first("VCPROJ_ARCH");
+    } else if (!project->isEmpty("CE_PLATFORMNAME")) {
+        conf.Name += "|" + project->first("CE_PLATFORMNAME");
     } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
         conf.Name += (is64Bit ? "|x64" : "|Win32");
     } else {
-- 
GitLab