version: 2015.1.{build}
clone_depth: 1

skip_commits:
    message: /(iiod|IIOD):.*/

install:
    - echo "Checking out sub-modules..."
    - git submodule update --init
    - echo "Downloading deps..."
    - cd c:\
    - appveyor DownloadFile http://swdownloads.analog.com/cse/build/libiio-win-deps.zip
    - 7z x -y "c:\libiio-win-deps.zip" > nul
    - choco install InnoSetup
    - set PATH=%PATH%;"C:\Program Files (x86)\Inno Setup 5"

build_script:
    - echo "Running cmake for Win32..."
    - mkdir c:\projects\libiio\build-win32
    - cd c:\projects\libiio\build-win32
    - set MCS_EXECUTABLE_PATH="C:\Windows\Microsoft.NET\Framework\v4.0.30319"
    - cmake -G "Visual Studio 12" -DCMAKE_BUILD_TYPE:STRING=Release \
        -DENABLE_IPV6:BOOL=OFF -DCMAKE_SYSTEM_PREFIX_PATH="C:" \
        -DPYTHON_BINDINGS:BOOL=OFF \
        -DLIBXML2_LIBRARIES="C:\\libs\\32\\libxml2.lib" \
        -DLIBUSB_LIBRARIES="C:\\libs\\32\\libusb-1.0.lib" \
        -DLIBSERIALPORT_LIBRARIES="C:\\libs\\32\\libserialport.dll.a" \
        ..
    - cmake --build . --config Release

    - echo "Running cmake for Win64..."
    - mkdir c:\projects\libiio\build-win64
    - cd c:\projects\libiio\build-win64
    - cmake -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE:STRING=Release \
        -DENABLE_IPV6:BOOL=OFF -DCSHARP_BINDINGS:BOOL=OFF \
        -DPYTHON_BINDINGS:BOOL=OFF \
        -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" \
        -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" \
        -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" \
        -DCMAKE_SYSTEM_PREFIX_PATH="C:" \
        ..
    - cmake --build . --config Release
    - ISCC C:\projects\libiio\build-win32\libiio.iss
    - appveyor PushArtifact C:\libiio-setup.exe

    # Create ZIP packages as well
    - cd c:\projects\libiio
    - mkdir c:\libiio-win32
    - copy iio.h c:\libiio-win32\
    - copy build-win32\Release\libiio.* c:\libiio-win32\
    - copy build-win32\tests\Release\*.exe c:\libiio-win32\
    - copy c:\libs\32\libxml2.dll c:\libiio-win32\
    - copy c:\libs\32\libusb-1.0.dll c:\libiio-win32\
    - copy c:\libs\32\libserialport-0.dll c:\libiio-win32\
    - copy "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x86\Microsoft.VC120.CRT\msvcr120.dll" c:\libiio-win32\
    - xcopy /S bindings\matlab c:\libiio-win32\matlab\
    - del c:\libiio-win32\matlab\CMakeLists.txt
    - 7z a "c:\libiio-win32.zip" c:\libiio-win32
    - appveyor PushArtifact c:\libiio-win32.zip

    - mkdir c:\libiio-win64
    - copy iio.h c:\libiio-win64\
    - copy build-win64\Release\libiio.* c:\libiio-win64\
    - copy build-win64\tests\Release\*.exe c:\libiio-win64\
    - copy c:\libs\64\libxml2.dll c:\libiio-win64\
    - copy c:\libs\64\libusb-1.0.dll c:\libiio-win64\
    - copy c:\libs\64\libserialport-0.dll c:\libiio-win64\
    - copy "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x64\Microsoft.VC120.CRT\msvcr120.dll" c:\libiio-win64\
    - xcopy /S bindings\matlab c:\libiio-win64\matlab\
    - del c:\libiio-win64\matlab\CMakeLists.txt
    - 7z a "c:\libiio-win64.zip" c:\libiio-win64
    - appveyor PushArtifact c:\libiio-win64.zip
