diff --git a/clean_build.bat b/clean_build.bat index b1f0410c..e45f334b 100644 --- a/clean_build.bat +++ b/clean_build.bat @@ -10,6 +10,18 @@ set B_BONJOUR=C:\Program Files\Bonjour SDK set savedir=%cd% cd /d %~dp0 +REM cmake generator name for the target build system +if "%VisualStudioVersion%"=="15.0" ( + set cmake_gen=Visual Studio 15 2017 +) else if "%VisualStudioVersion%"=="16.0" ( + set cmake_gen=Visual Studio 16 2019 +) else ( + echo Visual Studio version was not detected. + echo Did you forget to run inside a VS developer prompt? + echo Using the default cmake generator. + set cmake_gen=Visual Studio 16 2019 +) + if exist build_env.bat call build_env.bat REM needed by cmake to set bonjour include dir @@ -25,7 +37,7 @@ rmdir /q /s build mkdir build if ERRORLEVEL 1 goto failed cd build -cmake -G "Visual Studio 15 2017 Win64" -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D DNSSD_LIB="%B_BONJOUR%\Lib\x64\dnssd.lib" -D QT_VERSION=%B_QT_VER% .. +cmake -G "%cmake_gen%" -A x64 -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D DNSSD_LIB="%B_BONJOUR%\Lib\x64\dnssd.lib" -D QT_VERSION=%B_QT_VER% .. if ERRORLEVEL 1 goto failed echo @msbuild barrier.sln /p:Platform="x64" /p:Configuration=%B_BUILD_TYPE% /m %B_BUILD_OPTIONS% > make.bat call make.bat @@ -69,3 +81,4 @@ set B_BONJOUR= set BONJOUR_SDK_HOME= set B_QT_FULLPATH= set savedir= +set cmake_gen=