diff --git a/install.pri b/install.pri index bc6d06100..0853f04b5 100644 --- a/install.pri +++ b/install.pri @@ -143,12 +143,13 @@ unix:!macx { ############### Install VC runtime ############## -win32-msvc2015 { +win32-msvc* { + PROGRAM_FILES = $$getenv(programfiles(x86)) equals(WORD_SIZE,64) { - vc_redist_target.files *= $$(VS140COMNTOOLS)../../VC/redist/1033/vcredist_x64.exe + vc_redist_target.files *= $$shell_path($$PROGRAM_FILES/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.11.25325/vcredist_x64.exe) } equals(WORD_SIZE,32) { - vc_redist_target.files *= $$(VS140COMNTOOLS)../../VC/redist/1033/vcredist_x86.exe + vc_redist_target.files *= $$shell_path($$PROGRAM_FILES/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.11.25325/vcredist_x86.exe) } vc_redist_target.path *= $${PREFIX}/vcredist INSTALLS += vc_redist_target diff --git a/scripts/jenkins.py b/scripts/jenkins.py index 7eb81c4f6..3abb0137f 100644 --- a/scripts/jenkins.py +++ b/scripts/jenkins.py @@ -244,9 +244,9 @@ class MSVCBuilder(Builder): os.environ['PATH'] += os.pathsep + self._get_externals_path() os.environ['PATH'] += os.pathsep + 'C:/Program Files/7-Zip' if self.word_size == '32': - vs_env = get_vs_env('14.0', 'x86') + vs_env = get_vs_env('VS2017', 'x86') else: - vs_env = get_vs_env('14.0', 'amd64') + vs_env = get_vs_env('VS2017', 'amd64') os.environ.update(vs_env) @@ -257,7 +257,12 @@ class MSVCBuilder(Builder): return path.abspath(path.join(self._get_qtcreator_path(), 'jom.exe')) def _get_qt_component(self): - return 'msvc2015' + if self.word_size == '32': + return 'msvc2015' + elif self.word_size == '64': + return 'msvc2017' + else: + raise RuntimeError('Illegal word size!') def __init__(self, config_file, word_size): Builder.__init__(self, config_file, word_size) diff --git a/scripts/lib/util.py b/scripts/lib/util.py index 8c18f1831..a57cdc881 100644 --- a/scripts/lib/util.py +++ b/scripts/lib/util.py @@ -60,12 +60,19 @@ def get_environment_from_batch_command(env_cmd, initial=None): def get_vs_env(vs_version, arch): - """ - Returns the env object for VS building environment. + """ + Returns the env object for VS building environment. - The vs_version can be strings like "12.0" (e.g. VS2013), the arch has to - be one of "x86", "amd64", "arm", "x86_amd64", "x86_arm", "amd64_x86", - "amd64_arm", e.g. the args passed to vcvarsall.bat. - """ - vsvarsall = "C:\\Program Files (x86)\\Microsoft Visual Studio {0}\\VC\\vcvarsall.bat".format(vs_version) - return get_environment_from_batch_command([vsvarsall, arch]) \ No newline at end of file + The vs_version can be one of the following strings: + - VS2015, + - VS2017, + the arch has to be one of "x86", "amd64", "arm", "x86_amd64", "x86_arm", "amd64_x86", + "amd64_arm", e.g. the args passed to vcvarsall.bat. + """ + if vs_version == 'VS2015': + vsvarsall = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat" + elif vs_version == 'VS2017': + vsvarsall = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\Auxiliary\\Build\\vcvarsall.bat" + else: + raise RuntimeError('Unsupported Visual Studio version!') + return get_environment_from_batch_command([vsvarsall, arch])