# version string format -- This will be overwritten later anyway
version: "{build}"

# We need a more up to date pip because Python 2.7 is EOL soon
init:
  - set PATH=C:\Python35\Scripts;%PATH%


branches:
  except:
    - /dev-travis.+/

os:
  - Visual Studio 2017
  - Visual Studio 2015

environment:
    matrix:
        - additional_flags: "/permissive- /std:c++latest"
          wmain: 0

        - additional_flags: ""
          wmain: 0

        - additional_flags: "/D_UNICODE /DUNICODE"
          wmain: 1
          coverage: 0

        # Have a coverage dimension
        - additional_flags: ""
          wmain: 0
          coverage: 1

        # Have an examples dimension
        - additional_flags: ""
          wmain: 0
          examples: 1


matrix:
    exclude:
        - os: Visual Studio 2015
          additional_flags: "/permissive- /std:c++latest"

        - os: Visual Studio 2015
          additional_flags: "/D_UNICODE /DUNICODE"

        # Exclude unwanted coverage configurations
        - coverage: 1
          platform: Win32

        - coverage: 1
          os: Visual Studio 2015

        - coverage: 1
          configuration: Release

        # Exclude unwanted examples configurations
        - examples: 1
          platform: Win32

        - examples: 1
          os: Visual Studio 2015

        - examples: 1
          configuration: Release


install:
  - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { pip --disable-pip-version-check install codecov }
  - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\misc\installOpenCppCoverage.ps1 }

# Win32 and x64 are CMake-compatible solution platform names.
# This allows us to pass %PLATFORM% to CMake -A.
platform:
  - Win32
  - x64

# build Configurations, i.e. Debug, Release, etc.
configuration:
  - Debug
  - Release

#Cmake will autodetect the compiler, but we set the arch
before_build:
  - set CXXFLAGS=%additional_flags%
  # Indirection because appveyor doesn't handle multiline batch scripts properly
  # https://stackoverflow.com/questions/37627248/how-to-split-a-command-over-multiple-lines-in-appveyor-yml/37647169#37647169
  # https://help.appveyor.com/discussions/questions/3888-multi-line-cmd-or-powershell-warning-ignore
  - cmd: .\misc\appveyorBuildConfigurationScript.bat


# build with MSBuild
build:
  project: Build\Catch2.sln             # path to Visual Studio solution or project
  parallel: true                        # enable MSBuild parallel builds
  verbosity: normal                     # MSBuild verbosity level {quiet|minimal|normal|detailed}

test_script:
  - set CTEST_OUTPUT_ON_FAILURE=1
  - cmd: .\misc\appveyorTestRunScript.bat
