aboutsummaryrefslogtreecommitdiff
path: root/tools/buildsteps/windows
diff options
context:
space:
mode:
authorPär Björklund <per.bjorklund@gmail.com>2018-01-11 19:27:43 +0100
committerPär Björklund <per.bjorklund@gmail.com>2018-01-11 19:27:43 +0100
commit34b58e259ca3c99ac032efbbebcb5ce1b61c6ec9 (patch)
tree2de79a40f7a7efa1a2588707c890e0cd153384fb /tools/buildsteps/windows
parent0820b4f45ba55201a97e14f3740d4b487d6a22a7 (diff)
Adds vswhere as a package.
Will try to find vs2017 and fall back to vs2015 in case it's not found. SDK version is still hard coded and pinned to 14393 to avoid any breakage on jenkins.
Diffstat (limited to 'tools/buildsteps/windows')
-rw-r--r--tools/buildsteps/windows/BuildSetup.bat1
-rw-r--r--tools/buildsteps/windows/arm-uwp/BuildSetup.bat10
-rw-r--r--tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat4
-rw-r--r--tools/buildsteps/windows/arm-uwp/make-addons.bat4
-rw-r--r--tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat1
-rw-r--r--tools/buildsteps/windows/make-addons.bat2
-rw-r--r--tools/buildsteps/windows/make-mingwlibs.bat18
-rw-r--r--tools/buildsteps/windows/vswhere.bat66
-rw-r--r--tools/buildsteps/windows/win32-uwp/BuildSetup.bat11
-rw-r--r--tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat4
-rw-r--r--tools/buildsteps/windows/win32-uwp/make-addons.bat4
-rw-r--r--tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat1
-rw-r--r--tools/buildsteps/windows/win32/BuildSetup.bat10
-rw-r--r--tools/buildsteps/windows/win32/bootstrap-addons.bat4
-rw-r--r--tools/buildsteps/windows/win32/make-addons.bat4
-rw-r--r--tools/buildsteps/windows/win32/make-mingwlibs.bat1
-rw-r--r--tools/buildsteps/windows/x64-uwp/BuildSetup.bat11
-rw-r--r--tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat4
-rw-r--r--tools/buildsteps/windows/x64-uwp/make-addons.bat4
-rw-r--r--tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat1
-rw-r--r--tools/buildsteps/windows/x64/BuildSetup.bat9
-rw-r--r--tools/buildsteps/windows/x64/bootstrap-addons.bat4
-rw-r--r--tools/buildsteps/windows/x64/make-addons.bat4
-rw-r--r--tools/buildsteps/windows/x64/make-mingwlibs.bat1
24 files changed, 108 insertions, 75 deletions
diff --git a/tools/buildsteps/windows/BuildSetup.bat b/tools/buildsteps/windows/BuildSetup.bat
index 69957db3f7..8aebf73121 100644
--- a/tools/buildsteps/windows/BuildSetup.bat
+++ b/tools/buildsteps/windows/BuildSetup.bat
@@ -1,5 +1,4 @@
@ECHO OFF
-SETLOCAL ENABLEDELAYEDEXPANSION
REM setup all paths
PUSHD %~dp0\..\..\..
SET base_dir=%CD%
diff --git a/tools/buildsteps/windows/arm-uwp/BuildSetup.bat b/tools/buildsteps/windows/arm-uwp/BuildSetup.bat
index 994d4ed94b..018be71a6c 100644
--- a/tools/buildsteps/windows/arm-uwp/BuildSetup.bat
+++ b/tools/buildsteps/windows/arm-uwp/BuildSetup.bat
@@ -1,12 +1,12 @@
@ECHO OFF
-SET cmakeGenerator=Visual Studio 14 ARM
-SET TARGET_ARCHITECTURE=arm
+PUSHD %~dp0\..
-rem set Visual C++ build environment for binary addons
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_arm\vcvarsamd64_arm.bat" store 10.0.14393.0 || call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" arm store 10.0.14393.0
+CALL vswhere.bat arm store
+SET cmakeGenerator=Visual Studio %vsver% ARM
+SET TARGET_ARCHITECTURE=arm
SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion%
-PUSHD %~dp0\..
+
CALL BuildSetup.bat %*
POPD
diff --git a/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat b/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat
index 5fc727c9d5..e07f8d5195 100644
--- a/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat
+++ b/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_arm\vcvarsamd64_arm.bat" store 10.0.14393.0 || call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" arm store 10.0.14393.0
-
PUSHD %~dp0\..
+call vswhere.bat arm store
CALL bootstrap-addons %*
POPD
diff --git a/tools/buildsteps/windows/arm-uwp/make-addons.bat b/tools/buildsteps/windows/arm-uwp/make-addons.bat
index 939538b6bd..bc70eaa892 100644
--- a/tools/buildsteps/windows/arm-uwp/make-addons.bat
+++ b/tools/buildsteps/windows/arm-uwp/make-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_arm\vcvarsamd64_arm.bat" store 10.0.14393.0 || call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" arm store 10.0.14393.0
-
PUSHD %~dp0\..
+call vswhere.bat arm store
CALL make-addons.bat win10 %*
POPD
diff --git a/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat b/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat
index 3f6b55708b..c7bddcf1d0 100644
--- a/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat
+++ b/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat
@@ -1,5 +1,6 @@
@ECHO OFF
PUSHD %~dp0\..
+call vswhere.bat arm store
CALL make-mingwlibs.bat buildArm win10 %*
POPD
diff --git a/tools/buildsteps/windows/make-addons.bat b/tools/buildsteps/windows/make-addons.bat
index 922b2e4f8e..c4ddc8f90e 100644
--- a/tools/buildsteps/windows/make-addons.bat
+++ b/tools/buildsteps/windows/make-addons.bat
@@ -1,7 +1,5 @@
@ECHO OFF
-SETLOCAL
-
SET EXITCODE=0
SET install=false
diff --git a/tools/buildsteps/windows/make-mingwlibs.bat b/tools/buildsteps/windows/make-mingwlibs.bat
index 509847f681..a06992da2d 100644
--- a/tools/buildsteps/windows/make-mingwlibs.bat
+++ b/tools/buildsteps/windows/make-mingwlibs.bat
@@ -1,5 +1,4 @@
@ECHO OFF
-SETLOCAL
rem batch file to compile mingw libs via BuildSetup
PUSHD %~dp0\..\..\..
@@ -15,7 +14,7 @@ SET buildArm=no
SET vcarch=x86
SET msys2=msys64
SET win10=no
-SET UWPSDKVer=
+SET TARGETPLATFORM=win32
FOR %%b in (%*) DO (
IF %%b==noprompt SET PROMPTLEVEL=noprompt
@@ -27,12 +26,14 @@ FOR %%b in (%*) DO (
SET build32=no
SET buildArm=no
SET vcarch=amd64
+ SET TARGETPLATFORM=x64
)
IF %%b==buildArm (
SET build64=no
SET build32=no
SET buildArm=yes
SET vcarch=arm
+ SET TARGETPLATFORM=arm
)
IF %%b==win10 (
SET win10=yes
@@ -41,19 +42,6 @@ FOR %%b in (%*) DO (
:: Export full current PATH from environment into MSYS2
set MSYS2_PATH_TYPE=inherit
-:: setup MSVC env
-SET vcstore=
-IF %win10%==yes (
- SET vcstore=store
- SET UWPSDKVer=10.0.14393.0
-)
-
-IF %vcarch%==amd64 goto SetupMSVC
-if exist "%VS140COMNTOOLS%..\..\VC\bin\amd64_%vcarch%" set vcarch=amd64_%vcarch%
-:SetupMSVC
-echo setup MSVC for %vcarch% %vcstore% %UWPSDKVer%
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %vcarch% %vcstore% %UWPSDKVer% || exit /b 1
-
REM Prepend the msys and mingw paths onto %PATH%
SET MSYS_INSTALL_PATH=%WORKDIR%\project\BuildDependencies\msys
SET PATH=%MSYS_INSTALL_PATH%\mingw\bin;%MSYS_INSTALL_PATH%\bin;%PATH%
diff --git a/tools/buildsteps/windows/vswhere.bat b/tools/buildsteps/windows/vswhere.bat
new file mode 100644
index 0000000000..5688605ab1
--- /dev/null
+++ b/tools/buildsteps/windows/vswhere.bat
@@ -0,0 +1,66 @@
+@ECHO OFF
+
+
+REM Trick to make the path absolute
+PUSHD %~dp0\..\..\..\project\BuildDependencies
+SET builddeps=%CD%
+POPD
+
+SET arch=%1
+SET vcarch=amd64
+SET vcstore=%2
+SET vcvars=no
+SET sdkver=
+
+SET vsver=
+SET toolsdir=%arch%
+
+IF "%arch%" NEQ "x64" (
+ SET vcarch=%vcarch%_%arch%
+)
+
+IF "%arch%"=="x86" (
+ SET toolsdir=win32
+)
+
+IF "%vcstore%"=="store" (
+ SET sdkver=10.0.14393.0
+ SET toolsdir="win10-%toolsdir%"
+)
+
+SET vswhere="%builddeps%\%toolsdir%\tools\vswhere\vswhere.exe"
+
+FOR /f "usebackq tokens=1* delims=" %%i in (`%vswhere% -latest -property installationPath`) do (
+ IF EXIST "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
+ SET vcvars="%%i\VC\Auxiliary\Build\vcvarsall.bat"
+ SET vsver=15
+ )
+)
+
+IF %vcvars%==no (
+ FOR /f "usebackq tokens=1* delims=" %%i in (`%vswhere% -legacy -property installationPath`) do (
+ ECHO %%i | findstr "14" >NUL 2>NUL
+ IF NOT ERRORLEVEL 1 (
+ IF EXIST "%%i\VC\vcvarsall.bat" (
+ SET vcvars="%%i\VC\vcvarsall.bat"
+ SET vsver=14
+ )
+ )
+ )
+)
+
+IF %vcvars%==no (
+ ECHO "ERROR! Could not find vcvarsall.bat"
+ EXIT /B 1
+)
+
+REM vcvars changes the cwd so we need to store it and restore it
+PUSHD %~dp0
+CALL %vcvars% %vcarch% %vcstore% %sdkver%
+POPD
+
+IF ERRORLEVEL 1 (
+ ECHO "ERROR! something went wrong when calling"
+ ECHO %vcvars% %vcarch% %vcstore% %sdkver%
+ EXIT /B 1
+) \ No newline at end of file
diff --git a/tools/buildsteps/windows/win32-uwp/BuildSetup.bat b/tools/buildsteps/windows/win32-uwp/BuildSetup.bat
index 858cb13d4c..e5bc3c7316 100644
--- a/tools/buildsteps/windows/win32-uwp/BuildSetup.bat
+++ b/tools/buildsteps/windows/win32-uwp/BuildSetup.bat
@@ -1,12 +1,11 @@
@ECHO OFF
-SET cmakeGenerator=Visual Studio 14
-SET TARGET_ARCHITECTURE=x86
-
-rem set Visual C++ build environment for binary addons
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_x86\vcvarsamd64_x86.bat" store 10.0.14393.0 || call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86 store 10.0.14393.0
+PUSHD %~dp0\..
+CALL vswhere.bat x86 store
+SET cmakeGenerator=Visual Studio %vsver%
+SET TARGET_ARCHITECTURE=x86
SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion%
-PUSHD %~dp0\..
+
CALL BuildSetup.bat %*
POPD
diff --git a/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat b/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat
index e47b5b54f5..7b9db758ac 100644
--- a/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat
+++ b/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_x86\vcvarsamd64_x86.bat" store 10.0.14393.0 || call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86 store 10.0.14393.0
-
PUSHD %~dp0\..
+CALL vswhere.bat x86 store
CALL bootstrap-addons %*
POPD
diff --git a/tools/buildsteps/windows/win32-uwp/make-addons.bat b/tools/buildsteps/windows/win32-uwp/make-addons.bat
index 68f080ed4a..89bc08fe9e 100644
--- a/tools/buildsteps/windows/win32-uwp/make-addons.bat
+++ b/tools/buildsteps/windows/win32-uwp/make-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_x86\vcvarsamd64_x86.bat" store 10.0.14393.0 || call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86 store 10.0.14393.0
-
PUSHD %~dp0\..
+CALL vswhere.bat x86 store
CALL make-addons.bat win10 %*
POPD
diff --git a/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat b/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat
index 60e89c4bae..4e5c7a7772 100644
--- a/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat
+++ b/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat
@@ -1,5 +1,6 @@
@ECHO OFF
PUSHD %~dp0\..
+CALL vswhere.bat x86 store
CALL make-mingwlibs.bat win10 %*
POPD
diff --git a/tools/buildsteps/windows/win32/BuildSetup.bat b/tools/buildsteps/windows/win32/BuildSetup.bat
index 8a49ff69c0..2857e8d9d1 100644
--- a/tools/buildsteps/windows/win32/BuildSetup.bat
+++ b/tools/buildsteps/windows/win32/BuildSetup.bat
@@ -1,11 +1,11 @@
@ECHO OFF
-SET cmakeGenerator=Visual Studio 14
-SET TARGET_ARCHITECTURE=x86
+PUSHD %~dp0\..
-rem set Visual C++ build environment for binary addons
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_x86\vcvarsamd64_x86.bat" || call "%VS140COMNTOOLS%..\..\VC\bin\vcvars32.bat"
+CALL vswhere.bat x86
+
+SET cmakeGenerator=Visual Studio %vsver%
+SET TARGET_ARCHITECTURE=x86
-PUSHD %~dp0\..
CALL BuildSetup.bat %*
POPD
diff --git a/tools/buildsteps/windows/win32/bootstrap-addons.bat b/tools/buildsteps/windows/win32/bootstrap-addons.bat
index 9c024a9047..76613c85ea 100644
--- a/tools/buildsteps/windows/win32/bootstrap-addons.bat
+++ b/tools/buildsteps/windows/win32/bootstrap-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_x86\vcvarsamd64_x86.bat" || call "%VS140COMNTOOLS%..\..\VC\bin\vcvars32.bat"
-
PUSHD %~dp0\..
+CALL vswhere.bat x86
CALL bootstrap-addons %*
POPD
diff --git a/tools/buildsteps/windows/win32/make-addons.bat b/tools/buildsteps/windows/win32/make-addons.bat
index 0592f3cc01..3faef544c3 100644
--- a/tools/buildsteps/windows/win32/make-addons.bat
+++ b/tools/buildsteps/windows/win32/make-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\bin\amd64_x86\vcvarsamd64_x86.bat" || call "%VS140COMNTOOLS%..\..\VC\bin\vcvars32.bat"
-
PUSHD %~dp0\..
+CALL vswhere.bat x86
CALL make-addons.bat %*
POPD
diff --git a/tools/buildsteps/windows/win32/make-mingwlibs.bat b/tools/buildsteps/windows/win32/make-mingwlibs.bat
index 2c3bedcc88..5572aa90e8 100644
--- a/tools/buildsteps/windows/win32/make-mingwlibs.bat
+++ b/tools/buildsteps/windows/win32/make-mingwlibs.bat
@@ -1,5 +1,6 @@
@ECHO OFF
PUSHD %~dp0\..
+CALL vswhere.bat x86
CALL make-mingwlibs.bat %*
POPD
diff --git a/tools/buildsteps/windows/x64-uwp/BuildSetup.bat b/tools/buildsteps/windows/x64-uwp/BuildSetup.bat
index a00b3025e8..65e39e52de 100644
--- a/tools/buildsteps/windows/x64-uwp/BuildSetup.bat
+++ b/tools/buildsteps/windows/x64-uwp/BuildSetup.bat
@@ -1,12 +1,11 @@
@ECHO OFF
-SET cmakeGenerator=Visual Studio 14 Win64
-SET TARGET_ARCHITECTURE=x64
-
-rem set Visual C++ build environment for binary addons
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" amd64 store 10.0.14393.0
+PUSHD %~dp0\..
+CALL vswhere.bat x64 store
+SET cmakeGenerator=Visual Studio %vsver% Win64
+SET TARGET_ARCHITECTURE=x64
SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion%
-PUSHD %~dp0\..
+
CALL BuildSetup.bat %*
POPD
diff --git a/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat b/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat
index fc4ea94481..43161644d4 100644
--- a/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat
+++ b/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" amd64 store 10.0.14393.0
-
PUSHD %~dp0\..
+CALL vswhere.bat x64 store
CALL bootstrap-addons %*
POPD
diff --git a/tools/buildsteps/windows/x64-uwp/make-addons.bat b/tools/buildsteps/windows/x64-uwp/make-addons.bat
index 9c2758f9db..6fe9d983e3 100644
--- a/tools/buildsteps/windows/x64-uwp/make-addons.bat
+++ b/tools/buildsteps/windows/x64-uwp/make-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" amd64 store 10.0.14393.0
-
PUSHD %~dp0\..
+CALL vswhere.bat x64 store
CALL make-addons.bat win10 %*
POPD
diff --git a/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat b/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat
index 4356bffd6a..46643ac6ce 100644
--- a/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat
+++ b/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat
@@ -1,5 +1,6 @@
@ECHO OFF
PUSHD %~dp0\..
+CALL vswhere.bat x64 store
CALL make-mingwlibs.bat build64 win10 %*
POPD
diff --git a/tools/buildsteps/windows/x64/BuildSetup.bat b/tools/buildsteps/windows/x64/BuildSetup.bat
index b874cae253..d2b6f4f696 100644
--- a/tools/buildsteps/windows/x64/BuildSetup.bat
+++ b/tools/buildsteps/windows/x64/BuildSetup.bat
@@ -1,11 +1,10 @@
@ECHO OFF
-SET cmakeGenerator=Visual Studio 14 Win64
-SET TARGET_ARCHITECTURE=x64
+PUSHD %~dp0\..
+CALL vswhere.bat x64
-rem set Visual C++ build environment for binary addons
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
+SET cmakeGenerator=Visual Studio %vsver% Win64
+SET TARGET_ARCHITECTURE=x64
-PUSHD %~dp0\..
CALL BuildSetup.bat %*
POPD
diff --git a/tools/buildsteps/windows/x64/bootstrap-addons.bat b/tools/buildsteps/windows/x64/bootstrap-addons.bat
index 21bb4ac85e..ac10bab6b8 100644
--- a/tools/buildsteps/windows/x64/bootstrap-addons.bat
+++ b/tools/buildsteps/windows/x64/bootstrap-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
-
PUSHD %~dp0\..
+CALL vswhere.bat x64
CALL bootstrap-addons %*
POPD
diff --git a/tools/buildsteps/windows/x64/make-addons.bat b/tools/buildsteps/windows/x64/make-addons.bat
index ae9bfcccfc..4bdd4d80c4 100644
--- a/tools/buildsteps/windows/x64/make-addons.bat
+++ b/tools/buildsteps/windows/x64/make-addons.bat
@@ -1,8 +1,6 @@
@ECHO OFF
-rem set Visual C++ build environment
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
-
PUSHD %~dp0\..
+CALL vswhere.bat x64
CALL make-addons.bat %*
POPD
diff --git a/tools/buildsteps/windows/x64/make-mingwlibs.bat b/tools/buildsteps/windows/x64/make-mingwlibs.bat
index 6ba1aaddef..d741500f39 100644
--- a/tools/buildsteps/windows/x64/make-mingwlibs.bat
+++ b/tools/buildsteps/windows/x64/make-mingwlibs.bat
@@ -1,5 +1,6 @@
@ECHO OFF
PUSHD %~dp0\..
+CALL vswhere.bat x64
CALL make-mingwlibs.bat build64 %*
POPD