Skip to content

Commit

Permalink
add visual studio 2019 support
Browse files Browse the repository at this point in the history
  • Loading branch information
HarpyWar committed Feb 2, 2020
1 parent fce0845 commit 7009182
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 14 deletions.
16 changes: 10 additions & 6 deletions build_pvpgn.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ color 1f
echo.
echo *:*:*:*:*:*:*:*:*- P v P G N M a g i c B u i l d e r -*:*:*:*:*:*:*:*:*:*:*
echo * *
echo * Copyright 2011-2018, HarpyWar ([email protected]) *
echo * Copyright 2011-2020, HarpyWar ([email protected]) *
echo * https://pvpgn.pro *
echo * *
echo *:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*
Expand Down Expand Up @@ -279,7 +279,7 @@ if "%PARAM_BUILDTYPE%"=="Debug" (
set CMAKE_VARS=%CMAKE_VARS% %CMAKE_FLAGS%

:: configure and generate solution
call %EXEC_TOOL% cmake.exe -Wno-dev -G "%GENERATOR%" -D ZLIB_INCLUDE_DIR=%ZLIB_PATH% -D ZLIB_LIBRARY=%ZLIB_PATH%zdll.lib %CMAKE_VARS% -D CMAKE_CONFIGURATION_TYPES="Debug;Release" -D CMAKE_SUPPRESS_REGENERATION=true -D WITH_WIN32_GUI=%_with_gui% -H%PVPGN_SOURCE% -B%PVPGN_BUILD% %_cmake_log%
call %EXEC_TOOL% cmake.exe -Wno-dev -G "%GENERATOR%" -A "Win32" -D ZLIB_INCLUDE_DIR=%ZLIB_PATH% -D ZLIB_LIBRARY=%ZLIB_PATH%zdll.lib %CMAKE_VARS% -D CMAKE_CONFIGURATION_TYPES="Debug;Release" -D CMAKE_SUPPRESS_REGENERATION=true -D WITH_WIN32_GUI=%_with_gui% -H%PVPGN_SOURCE% -B%PVPGN_BUILD% %_cmake_log%


:: Stop after cmake and setting env vars (feature for appveyor)
Expand All @@ -297,18 +297,22 @@ if [%LOG%]==[true] set _vs_log=^>visualstudio.log
:: check solution for exists
IF NOT EXIST "%PVPGN_BUILD%pvpgn.sln" echo. & call %i18n% 1_16 & goto THEEND

:: load visual studio variables
if ["%VSVER%"]==["v160"] (
@call "%VSCOMNTOOLS%vcvars32.bat"
:: load visual studio variables (new and old vs has different batch files with vars)
if not ["%VSVER%"]==["v100"] if not ["%VSVER%"]==["v110"] if not ["%VSVER%"]==["v120"] if not ["%VSVER%"]==["v140"] (
@call "%VSCOMNTOOLS%vcvars32.bat"
) else (
@call "%VSCOMNTOOLS%vsvars32.bat"
)

:: atlmfc include dir for VC Express version
set INCLUDE=%ATLMFC_INCLUDE_PATH%;%INCLUDE%

set msbuild_exec=MSBuild.exe "%PVPGN_BUILD%pvpgn.sln" /t:Rebuild /p:Configuration=%PARAM_BUILDTYPE% /p:Platform="Win32" /p:UseEnv=true /consoleloggerparameters:Summary;PerformanceSummary;Verbosity=minimal /maxcpucount %_vs_log%

:: print command
echo %msbuild_exec%
:: compile the solution
MSBuild.exe "%PVPGN_BUILD%pvpgn.sln" /t:Rebuild /p:Configuration=%PARAM_BUILDTYPE% /p:Platform="Win32" /p:UseEnv=true /consoleloggerparameters:Summary;PerformanceSummary;Verbosity=minimal /maxcpucount %_vs_log%
%msbuild_exec%

:: ----------- RELEASE ------------
echo.
Expand Down
9 changes: 5 additions & 4 deletions module/config.inc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rem ----------- THIRD PARTY TOOLS ------------
:: http://gnuwin32.sourceforge.net/packages/wget.htm
::set URL_TOOL_WGET=https://kent.dl.sourceforge.net/project/gnuwin32/wget/1.11.4-1/wget-1.11.4-1-bin.zip
::set URL_TOOL_WGET_DEP=https://kent.dl.sourceforge.net/project/gnuwin32/wget/1.11.4-1/wget-1.11.4-1-dep.zip
set URL_TOOL_WGET=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
set URL_TOOL_WGET=https://eternallybored.org/misc/wget/1.20.3/32/wget.exe

:: http://www.etree.org/md5com.html
:: (url must be http, because it can be downloaded with wget.vbs which does not support https)
Expand All @@ -29,11 +29,12 @@ set URL_TOOL_MD5SUM=http://web.archive.org/web/20170430031141/http://www.etree.o
set URL_TOOL_UNZIP=https://fossies.org/windows/misc/unz600xn.exe/unzip.exe

:: https://github.com/Microsoft/vswhere
set URL_TOOL_VSWHERE=https://github.com/Microsoft/vswhere/releases/download/2.5.2/vswhere.exe
set URL_TOOL_VSWHERE=https://github.com/microsoft/vswhere/releases/download/2.8.4/vswhere.exe

:: https://cmake.org
set CMAKE_VERSION=cmake-3.12.4-win32-x86
set URL_TOOL_CMAKE=https://cmake.org/files/v3.12/%CMAKE_VERSION%.zip
set CMAKE_VER=3.16.3
set CMAKE_VERSION=cmake-%CMAKE_VER%-win32-x86
set URL_TOOL_CMAKE=https://github.com/Kitware/CMake/releases/download/v%CMAKE_VER%/%CMAKE_VERSION%.zip


:: ----------- build_pvpgn VARIABLES ------------
Expand Down
38 changes: 35 additions & 3 deletions module/select_generator.inc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ set _vs_choice=0
set /a _vs_count=0


:: fill array with installed vs
:: fill array with installed vs (OLD versions end with 2015)
set VSCOMNTOOLS=%VS100COMNTOOLS%& @call :init_vs 1
set VSCOMNTOOLS=%VS110COMNTOOLS%& @call :init_vs 2
set VSCOMNTOOLS=%VS120COMNTOOLS%& @call :init_vs 3
set VSCOMNTOOLS=%VS140COMNTOOLS%& @call :init_vs 4
set VSCOMNTOOLS=NOTFOUND& @call :init_vs 5
set VSCOMNTOOLS=NOTFOUND& @call :init_vs 6
set VSCOMNTOOLS=NOTFOUND& @call :init_vs 7
set VSCOMNTOOLS=NOTFOUND& @call :init_vs 8
rem // TODO: add new Visual Studio versions here

:: if no vs found
if %_vs_count% equ 0 set VS_NOT_INSTALLED=true& goto :eof
Expand Down Expand Up @@ -66,7 +70,13 @@ if [%_vs_choice%]==[1] set VSCOMNTOOLS=%VS100COMNTOOLS%& set GENERATOR=Visual St
if [%_vs_choice%]==[2] set VSCOMNTOOLS=%VS110COMNTOOLS%& set GENERATOR=Visual Studio 11 2012& set VSVER=v110
if [%_vs_choice%]==[3] set VSCOMNTOOLS=%VS120COMNTOOLS%& set GENERATOR=Visual Studio 12 2013& set VSVER=v120
if [%_vs_choice%]==[4] set VSCOMNTOOLS=%VS140COMNTOOLS%& set GENERATOR=Visual Studio 14 2015& set VSVER=v140
if [%_vs_choice%]==[5] set VSCOMNTOOLS=%VS160COMNTOOLS%& set GENERATOR=Visual Studio 15 2017& set VSVER=v160
:: NEW versions start from 2017
if [%_vs_choice%]==[5] set VSCOMNTOOLS=%VSNEWCOMNTOOLS%& set GENERATOR=Visual Studio 15 2017& set VSVER=v141
if [%_vs_choice%]==[6] set VSCOMNTOOLS=%VSNEWCOMNTOOLS%& set GENERATOR=Visual Studio 16 2019& set VSVER=v142
if [%_vs_choice%]==[7] set VSCOMNTOOLS=%VSNEWCOMNTOOLS%& set GENERATOR=Visual Studio 17 2021& set VSVER=v143
if [%_vs_choice%]==[8] set VSCOMNTOOLS=%VSNEWCOMNTOOLS%& set GENERATOR=Visual Studio 18 2023& set VSVER=v144
rem // TODO: add new Visual Studio versions here

set PARAM_VS=%_vs_choice%

call %i18n% 1_2 "%GENERATOR%"
Expand Down Expand Up @@ -98,12 +108,34 @@ goto :eof
rem ... or newer versions (since 2017)
rem vswhere return directories of all installed versions and then we try to find VC++ directory there
for /f "usebackq tokens=*" %%i in (`call %EXEC_TOOL% vswhere.exe -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
if exist "%%i\Common7\IDE\devenv.exe" if exist "%%i\VC\Auxiliary\Build\vcvars32.bat" set found=true& set VS160COMNTOOLS=%%i\VC\Auxiliary\Build\
if exist "%%i\Common7\IDE\devenv.exe" if exist "%%i\VC\Auxiliary\Build\vcvars32.bat" (
set find_ver=0000
if [%1]==[5] set find_ver=2017
if [%1]==[6] set find_ver=2019
if [%1]==[7] set find_ver=2021
if [%1]==[8] set find_ver=2023
rem // TODO: add new Visual Studio versions here

:: find in path
call :_find_substr "%%i" !find_ver!
if [!_result!]==[true] (
set found=true& set VSNEWCOMNTOOLS=%%i\VC\Auxiliary\Build\
)
)
)
)

if %found%==true (
set _vs_installed=!_vs_installed!%1
set /a _vs_count+=1 & set _vs_choice=%1
)
exit /b 0

:_find_substr
echo.%1 | findstr /C:"%2" 1>nul
if errorlevel 1 (
set _result=false
) else (
set _result=true
)
exit /b 0
2 changes: 1 addition & 1 deletion module/tools/exec_tool.bat
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ goto :eof
:download_cmake

cmake.exe --version
:: first find in PATH
:: first find in PATH and don't download if found
call :run_installed cmake.exe
echo.
if errorlevel 5 (
Expand Down

0 comments on commit 7009182

Please sign in to comment.