Skip to content

Commit

Permalink
[Build-System] Fix Visual Studio detection logic to use the latest in…
Browse files Browse the repository at this point in the history
…stalled when building FreeSWITCH or sound packages.
  • Loading branch information
andywolk committed May 25, 2020
1 parent ef70d4d commit 7490fba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Freeswitch.2017.sln.bat
Original file line number Diff line number Diff line change
@@ -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 runs (probably only) from the commandline
@REM usage: Freeswitch.2017.sln [[[.*]ebug] [[.*]elease] [[.*]64] [[.*]32]]
Expand Down Expand Up @@ -47,13 +47,13 @@
@set procs=%NUMBER_OF_PROCESSORS%
@set /a procs -= 1

@REM check and set VS2017 environment
@REM check and set Visual Studio environment
CALL msbuild.cmd

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 (
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

Expand Down
10 changes: 5 additions & 5 deletions msbuild.cmd
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
@REM check and set VS2017 environment
rem VS2017U2 contains vswhere.exe
@REM check and set Visual Studio environment
rem There is vswhere.exe starting VS2017U2
if "%VSWHERE%"=="" set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"

rem Use %ProgramFiles% in a 32-bit program prior to Windows 10)
If Not Exist "%VSWHERE%" set "VSWHERE=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"

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..."
set "InstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
set "InstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
) ELSE (
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
)

echo Install dir is "%InstallDir%"
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
set msbuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe"
if exist "%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" (
set msbuild="%InstallDir%\MSBuild\Current\Bin\MSBuild.exe"
)
10 changes: 5 additions & 5 deletions w32/Setup/Sounds/build_sounds.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for /F "tokens=*" %%A in (%cd%\..\..\..\build\sounds_upgradecode.txt) do (
)

) 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
)

Expand All @@ -25,11 +25,11 @@ EXIT /B %ERRORLEVEL%
:Build
set SoundPrimaryName=%1
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
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
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
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

0 comments on commit 7490fba

Please sign in to comment.