* Consolidate msbuild and test logic into separate batch files, so helper scripts don't need to duplicate too much.

* Use tools\vcvars.cmd, rather than directly linking against the VS2017 cmd.

* Add the ability to specifiy custom properties to RunMsBuild.bat

* Move build-all.bat to use RunMsBuild.bat, remove references to non-existant vcvars-ext.bat
This commit is contained in:
Matthew Koscumb 2021-05-05 12:07:08 -07:00 коммит произвёл GitHub
Родитель 59889aa4cc
Коммит eb779d0880
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 52 добавлений и 73 удалений

Просмотреть файл

@ -3,16 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
echo "Building using Visual Studio 2017 tools"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=Debug /p:Platform=Win32
if errorLevel 1 goto end
Solutions\out\Debug\Win32\UnitTests\UnitTests.exe
if errorLevel 1 goto end
Solutions\out\Debug\Win32\FuncTests\FuncTests.exe
:end
call tools\RunMsBuild.bat Win32 Debug "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests"
call tools\RunTests.bat Win32 Debug

Просмотреть файл

@ -3,16 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
echo "Building using Visual Studio 2017 tools"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=Release /p:Platform=Win32
if errorLevel 1 goto end
Solutions\out\Release\Win32\UnitTests\UnitTests.exe
if errorLevel 1 goto end
Solutions\out\Release\Win32\FuncTests\FuncTests.exe
:end
call tools\RunMsBuild.bat Win32 Release "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests"
call tools\RunTests.bat Win32 Release

Просмотреть файл

@ -12,14 +12,8 @@ if DEFINED GIT_PULL_TOKEN (
git clone https://%GIT_PULL_TOKEN%:x-oauth-basic@github.com/microsoft/cpp_client_telemetry_modules.git lib\modules
)
call tools\vcvars.cmd
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
set CUSTOM_PROPS=
if ("%1"=="") goto skip
if ("%~1"=="") goto skip
set CUSTOM_PROPS="/p:ForceImportBeforeCppTargets=%1"
echo Using custom properties file for the build:
echo %CUSTOM_PROPS%
@ -28,45 +22,43 @@ echo %CUSTOM_PROPS%
if NOT DEFINED SKIP_MD_BUILD (
REM DLL and static /MD build
REM Release
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=x64 %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Release "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Release "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests" %CUSTOM_PROPS%
REM Debug
if NOT DEFINED SKIP_DEBUG_BUILD (
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=x64 %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Debug "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Debug "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests" %CUSTOM_PROPS%
)
)
if NOT DEFINED SKIP_MT_BUILD (
REM Static /MT build
REM Release
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release.vs2015.MT-sqlite /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release.vs2015.MT-sqlite /p:Platform=x64 %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Release.vs2015.MT-sqlite "sqlite,zlib,win32-lib" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Release.vs2015.MT-sqlite "sqlite,zlib,win32-lib" %CUSTOM_PROPS%
REM Debug
if NOT DEFINED SKIP_DEBUG_BUILD (
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug.vs2015.MT-sqlite /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug.vs2015.MT-sqlite /p:Platform=x64 %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Debug.vs2015.MT-sqlite "sqlite,zlib,win32-lib" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Debug.vs2015.MT-sqlite "sqlite,zlib,win32-lib" %CUSTOM_PROPS%
)
)
if NOT DEFINED SKIP_ARM_BUILD (
REM ARM DLL build
call tools\vcvars-ext.cmd arm
REM Release
msbuild %SOLUTION% /target:zlib,sqlite-uwp,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=ARM %CUSTOM_PROPS%
call tools\RunMsBuild.bat ARM Release "zlib,sqlite-uwp,win10-cs,win10-dll" %CUSTOM_PROPS%
if NOT DEFINED SKIP_DEBUG_BUILD (
REM Debug
msbuild %SOLUTION% /target:zlib,sqlite-uwp,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=ARM %CUSTOM_PROPS%
call tools\RunMsBuild.bat ARM Debug "zlib,sqlite-uwp,win10-cs,win10-dll" %CUSTOM_PROPS%
)
)
if NOT DEFINED SKIP_ARM64_BUILD (
REM ARM64 DLL build
call tools\vcvars-ext.cmd arm64
REM Release
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=ARM64 %CUSTOM_PROPS%
call tools\RunMsBuild.bat ARM64 Release "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll" %CUSTOM_PROPS%
if NOT DEFINED SKIP_DEBUG_BUILD (
REM Debug
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=ARM64 %CUSTOM_PROPS%
call tools\RunMsBuild.bat ARM64 Debug "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll" %CUSTOM_PROPS%
)
)

Просмотреть файл

@ -3,16 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
echo "Building using Visual Studio 2017 tools"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=Debug /p:Platform=x64
if errorLevel 1 goto end
Solutions\out\Debug\x64\UnitTests\UnitTests.exe
if errorLevel 1 goto end
Solutions\out\Debug\x64\FuncTests\FuncTests.exe
:end
call tools\RunMsBuild.bat x64 Debug "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests"
call tools\RunTests.bat x64 Debug

Просмотреть файл

@ -3,16 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
echo "Building using Visual Studio 2017 tools"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=Release /p:Platform=x64
if errorLevel 1 goto end
Solutions\out\Release\x64\UnitTests\UnitTests.exe
if errorLevel 1 goto end
Solutions\out\Release\x64\FuncTests\FuncTests.exe
:end
call tools\RunMsBuild.bat x64 Release "sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests"
call tools\RunTests.bat x64 Release

21
tools/RunMsBuild.bat Normal file
Просмотреть файл

@ -0,0 +1,21 @@
@echo off
@setlocal ENABLEEXTENSIONS
set TARGETPLATFORM=%1
set CONFIGURATION=%2
set TARGETS=%~3
set CUSTOM_PROPS=
if ("%~4" == "") goto endCustomProps
set CUSTOM_PROPS=%4
echo Using custom properties file for the build:
echo %CUSTOM_PROPS%
:endCustomProps
call tools\vcvars.cmd
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
msbuild %SOLUTION% /target:%TARGETS% /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=%CONFIGURATION% /p:Platform=%TARGETPLATFORM% %CUSTOM_PROPS%

10
tools/RunTests.bat Normal file
Просмотреть файл

@ -0,0 +1,10 @@
@echo off
@setlocal ENABLEEXTENSIONS
set TARGETPLATFORM=%1
set TARGETCONFIGURATION=%2
if errorLevel 1 goto end
Solutions\out\%TARGETCONFIGURATION%\%TARGETPLATFORM%\UnitTests\UnitTests.exe
if errorLevel 1 goto end
Solutions\out\%TARGETCONFIGURATION%\%TARGETPLATFORM%\FuncTests\FuncTests.exe
:end