[Build-System] Fix Visual Studio detection logic to use the latest installed when building FreeSWITCH or sound packages.

This commit is contained in:
Andrey Volk 2020-05-25 16:41:16 +04:00
parent ef70d4d59b
commit 7490fba772
3 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
@REM this script builds freeswitch using VS2017 @REM this script builds freeswitch using the latest found Microsoft Visual Studio
@REM only one platform/configuration will be built @REM only one platform/configuration will be built
@REM runs (probably only) from the commandline @REM runs (probably only) from the commandline
@REM usage: Freeswitch.2017.sln [[[.*]ebug] [[.*]elease] [[.*]64] [[.*]32]] @REM usage: Freeswitch.2017.sln [[[.*]ebug] [[.*]elease] [[.*]64] [[.*]32]]
@ -47,13 +47,13 @@
@set procs=%NUMBER_OF_PROCESSORS% @set procs=%NUMBER_OF_PROCESSORS%
@set /a procs -= 1 @set /a procs -= 1
@REM check and set VS2017 environment @REM check and set Visual Studio environment
CALL msbuild.cmd CALL msbuild.cmd
if exist %msbuild% ( if exist %msbuild% (
%msbuild% Freeswitch.2017.sln /m:%procs% /verbosity:normal /property:Configuration=%configuration% /property:Platform=%platform% /fl /flp:logfile=vs2017%platform%%configuration%.log;verbosity=normal %msbuild% Freeswitch.2017.sln /m:%procs% /verbosity:normal /property:Configuration=%configuration% /property:Platform=%platform% /fl /flp:logfile=vs%platform%%configuration%.log;verbosity=normal
) ELSE ( ) ELSE (
echo "echo ERROR: Cannot find msbuild. You need Visual Studio 2017 to compile this solution." echo "echo ERROR: Cannot find msbuild. You need Microsoft Visual Studio to compile this solution."
) )
@pause @pause

View File

@ -1,5 +1,5 @@
@REM check and set VS2017 environment @REM check and set Visual Studio environment
rem VS2017U2 contains vswhere.exe rem There is vswhere.exe starting VS2017U2
if "%VSWHERE%"=="" set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if "%VSWHERE%"=="" set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
rem Use %ProgramFiles% in a 32-bit program prior to Windows 10) rem Use %ProgramFiles% in a 32-bit program prior to Windows 10)
@ -7,7 +7,7 @@ If Not Exist "%VSWHERE%" set "VSWHERE=%ProgramFiles%\Microsoft Visual Studio\Ins
If Not Exist "%VSWHERE%" ( If Not Exist "%VSWHERE%" (
echo "WARNING: Can't find vswhere.exe. It is a part of VS 2017 version 15.2 or later. Trying known path..." echo "WARNING: Can't find vswhere.exe. It is a part of VS 2017 version 15.2 or later. Trying known path..."
set "InstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" set "InstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
) ELSE ( ) ELSE (
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do ( for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i set InstallDir=%%i
@ -15,6 +15,6 @@ If Not Exist "%VSWHERE%" (
) )
echo Install dir is "%InstallDir%" echo Install dir is "%InstallDir%"
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" ( if exist "%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" (
set msbuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" set msbuild="%InstallDir%\MSBuild\Current\Bin\MSBuild.exe"
) )

View File

@ -11,7 +11,7 @@ for /F "tokens=*" %%A in (%cd%\..\..\..\build\sounds_upgradecode.txt) do (
) )
) ELSE ( ) ELSE (
echo "echo ERROR: Cannot find msbuild. You need Visual Studio 2017 to compile this solution." echo "echo ERROR: Cannot find msbuild. You need Microsoft Visual Studio to compile this solution."
EXIT /B 1 EXIT /B 1
) )
@ -25,11 +25,11 @@ EXIT /B %ERRORLEVEL%
:Build :Build
set SoundPrimaryName=%1 set SoundPrimaryName=%1
set SoundQuality=8000 set SoundQuality=8000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
set SoundQuality=16000 set SoundQuality=16000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
set SoundQuality=32000 set SoundQuality=32000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
set SoundQuality=48000 set SoundQuality=48000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
EXIT /B 0 EXIT /B 0