environment:
  OPENSSL_LIBS: ssleay32:libeay32
  matrix:
  # 64-bit MSVC builds currently hang when trying to run the coverage crate
  # lib test. Suppressed this configuration for now to allow for the overall
  # build to succeed
  # - TARGET: x86_64-pc-windows-msvc
  #  BITS: 64
  - TARGET: i686-pc-windows-msvc
    BITS: 32
  - TARGET: i686-pc-windows-gnu
    BITS: 32

shallow_clone: true

install:
  - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe"
  - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
  - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
  - SET PATH=%PATH%;C:\MinGW\bin
  - SET OPENSSL_INCLUDE_DIR=C:\OpenSSL-Win%BITS%\include
  - SET OPENSSL_LIB_DIR=C:\OpenSSL-Win%BITS%\lib
  - rustc -V
  - cargo -V

build: false

test_script:
  - cargo test

environment:
  OPENSSL_LIBS: ssleay32:libeay32
  RUST_DIR: C:\Rust\
  matrix:
  - TARGET: x86_64-pc-windows-msvc
    BITS: 64
  - TARGET: i686-pc-windows-msvc
    BITS: 32
  - TARGET: i686-pc-windows-gnu
    BITS: 32

shallow_clone: true

install:
  - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.msi"
  - msiexec /i rust-nightly-%TARGET%.msi /quiet /passive /qn /norestart INSTALLDIR=%RUST_DIR%
  - SET PATH=%PATH%;%RUST_DIR%\bin
  - SET PATH=%PATH%;C:\MinGW\bin
  - SET OPENSSL_INCLUDE_DIR=C:\OpenSSL-Win%BITS%\include
  - SET OPENSSL_LIB_DIR=C:\OpenSSL-Win%BITS%\lib
  - rustc -V
  - cargo -V

build: false

test_script:
  # The copy helps DLL search resolve compatible versions of OpenSSL DLLs for
  # the build target executable. This works around the AppVeyor build
  # environment preferring to load DLLs that would be incompatible with 64-bit
  # build configurations.
  - ps: cp -path "C:\OpenSSL-Win${env:BITS}\*.dll" -destination (md -force "$env:APPVEYOR_BUILD_FOLDER\target\debug")
  - cargo test

Resolve failing 64-bit configurations for Appveyor
Resolve failing 64-bit configurations for Appveyor

After a lot of poking around using RDP to investigate 64-bit build
configurations that appeared to freeze, it seems like incompatible OpenSSL
DLLs were the culprit.

The freezing was due to a rather cryptic error dialog that showed itself
only when the `lib` test executable is run. The failing builds all
appeared to be loading OpenSSL DLLs that were not compatible with the
build target. Once OpenSSL DLLs were copied into the same directory as the
test executable, the error was gone, likely due to how standard DLL search
prefers DLLs in the same directory as the program executing.
