1version: '{build}'
2
3os: Visual Studio 2015
4
5environment:
6  matrix:
7    - compiler: msvc-15-seh
8      generator: "Visual Studio 15 2017"
9      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
10
11    - compiler: msvc-15-seh
12      generator: "Visual Studio 15 2017 Win64"
13      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
14      enabled_on_pr: yes
15
16    - compiler: msvc-14-seh
17      generator: "Visual Studio 14 2015"
18      enabled_on_pr: yes
19
20    - compiler: msvc-14-seh
21      generator: "Visual Studio 14 2015 Win64"
22
23    - compiler: gcc-5.3.0-posix
24      generator: "MinGW Makefiles"
25      cxx_path: 'C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin'
26
27    - compiler: gcc-6.3.0-posix
28      generator: "MinGW Makefiles"
29      cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
30
31configuration:
32  - Debug
33
34build:
35  verbosity: minimal
36
37install:
38- ps: |
39    Write-Output "Compiler: $env:compiler"
40    Write-Output "Generator: $env:generator"
41    if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
42      Write-Output "This is *NOT* a pull request build"
43    } else {
44      Write-Output "This is a pull request build"
45      if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") {
46        Write-Output "PR builds are *NOT* explicitly enabled"
47      }
48    }
49
50    # git bash conflicts with MinGW makefiles
51    if ($env:generator -eq "MinGW Makefiles") {
52        $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "")
53        if ($env:cxx_path -ne "") {
54            $env:path += ";$env:cxx_path"
55        }
56    }
57
58build_script:
59- ps: |
60    # Only enable some builds for pull requests, the AppVeyor queue is too long.
61    if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
62      return
63    }
64    md _build -Force | Out-Null
65    cd _build
66
67    $conf = if ($env:generator -eq "MinGW Makefiles") {"-DCMAKE_BUILD_TYPE=$env:configuration"} else {"-DCMAKE_CONFIGURATION_TYPES=Debug;Release"}
68    # Disable test for MinGW (gtest tests fail, gmock tests can not build)
69    $gtest_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgtest_build_tests=OFF"} else {"-Dgtest_build_tests=ON"}
70    $gmock_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgmock_build_tests=OFF"} else {"-Dgmock_build_tests=ON"}
71    & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests ..
72    if ($LastExitCode -ne 0) {
73        throw "Exec: $ErrorMessage"
74    }
75    $cmake_parallel = if ($env:generator -eq "MinGW Makefiles") {"-j2"} else  {"/m"}
76    & cmake --build . --config $env:configuration -- $cmake_parallel
77    if ($LastExitCode -ne 0) {
78        throw "Exec: $ErrorMessage"
79    }
80
81
82skip_commits:
83  files:
84    - '**/*.md'
85
86test_script:
87- ps: |
88    # Only enable some builds for pull requests, the AppVeyor queue is too long.
89    if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
90      return
91    }
92    if ($env:generator -eq "MinGW Makefiles") {
93        return # No test available for MinGW
94    }
95    & ctest -C $env:configuration --timeout 600 --output-on-failure
96    if ($LastExitCode -ne 0) {
97        throw "Exec: $ErrorMessage"
98    }
99
100artifacts:
101  - path: '_build/CMakeFiles/*.log'
102    name: logs
103  - path: '_build/Testing/**/*.xml'
104    name: test_results
105