Skip to content

Commit

Permalink
Updated build scripts for Visual Studio 2019 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
thexai committed Apr 6, 2021
1 parent 4e6f40d commit 8a88864
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 12 deletions.
24 changes: 18 additions & 6 deletions docs/README.Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,42 @@ cd kodi-build

Configure build for 64bit (**recommended**):
```
cmake -G "Visual Studio 15 Win64" -T host=x64 %userprofile%\kodi
cmake -G "Visual Studio 15 2017" -A x64 -T host=x64 %userprofile%\kodi
```

Or configure build for 32bit:
```
cmake -G "Visual Studio 15" -T host=x64 %userprofile%\kodi
cmake -G "Visual Studio 15 2017" -A Win32 -T host=x64 %userprofile%\kodi
```

Or configure build for UWP 64bit:
```
cmake -G "Visual Studio 15 Win64" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
cmake -G "Visual Studio 15 2017" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
```

Or configure build for UWP 32bit:
```
cmake -G "Visual Studio 15" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
cmake -G "Visual Studio 15 2017" -A Win32 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
```

Or configure build for UWP ARM 32bit:
```
cmake -G "Visual Studio 15 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
cmake -G "Visual Studio 15 2017" -A ARM -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
```

**WARNING:** `-T host=x64` requires CMake version >= 3.8. If your version is older, drop `-T host=x64` from the command.
**Visual Studio 2019:**

Replace:
```
-G "Visual Studio 15 2017"
```

With:
```
-G "Visual Studio 16 2019"
```

**WARNING:** Is required CMake version >= 3.8.

Build Kodi:
Build a `Debug` binary:
Expand Down
2 changes: 1 addition & 1 deletion tools/buildsteps/windows/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ set WORKSPACE=%base_dir%\kodi-build.%TARGET_PLATFORM%
MKDIR %WORKSPACE%
PUSHD %WORKSPACE%

cmake.exe -G "%cmakeGenerator%" %cmakeProps% %base_dir%
cmake.exe -G "%cmakeGenerator%" -A %cmakeArch% -T host=x64 %cmakeProps% %base_dir%
IF %errorlevel%==1 (
set DIETEXT="%APP_NAME%.EXE failed to build!"
goto DIE
Expand Down
3 changes: 2 additions & 1 deletion tools/buildsteps/windows/arm-uwp/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ IF ERRORLEVEL 1 (
EXIT /B 1
)

SET cmakeGenerator=Visual Studio %vsver% ARM
SET cmakeGenerator=Visual Studio %vsver%
SET cmakeArch=ARM
SET TARGET_ARCHITECTURE=arm
SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%-uwp
SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion%
Expand Down
6 changes: 4 additions & 2 deletions tools/buildsteps/windows/vswhere.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ 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
SET vsver=15 2017
ECHO %%i | findstr "2019" >NUL 2>NUL
IF NOT ERRORLEVEL 1 SET vsver=16 2019
)
)

Expand All @@ -57,7 +59,7 @@ IF %vcvars%==no (
IF NOT ERRORLEVEL 1 (
IF EXIST "%%i\VC\vcvarsall.bat" (
SET vcvars="%%i\VC\vcvarsall.bat"
SET vsver=14
SET vsver=14 2015
)
)
)
Expand Down
1 change: 1 addition & 0 deletions tools/buildsteps/windows/win32-uwp/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ IF ERRORLEVEL 1 (
)

SET cmakeGenerator=Visual Studio %vsver%
SET cmakeArch=Win32
SET TARGET_ARCHITECTURE=x86
SET TARGET_PLATFORM=win32-uwp
SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion%
Expand Down
1 change: 1 addition & 0 deletions tools/buildsteps/windows/win32/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ IF ERRORLEVEL 1 (
)

SET cmakeGenerator=Visual Studio %vsver%
SET cmakeArch=Win32
SET TARGET_ARCHITECTURE=x86
SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%

Expand Down
3 changes: 2 additions & 1 deletion tools/buildsteps/windows/x64-uwp/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ IF ERRORLEVEL 1 (
EXIT /B 1
)

SET cmakeGenerator=Visual Studio %vsver% Win64
SET cmakeGenerator=Visual Studio %vsver%
SET cmakeArch=x64
SET TARGET_ARCHITECTURE=x64
SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%-uwp
SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion%
Expand Down
3 changes: 2 additions & 1 deletion tools/buildsteps/windows/x64/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ IF ERRORLEVEL 1 (
EXIT /B 1
)

SET cmakeGenerator=Visual Studio %vsver% Win64
SET cmakeGenerator=Visual Studio %vsver%
SET cmakeArch=x64
SET TARGET_ARCHITECTURE=x64
SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%

Expand Down

0 comments on commit 8a88864

Please sign in to comment.