clone_folder: c:\project\opencpn
shallow_clone: false
clone_depth: 10

image:
- Visual Studio 2017

platform: 
# - x64
- Win32

configuration: RelWithDebInfo
test: OFF

install:
  # VS2015 and earlier version - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86'
  - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
  
  # set environment variables for wxWidgets
  - set WXWIN=C:\wxWidgets-3.1.2
  - set wxWidgets_ROOT_DIR=%WXWIN%
  - set wxWidgets_LIB_DIR=%WXWIN%\lib\vc_dll
  - cmd: SET PATH=%PATH%;%WXWIN%;%wxWidgets_LIB_DIR%;C:\Program Files (x86)\Poedit\Gettexttools\bin;C:\Program Files\Git\bin;c:\cygwin\bin
  - cmd: python3.6m --version

  # install dependencies:
  - choco install poedit
  - choco install git

  # - choco install nsi -x86
  - ps: Start-FileDownload http://opencpn.navnux.org/build_deps/nsis-3.04-setup.exe
  - cmd: nsis-3.04-setup.exe /S

  # Download and unzip wxwidgets
  - ps: Start-FileDownload http://opencpn.navnux.org/build_deps/wxWidgets-3.1.2.7z
  - cmd: 7z x wxWidgets-3.1.2.7z -o%WXWIN% > null

  # some debugging information
  # - set   Displays sensitive password!
  # - cmake --help

  # build wxWidgets - Disabled as we provide prebuilt WX to save time
  #- cmd: cd %WXWIN%\build\msw\
  #- cmd: nmake -f makefile.vc BUILD=release SHARED=1 CFLAGS=/D_USING_V120_SDK71_ CXXFLAGS=/D_USING_V120_SDK71_
  #- cmd: nmake -f makefile.vc BUILD=debug SHARED=1 CFLAGS=/D_USING_V120_SDK71_ CXXFLAGS=/D_USING_V120_SDK71_

before_build:
  - cd c:\project\opencpn
  - mkdir build
  - cd build
  - ps: Start-FileDownload http://opencpn.navnux.org/build_deps/OpenCPN_buildwin-4.99a.7z
  - cmd: 7z x -y OpenCPN_buildwin-4.99a.7z -oc:\project\opencpn\buildwin
  - cmake -T v141_xp -DOCPN_CI_BUILD=ON ..

build_script:
  # - cmake --build . --config debug
  - cmake --build . --target opencpn --config RelWithDebInfo
  - cmake --build . --target package --config RelWithDebInfo

deploy_script: 
  - |
      cd %APPVEYOR_BUILD_FOLDER%\ci
      "\Program Files\Git\bin\bash" appveyor-upload.sh
