#################################################
# BUILD
#################################################

.build_all_linux_script: &build_all_linux_script |
  cmake --version
  export CC=$CC
  export CXX=$CXX
  mkdir -p build/OUTPUT
  echo $CI_BUILD_TYPE
  echo $CMAKE_GENERATOR
  echo $DEFAULT_LINUX_CMAKE_OPTIONS
  echo $CMAKE_SANITIZER_OPTIONS
  cd build
  eval "$(qtchooser -qt=$QT_LINUX_VER -print-env)"
  export PATH=${QTTOOLDIR}:$PATH
  export Qt6_DIR=${QTLIBDIR}/cmake/Qt6
  echo "Using Qt $QT_LINUX_VER at ${QTLIBDIR}"
  cmake .. -G "$CMAKE_GENERATOR" -DCMAKE_VERBOSE_MAKEFILE=ON -DLINPHONESDK_PLATFORM=Desktop -DCMAKE_BUILD_TYPE=$CI_BUILD_TYPE -DLINPHONEAPP_APPLICATION_NAME="$APPLICATION_NAME" -DLINPHONEAPP_EXECUABLE_NAME="$EXECUTABLE_NAME" $DEFAULT_LINUX_CMAKE_OPTIONS $CMAKE_OPTIONS $SCHEDULE_CMAKE_OPTIONS $CMAKE_SANITIZER_OPTIONS 
  cmake --build . --target install --config $CI_BUILD_TYPE $LBC_NODEBUG_OPTIONS
  
.linux-desktop:
  stage: build
  extends: .linux-prepare
  script:
    - *build_all_linux_script
  artifacts:
    paths:
      - build/OUTPUT
    expire_in: 1 week
