build:ubuntu_cpp:
  stage: build
  needs: []
  tags:
    - docker

  script:
    - mkdir -p build_cpp
    - mkdir -p install_cpp
    - cd build_cpp
    - cmake -DCMAKE_INSTALL_PREFIX:PATH=../install_cpp -DCMAKE_BUILD_TYPE=Debug -DWERROR=ON -DCOVERAGE=ON ..
    - make -j4 all install

  artifacts:
    paths:
      - build_cpp/
      - install_cpp/

build:ubuntu_python:
  stage: build
  needs: []
  tags:
    - docker

  script:
    - python3 -m pip install virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - export AIDGE_INSTALL=`pwd`/install
    - python3 -m pip install .
  artifacts:
    paths:
      - venv/

build:windows_cpp:
  stage: build
  needs: []
  tags:
    - windows

  image: mcr.microsoft.com/windows/servercore:ltsc2022
  before_script:
    - Invoke-WebRequest -UseBasicParsing "https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4-windows-x86_64.msi" -o cmake-3.27.4-windows-x86_64.msi
    - MsiExec.exe /i cmake-3.27.4-windows-x86_64.msi ADD_CMAKE_TO_PATH=System /qn
    - Invoke-WebRequest -UseBasicParsing "https://aka.ms/vs/17/release/vs_buildtools.exe" -o vs_buildtools.exe
    - .\vs_buildtools.exe -q
    # Update current session env PATH
    - $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 
  script:
    - mkdir -p build_cpp
    - mkdir -p install_cpp
    - cd build_cpp
    - cmake -DCMAKE_INSTALL_PREFIX:PATH=../install_cpp -DCMAKE_BUILD_TYPE=Debug ..
    - make -j2 all install
