# scripts to run before build
before_build:
  - echo Running cmake...
  - set QTDIR=C:\Qt\5.8\msvc2015_64
  - set PATH=%PATH%;%QTDIR%\bin
  - set INSTALL_DIR_LOCAL=%CD%
  - mkdir build
  - cd build
  - cmake .. -DWITH_QT5=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR_LOCAL% -G "Visual Studio 14 2015 Win64"
  
# force Release in the build
build_script:
  - cmake --build . --target INSTALL --config Release
  - cd ..
  # copy Qt DLL into bin
  - copy %QTDIR%\bin\Qt5Core.dll    bin
  - copy %QTDIR%\bin\Qt5Gui.dll     bin
  - copy %QTDIR%\bin\Qt5Xml.dll     bin
  - copy %QTDIR%\bin\Qt5OpenGL.dll  bin
  - copy %QTDIR%\bin\Qt5Widgets.dll bin
  - mkdir bin\platforms
  - copy %QTDIR%\plugins\platforms\qwindows.dll bin\platforms
  - mkdir bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qjpeg.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qgif.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qicns.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qico.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qsvg.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qtga.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qtiff.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qwbmp.dll bin\imageformats
  - copy %QTDIR%\plugins\imageformats\qwebp.dll bin\imageformats
  

after_build:
  - 7z a micmac_win.zip bin\ binaire-aux\ include\XML_MicMac\ include\XML_GEN\ include\qt
  
artifacts:
  path: micmac_win.zip
  name: micmac_win

deploy:
  description: 'AppVeyor build'
  artifact: micmac_win
  auth_token:
    secure: /bJuMkK+l78lspexK/xcdi0TsITsIuiuW7nNnY8Aw1cI+k33h4epHXs2z/f6sJjJ
  provider: GitHub
  on:
    appveyor_repo_tag: true
