From 9b35fd9472923c669a33ae51808068f63cb4db83 Mon Sep 17 00:00:00 2001 From: UK992 Date: Sat, 8 Apr 2017 13:14:25 +0200 Subject: [PATCH 1/2] Add support for Visual Studio 2017 --- mach.bat | 22 +++++++++++++++++++--- python/servo/util.py | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mach.bat b/mach.bat index 5c582605013..c41eccd4373 100644 --- a/mach.bat +++ b/mach.bat @@ -1,6 +1,22 @@ @echo off -SET VS_VCVARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat +IF EXIST "%ProgramFiles(x86)%" ( + set "ProgramFiles32=%ProgramFiles(x86)%" +) ELSE ( + set "ProgramFiles32=%ProgramFiles%" +) + +set VC14VARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat +IF EXIST "%VC14VARS%" ( + set "VS_VCVARS=%VC14VARS%" +) ELSE ( + for %%e in (Enterprise Professional Community) do ( + IF EXIST "%ProgramFiles32%\Microsoft Visual Studio\2017\%%e\VC\Auxiliary\Build\vcvarsall.bat" ( + set "VS_VCVARS=%ProgramFiles32%\Microsoft Visual Studio\2017\%%e\VC\Auxiliary\Build\vcvarsall.bat" + ) + ) +) + IF EXIST "%VS_VCVARS%" ( IF NOT DEFINED Platform ( IF EXIST "%ProgramFiles(x86)%" ( @@ -11,8 +27,8 @@ IF EXIST "%VS_VCVARS%" ( ) ) ) ELSE ( - ECHO Visual Studio 2015 is not installed. - ECHO Download and install Visual Studio 2015 from https://www.visualstudio.com/ + ECHO Visual Studio 2015 or 2017 is not installed. + ECHO Download and install Visual Studio 2015 or 2017 from https://www.visualstudio.com/ EXIT /B ) diff --git a/python/servo/util.py b/python/servo/util.py index 77fba165446..4df128419ae 100644 --- a/python/servo/util.py +++ b/python/servo/util.py @@ -50,7 +50,7 @@ def host_triple(): cpu_type = platform.machine().lower() if os_type.endswith("-msvc"): # vcvars*.bat should set it properly - platform_env = os.environ.get("PLATFORM") + platform_env = os.environ.get("PLATFORM").upper() if platform_env == "X86": cpu_type = "i686" elif platform_env == "X64": From e3654e14c58d320379e15b6b39f9b8b1ab766148 Mon Sep 17 00:00:00 2001 From: UK992 Date: Tue, 11 Apr 2017 23:29:06 +0200 Subject: [PATCH 2/2] Update cmake to 3.7.2 --- python/servo/bootstrap.py | 12 +++++++++++- python/servo/packages.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/python/servo/bootstrap.py b/python/servo/bootstrap.py index 72867fcf155..35be5c67b92 100644 --- a/python/servo/bootstrap.py +++ b/python/servo/bootstrap.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, print_function from distutils.spawn import find_executable +from distutils.version import StrictVersion import json import os import platform @@ -204,10 +205,19 @@ def windows_msvc(context, force=False): def package_dir(package): return os.path.join(deps_dir, package, version(package)) + def check_cmake(version): + cmake_path = find_executable("cmake") + if cmake_path: + cmake = subprocess.Popen([cmake_path, "--version"], stdout=PIPE) + cmake_version = cmake.stdout.read().splitlines()[0].replace("cmake version ", "") + if StrictVersion(cmake_version) >= StrictVersion(version): + return True + return False + to_install = {} for package in packages.WINDOWS_MSVC: # Don't install CMake if it already exists in PATH - if package == "cmake" and find_executable(package): + if package == "cmake" and check_cmake(version("cmake")): continue if not os.path.isdir(package_dir(package)): diff --git a/python/servo/packages.py b/python/servo/packages.py index 1413e1c645a..8e9bd22c69f 100644 --- a/python/servo/packages.py +++ b/python/servo/packages.py @@ -18,7 +18,7 @@ WINDOWS_GNU = set([ ]) WINDOWS_MSVC = { - "cmake": "3.6.1", + "cmake": "3.7.2", "moztools": "0.0.1-5", "ninja": "1.7.1", "openssl": "1.1.0e-vs2015",