LSFramework/CMake/CMake.1.6.0/AutoBuild/BuildVS2017Project.cmd
2022-06-23 13:44:39 +02:00

77 lines
2.9 KiB
Batchfile

@ECHO OFF
REM //========================================================================
REM // Copyright (c) Technische Software Entwicklung Plazotta © 2021
REM //
REM // DESCRIPTION:
REM // Batch Building a VS2017 Project, running the Unittest and finally start the install step
REM //
REM // HISTORY:
REM // 09.04.2021 / PP
REM // Module created.
REM //========================================================================
setlocal
setlocal enabledelayedexpansion
pushd .
REM =======================================================================
REM Check Parameter
REM =======================================================================
set TestFiles=%3
set TestFiles=%TestFiles:"=%
@if "%1"=="" goto HELP
@if "%2"=="" goto HELP
@if "%TestFiles%"=="" goto NO_PARSE
set TestFiles=%TestFiles:,= %
:NO_PARSE
REM =======================================================================
REM Show Parameter
REM =======================================================================
echo =======================================================================
echo Build Parameter
echo =======================================================================
echo Project = %1
echo Configuration = %2
echo Unit Test Executable = %TestFiles%
echo =======================================================================
echo .
REM =======================================================================
REM Setup the VS2017 environment
REM =======================================================================
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\vsdevcmd"
REM
REM =======================================================================
REM Rebuild the project
REM =======================================================================
cd ..\..\..\BuildResults\msvc2017_x64
devenv %1.sln /rebuild %2
IF %ERRORLEVEL% NEQ 0 goto ERROR
REM
REM =======================================================================
REM Run all unit tests
REM =======================================================================
for %%f in (%TestFiles%) do (
start /WAIT %2\bin\%%f.exe
IF !ERRORLEVEL! NEQ 0 goto ERROR
)
REM
REM =======================================================================
REM Install files
REM =======================================================================
devenv %1.sln /build %2 /Project INSTALL
IF %ERRORLEVEL% NEQ 0 goto ERROR
goto END
REM
REM =======================================================================
REM Error
REM =======================================================================
:ERROR
echo Error during build ...
exit /b 1
REM
REM =======================================================================
REM HELP
REM =======================================================================
:HELP
echo Usage BuildVs2017Project [ProjectName] [Configuration] [UnitTestExe]
echo .
:END
exit /b 0