Squish: Fix windows toolchain for VS15

Similar to what has been done for fixing VS2017. But VS2015 also needs
to add a matching Windows Kit tools path.
This magically happens if the kit is set up manually, but as we
provide a stripped version of toolchains and kits we need to adjust the
kit environment manually.

Change-Id: I9a88e7424acf2768774f5ef580ef6d1fa73bcb5a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2022-05-25 10:51:44 +02:00
parent f3cbd506dd
commit ca030b5a9a
3 changed files with 50 additions and 10 deletions

View File

@@ -68,7 +68,9 @@
<value type="QString" key="Debugger.Information">{1b25f20a-d584-4fb7-85b3-74dd15b82f6f}</value>
<value type="QString" key="PE.Profile.Device">Desktop Device</value>
<value type="QByteArray" key="PE.Profile.DeviceType">Desktop</value>
<valuelist type="QVariantList" key="PE.Profile.Environment"/>
<valuelist type="QVariantList" key="PE.Profile.Environment">
<value type="QString">SQUISH_ENV_MODIFICATION</value>
</valuelist>
<value type="QString" key="PE.Profile.SysRoot"></value>
<valuemap type="QVariantMap" key="PE.Profile.ToolChainsV3">
<value type="QByteArray" key="C">{c96cfaf3-fb8a-472b-b3c7-e94e8c490f17}</value>

View File

@@ -44,7 +44,7 @@
<valuelist type="QVariantList">
<value type="QString">PATH</value>
<value type="int">0</value>
<value type="QString">SQUISH_MSVC2017_PATH</value>
<value type="QString">SQUISH_MSVC2017_64_PATH</value>
</valuelist>
</valuelist>
<value type="QString" key="ProjectExplorer.ToolChain.DisplayName">MSVC2017 (amd64)</value>
@@ -59,6 +59,13 @@
<value type="QString" key="ProjectExplorer.MsvcToolChain.SupportedAbi">x86-windows-msvc2015-pe-32bit</value>
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBat">C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat</value>
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBatArg">x86</value>
<valuelist type="QVariantList" key="ProjectExplorer.MsvcToolChain.environmentModifications">
<valuelist type="QVariantList">
<value type="QString">PATH</value>
<value type="int">0</value>
<value type="QString">SQUISH_MSVC2017_32_PATH</value>
</valuelist>
</valuelist>
<value type="bool" key="ProjectExplorer.ToolChain.Autodetect">true</value>
<value type="QString" key="ProjectExplorer.ToolChain.DisplayName">Microsoft Visual C++ Compiler 14.0 (x86)</value>
<value type="QString" key="ProjectExplorer.ToolChain.Id">ProjectExplorer.ToolChain.Msvc:{c96cfaf3-fb8a-472b-b3c7-e94e8c490f17}</value>
@@ -72,6 +79,13 @@
<value type="QString" key="ProjectExplorer.MsvcToolChain.SupportedAbi">x86-windows-msvc2015-pe-32bit</value>
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBat">C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat</value>
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBatArg">x86</value>
<valuelist type="QVariantList" key="ProjectExplorer.MsvcToolChain.environmentModifications">
<valuelist type="QVariantList">
<value type="QString">PATH</value>
<value type="int">0</value>
<value type="QString">SQUISH_MSVC2017_32_PATH</value>
</valuelist>
</valuelist>
<value type="bool" key="ProjectExplorer.ToolChain.Autodetect">true</value>
<value type="QString" key="ProjectExplorer.ToolChain.DisplayName">Microsoft Visual C++ Compiler 14.0 (x86)</value>
<value type="QString" key="ProjectExplorer.ToolChain.Id">ProjectExplorer.ToolChain.Msvc:{ed856706-2a9d-4745-9d85-4e322b6f91d4}</value>
@@ -89,7 +103,7 @@
<valuelist type="QVariantList">
<value type="QString">PATH</value>
<value type="int">0</value>
<value type="QString">SQUISH_MSVC2017_PATH</value>
<value type="QString">SQUISH_MSVC2017_64_PATH</value>
</valuelist>
</valuelist>
<value type="QString" key="ProjectExplorer.ToolChain.DisplayName">MSVC2017 (amd64)</value>
@@ -108,7 +122,7 @@
<valuelist type="QVariantList">
<value type="QString">PATH</value>
<value type="int">0</value>
<value type="QString">SQUISH_MSVC2019_PATH</value>
<value type="QString">SQUISH_MSVC2019_64_PATH</value>
</valuelist>
</valuelist>
<value type="QString" key="ProjectExplorer.ToolChain.DisplayName">MSVC2019 (amd64)</value>
@@ -127,7 +141,7 @@
<valuelist type="QVariantList">
<value type="QString">PATH</value>
<value type="int">0</value>
<value type="QString">SQUISH_MSVC2019_PATH</value>
<value type="QString">SQUISH_MSVC2019_64_PATH</value>
</valuelist>
</valuelist>
<value type="QString" key="ProjectExplorer.ToolChain.DisplayName">MSVC2019 (amd64)</value>

