forked from qt-creator/qt-creator
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:
@@ -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]
|
||||
|
Reference in New Issue
Block a user