Skip to content

Commit

Permalink
Merge pull request xbmc#13279 from Paxxi/vswhere
Browse files Browse the repository at this point in the history
[xbmc][win32] First step in supporting VS2017
  • Loading branch information
Paxxi authored Jan 11, 2018
2 parents 0820b4f + 34b58e2 commit 4e01f3d
Show file tree
Hide file tree
Showing 25 changed files with 109 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ doxygen-1.8.2-win32.7z
jsonschemabuilder-1.0.0-win32-3.7z
swig-3.0.10-win32.7z
texturepacker-1.1.1-win32.7z
vswhere-2.2.11-win32.7z
1 change: 0 additions & 1 deletion tools/buildsteps/windows/BuildSetup.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
REM setup all paths
PUSHD %~dp0\..\..\..
SET base_dir=%CD%
Expand Down
10 changes: 5 additions & 5 deletions tools/buildsteps/windows/arm-uwp/BuildSetup.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/arm-uwp/make-addons.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@ECHO OFF

PUSHD %~dp0\..
call vswhere.bat arm store
CALL make-mingwlibs.bat buildArm win10 %*
POPD
2 changes: 0 additions & 2 deletions tools/buildsteps/windows/make-addons.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@ECHO OFF

SETLOCAL

SET EXITCODE=0

SET install=false
Expand Down
18 changes: 3 additions & 15 deletions tools/buildsteps/windows/make-mingwlibs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@ECHO OFF
SETLOCAL

rem batch file to compile mingw libs via BuildSetup
PUSHD %~dp0\..\..\..
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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%
Expand Down
66 changes: 66 additions & 0 deletions tools/buildsteps/windows/vswhere.bat
Original file line number Diff line number Diff line change
@@ -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
)
11 changes: 5 additions & 6 deletions tools/buildsteps/windows/win32-uwp/BuildSetup.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/win32-uwp/make-addons.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@ECHO OFF

PUSHD %~dp0\..
CALL vswhere.bat x86 store
CALL make-mingwlibs.bat win10 %*
POPD
10 changes: 5 additions & 5 deletions tools/buildsteps/windows/win32/BuildSetup.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/win32/bootstrap-addons.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/win32/make-addons.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tools/buildsteps/windows/win32/make-mingwlibs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@ECHO OFF

PUSHD %~dp0\..
CALL vswhere.bat x86
CALL make-mingwlibs.bat %*
POPD
11 changes: 5 additions & 6 deletions tools/buildsteps/windows/x64-uwp/BuildSetup.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/x64-uwp/make-addons.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@ECHO OFF

PUSHD %~dp0\..
CALL vswhere.bat x64 store
CALL make-mingwlibs.bat build64 win10 %*
POPD
9 changes: 4 additions & 5 deletions tools/buildsteps/windows/x64/BuildSetup.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/x64/bootstrap-addons.bat
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tools/buildsteps/windows/x64/make-addons.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tools/buildsteps/windows/x64/make-mingwlibs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@ECHO OFF

PUSHD %~dp0\..
CALL vswhere.bat x64
CALL make-mingwlibs.bat build64 %*
POPD

0 comments on commit 4e01f3d

Please sign in to comment.