Replace MSBuild with Ninja

This commit is contained in:
Roelf-Jilling 2018-11-17 22:26:33 +01:00
parent 944751d03e
commit 39b32ff7d6

View File

@ -13,6 +13,11 @@ image:
- Visual Studio 2017 - Visual Studio 2017
environment: environment:
NINJA_TAG: v1.8.2
NINJA_SHA512: 9B9CE248240665FCD6404B989F3B3C27ED9682838225E6DC9B67B551774F251E4FF8A207504F941E7C811E7A8BE1945E7BCB94472A335EF15E23A0200A32E6D5
NINJA_PATH: C:\Tools\ninja\ninja-%NINJA_TAG%
VCVAR2015: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat'
VCVAR2017: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
matrix: matrix:
- GSL_CXX_STANDARD: 14 - GSL_CXX_STANDARD: 14
USE_TOOLSET: MSVC USE_TOOLSET: MSVC
@ -32,9 +37,21 @@ matrix:
cache: cache:
- C:\cmake-3.8.0-win32-x86 - C:\cmake-3.8.0-win32-x86
- C:\Tools\ninja
install: install:
- ps: | - ps: |
if (![IO.File]::Exists("$env:NINJA_PATH\ninja.exe")) {
Start-FileDownload `
"https://github.com/ninja-build/ninja/releases/download/$env:NINJA_TAG/ninja-win.zip"
$hash = (Get-FileHash ninja-win.zip -Algorithm SHA512).Hash
if ($env:NINJA_SHA512 -eq $hash) {
7z e -y ninja-win.zip -o"$env:NINJA_PATH"
} else { Write-Warning "Ninja download hash changed!"; Write-Output "$hash" }
}
if ([IO.File]::Exists("$env:NINJA_PATH\ninja.exe")) {
$env:PATH = "$env:NINJA_PATH;$env:PATH"
} else { Write-Warning "Failed to find ninja.exe in expected location." }
if ($env:USE_TOOLSET -ne "LLVM") { if ($env:USE_TOOLSET -ne "LLVM") {
if (![IO.File]::Exists("C:\cmake-3.8.0-win32-x86\bin\cmake.exe")) { if (![IO.File]::Exists("C:\cmake-3.8.0-win32-x86\bin\cmake.exe")) {
Start-FileDownload 'https://cmake.org/files/v3.8/cmake-3.8.0-win32-x86.zip' Start-FileDownload 'https://cmake.org/files/v3.8/cmake-3.8.0-win32-x86.zip'
@ -52,7 +69,7 @@ install:
git pull --quiet git pull --quiet
cd "$env:APPVEYOR_BUILD_FOLDER" cd "$env:APPVEYOR_BUILD_FOLDER"
} else { } else {
echo "==> vcpkg has been updated, please remove the workaround from appveyor.yml." Write-Warning "vcpkg has been updated, please remove the workaround from appveyor.yml."
} }
} }
@ -60,25 +77,23 @@ before_build:
- ps: | - ps: |
mkdir build > $NULL mkdir build > $NULL
cd build cd build
if ("$env:APPVEYOR_JOB_NAME" -match "Image: Visual Studio 2015") { if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2015") {
$env:generator="Visual Studio 14 2015" $env:VCVARSALL = $env:VCVAR2015
} else { } else {
$env:generator="Visual Studio 15 2017" $env:VCVARSALL = $env:VCVAR2017
} }
if ($env:PLATFORM -eq "x64") { $env:ARCHITECTURE = $env:PLATFORM
$env:generator="$env:generator Win64" if ("$env:USE_TOOLSET" -eq "LLVM") {
} $env:CC = "clang-cl"
echo generator="$env:generator" $env:CXX = "clang-cl"
if ($env:USE_TOOLSET -eq "LLVM") { } elseif ("$env:USE_TOOLSET" -ne "MSVC") {
clang-cl --version Write-Warning "Configuration error: Invalid value for 'USE_TOOLSET'. Assume MSVC"
cmake .. -G "$env:generator" -T llvm -DGSL_CXX_STANDARD="$env:GSL_CXX_STANDARD" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link
}
else {
cmake .. -G "$env:generator" -DGSL_CXX_STANDARD="$env:GSL_CXX_STANDARD"
} }
build_script: build_script:
- cmake --build . --config %CONFIGURATION% -- /m /v:minimal - call "%VCVARSALL%" %ARCHITECTURE%
- cmake .. -G "Ninja" -DGSL_CXX_STANDARD="%GSL_CXX_STANDARD%"
- cmake --build . --config %CONFIGURATION%
test_script: test_script:
- ctest -j2 - ctest -j2