[Solved] Installing third party dependencies into Rust AppVeyor build


#1

I am attempting to create a working AppVeyor build that will build my Rust Piston game on Windows CI.

https://ci.appveyor.com/project/johnthagen/rust-belt

It depends on piston-music, which depends on SDL and SDL2_Mixer, third party libraries.

I was able to get Travis to build it: https://travis-ci.org/johnthagen/rust-belt but am unsure how to get this to build in AppVeyor.

Anyone ever get something like to work?


#2

Servo has a working appveyor build with a lot of dependency setup. You might see if you get any ideas from our configuration.


#3

Thanks for the tip @jdm!

After a few hours of Powershell hacking I was able to get the build to work: https://ci.appveyor.com/project/johnthagen/rust-belt/build/1.0.71/job/y5ftt17f2vikqjct

In case someone finds this thread in the future, the build script was:

environment:
  global:
    PROJECT_NAME: rust-belt

  matrix:
      - TARGET: x86_64-pc-windows-msvc
        CHANNEL: stable
      - TARGET: x86_64-pc-windows-msvc
        CHANNEL: beta

# Based on https://github.com/japaric/rust-everywhere/blob/master/appveyor.yml
install:
  # Print Powershell version.
  - ps: $PSVersionTable.PSVersion
  - ps: pwd

  # Install Rust and Cargo
  - curl -sSf -o rustup-init.exe https://win.rustup.rs
  - rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y
  - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
  - rustc -Vv
  - cargo -V

  # Add GCC to PATH if needed.
  - if "%TARGET%" == "i686-pc-windows-gnu" set PATH=%PATH%;C:\msys64\mingw32\bin
  - if "%TARGET%" == "x86_64-pc-windows-gnu" set PATH=%PATH%;C:\msys64\mingw64\bin

  # Install SDL2.
  - ps: Start-FileDownload https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip -FileName sdl2.zip
  - ps: Expand-Archive sdl2.zip -DestinationPath sdl2
  - set LIB=%LIB%;C:\projects\rust-belt\sdl2\SDL2-2.0.5\lib\x64

  # Install SDL2_Mixer.
  - ps: Start-FileDownload https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-VC.zip -FileName sdl2_mixer.zip
  - ps: Expand-Archive sdl2_mixer.zip -DestinationPath sdl2_mixer
  - set LIB=%LIB%;C:\projects\rust-belt\sdl2_mixer\SDL2_mixer-2.0.1\lib\x64
  - ps: Get-ChildItem -Recurse -Depth 4

# 'cargo test' takes care of building for us, so disable Appveyor's build stage. This prevents
# the "directory does not contain a project or solution file" error.
# source: https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml#L113
build: false

# Equivalent to Travis' `script` phase
test_script:
  - cargo build --verbose