View File

@@ -237,18 +237,20 @@ def substituteCdb(settingsDir):
test.log("Injected architecture '%s' and bitness '%s' in cdb path..." % (architecture, bitness))
def substituteMsvcPaths(settingsDir, version):
def substituteMsvcPaths(settingsDir, version, targetBitness=64):
if not version in ['2017', '2019']:
test.fatal('Unexpected MSVC version - "%s" not implemented yet.' % version)
return
hostArch = "Hostx64" if targetBitness == 64 else "Hostx86"
targetArch = "x64" if targetBitness == 64 else "x86"
for msvcFlavor in ["Community", "BuildTools"]:
try:
msvcPath = os.path.join("C:\\Program Files (x86)", "Microsoft Visual Studio",
version, msvcFlavor, "VC", "Tools", "MSVC")
msvcPath = os.path.join(msvcPath, os.listdir(msvcPath)[0], "bin", "HostX64", "x64")
msvcPath = os.path.join(msvcPath, os.listdir(msvcPath)[0], "bin", hostArch, targetArch)
__substitute__(os.path.join(settingsDir, "QtProject", 'qtcreator', 'toolchains.xml'),
"SQUISH_MSVC%s_PATH" % version, msvcPath)
"SQUISH_MSVC%s_%d_PATH" % (version, targetBitness), msvcPath)
return
except:
continue
@@ -256,6 +258,26 @@ def substituteMsvcPaths(settingsDir, version):
"Please make sure that MSVC%s is installed correctly." % version)
def prependWindowsKit(settingsDir, targetBitness=64):
targetArch = "x64" if targetBitness == 64 else "x86"
profilesPath = os.path.join(settingsDir, 'QtProject', 'qtcreator', 'profiles.xml')
winkits = os.path.join("C:\\Program Files (x86)", "Windows Kits", "10")
if not os.path.exists(winkits):
__substitute__(profilesPath, "SQUISH_ENV_MODIFICATION", "")
return
possibleVersions = os.listdir(os.path.join(winkits, 'bin'))
possibleVersions.reverse() # prefer higher versions
for version in possibleVersions:
if not version.startswith("10"):
continue
toolsPath = os.path.join(winkits, 'bin', version, targetArch)
if os.path.exists(os.path.join(toolsPath, 'rc.exe')):
__substitute__(profilesPath, "SQUISH_ENV_MODIFICATION", "PATH=+%s" % toolsPath)
return
test.warning("Windows Kit path could not be added, some tests mail fail.")
__substitute__(profilesPath, "SQUISH_ENV_MODIFICATION", "")
def __guessABI__(supportedABIs, use64Bit):
if platform.system() == 'Linux':
supportedABIs = filter(lambda x: 'linux' in x, supportedABIs)
@@ -350,8 +372,10 @@ def copySettingsToTmpDir(destination=None, omitFiles=[]):
substituteDefaultCompiler(tmpSettingsDir)
elif platform.system() in ('Windows', 'Microsoft'):
substituteCdb(tmpSettingsDir)
substituteMsvcPaths(tmpSettingsDir, '2017')
substituteMsvcPaths(tmpSettingsDir, '2019')
substituteMsvcPaths(tmpSettingsDir, '2017', 64)
substituteMsvcPaths(tmpSettingsDir, '2017', 32)
substituteMsvcPaths(tmpSettingsDir, '2019', 64)
prependWindowsKit(tmpSettingsDir, 32)
substituteOnlineInstallerPath(tmpSettingsDir)
substituteUnchosenTargetABIs(tmpSettingsDir)
SettingsPath = ['-settingspath', '"%s"' % tmpSettingsDir]