---
version: "{build}-{branch}"
clone_depth: 1

platform:
  - x64

matrix:
  fast_finish: false

environment:
  matrix:
    # - TARGET: vs2019gui
    #   APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2019'
    #   configuration: Release
    #   CMAKE_CUSTOM_OPTIONS: "-DCMAKE_BUILD_TYPE=Release \
    #                          -DARCH_OPT=SSE4_2 \
    #                          -DDEBUG_OUTPUT=ON \
    #                          -DENABLE_MIRISDR=OFF \
    #                          -DBUILD_SERVER=OFF \
    #                          -DCMAKE_PREFIX_PATH=C:\\Qt\\5.15.2\\msvc2019_64;C:\\Libraries\\boost_1_73_0"
    #   CMAKE_GENERATOR: Ninja
    # - TARGET: ubuntu2204prod
    #   APPVEYOR_BUILD_WORKER_CLOUD: nasrock Docker
    #   APPVEYOR_BUILD_WORKER_IMAGE: Linux
    #   CC:  "gcc-11"
    #   CXX: "g++-11"
    #   CMAKE_CUSTOM_OPTIONS: "-DCMAKE_BUILD_TYPE=Release \
    #                          -DARCH_OPT=nehalem \
    #                          -DDEBUG_OUTPUT=ON \
    #                          -DENABLE_EXTERNAL_LIBRARIES=AUTO \
    #                          -DBUILD_SERVER=OFF"
    - TARGET: ubuntu2204docker
      APPVEYOR_BUILD_WORKER_CLOUD: nasrock
      APPVEYOR_BUILD_WORKER_IMAGE: Linux
      APPVEYOR_CONSOLE_DISABLE_PTY: true

for:
#   # - matrix:
#   #     only:
#   #       - TARGET: 'vs2019gui'
#   #   cache:
#   #     - C:\ProgramData\chocolatey\bin
#   #     - C:\ProgramData\chocolatey\lib
#   #   build_script:
#   #     - call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
#   #     # Install GNU patch as applying patches with git fails in BladeRF tree
#   #     - choco install patch
#   #     - git submodule update --init --recursive
#   #     - mkdir build && cd build
#   #     - cmake .. -G "%CMAKE_GENERATOR%" %CMAKE_CUSTOM_OPTIONS%
#   #     - cmake --build . --config Release --target package
#   #   artifacts: # push installer executable
#   #     path: build\*.exe
#   #     name: installer
#   #   deploy:
#   #     release: sdrangel-v$(appveyor_build_version)
#   #     description: 'SDRangel Windows'
#   #     provider: GitHub
#   #     auth_token:
#   #       secure: kyU5TaXRoily6q/QLRLqal2xCFGWEdnb8AJIu7FknsUQyj1wjRGmqC2My+Wfszod
#   #     artifact: installer, portable
#   #     draft: false
#   #     prerelease: false
#   #     tag: $(APPVEYOR_REPO_TAG_NAME) # will not work until tag is pushed
#   #     on:
#   #       APPVEYOR_REPO_TAG: true   # deploy on tag push only
#   #       branch: master            # release from master branch only
#   - matrix:
#       only:
#         - TARGET: ubuntu2204prod
#     clone_folder: /home/appveyor/projects
#     cache:
#       - $HOME/external/
#     install:
#       - sh: sudo apt-get update
#       - sh: echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
#       # not sdrplay with soapysdr; libairspyhf-dev is too old (no lna)
#       - sh: |
#           sudo apt-get -y install build-essential cmake git xxd \
#             devscripts fakeroot debhelper libfftw3-dev qtbase5-dev libopengl-dev libqt5opengl5-dev \
#             qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins libqt5websockets5-dev \
#             libqt5quick5 qtwebengine5-dev qtbase5-private-dev \
#             qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick-window2 qml-module-qtquick-dialogs \
#             qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtgraphicaleffects \
#             libqt5serialport5-dev qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev \
#             libqt5charts5-dev libqt5texttospeech5-dev libqt5gamepad5-dev libqt5svg5-dev libfaad-dev libflac-dev zlib1g-dev \
#             libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
#             libxml2-dev bison flex ffmpeg  libpostproc-dev libavcodec-dev libavformat-dev \
#             libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
#             libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev libhamlib-dev \
#             python3-mako python3-cheetah python3-numpy \
#             autoconf automake libtool ninja-build libclang1-11
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_cm256cc.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_mbelib.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_serialdv.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_dsdcc.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_perseus-sdr.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_xtrx-sdr.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_airspyhf.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_rtlsdr.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_limesuite.sh; fi
#       - sh: if [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES" ]]; then bash cmake/ci/build_ggmorse.sh; fi
#       - sh: bash cmake/ci/build_sdrplay.sh
#     before_build:
#       - sh: bash -c export
#       - sh: bash -c pwd
#     build_script:
#       - sh: ./cmake/ci/build_sdrangel.sh
#     test_script:
#       # debian build path
#       - sh: ./obj-x86_64-linux-gnu/sdrangelbench
#     after_build:
#       - sh: mkdir sdrangel-${APPVEYOR_BUILD_VERSION}
#       - sh: cp ../*.deb ../*.build ../*.buildinfo ../*.changes sdrangel-${APPVEYOR_BUILD_VERSION}
#       - sh: tar -czf sdrangel-${APPVEYOR_BUILD_VERSION}.tar.gz sdrangel-${APPVEYOR_BUILD_VERSION}
#     artifacts:
#       - path: sdrangel-${APPVEYOR_BUILD_VERSION}.tar.gz
#         name: package2204
#     # deploy:
#     #   release: sdrangel-v$(appveyor_build_version)
#     #   description: 'SDRangel Ubuntu 22.04'
#     #   provider: GitHub
#     #   auth_token:
#     #     secure: kyU5TaXRoily6q/QLRLqal2xCFGWEdnb8AJIu7FknsUQyj1wjRGmqC2My+Wfszod
#     #   artifact: archive
#     #   draft: false
#     #   prerelease: false
#     #   on:
#     #     APPVEYOR_REPO_TAG: true        # deploy on tag push only
#     #     branch: master                 # release from master branch only
#     deploy:
#       provider: Environment
#       name: f4exb
  - matrix:
      only:
        - TARGET: ubuntu2204docker
    before_build:
      - git clone https://github.com/f4exb/sdrangel-docker.git
      - cd sdrangel-docker
    build_script:
      - cd sdrangel
      - ./build_vanilla.sh -T ${APPVEYOR_PULL_REQUEST_HEAD_COMMIT:-${APPVEYOR_REPO_COMMIT}}
      - ./build_server.sh -T ${APPVEYOR_PULL_REQUEST_HEAD_COMMIT:-${APPVEYOR_REPO_COMMIT}}
