aboutsummaryrefslogtreecommitdiffstats
path: root/.ci/templates/steps-build-uhd-make.yml
blob: 1882b53ba88a3ffe41b8a7a10edf507424e0ca47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
parameters:
- name: uhdSrcDir
  type: string
- name: uhdBuildDir
  type: string
- name: uhdEnableTraceLog
  type: boolean
  default: false
- name: uhdAllowWarnings
  type: boolean
  default: false
- name: uhdCxxFlags
  type: string
  default: ""
- name: uhdCustomBoostPackage
  type: boolean
  default: false
- name: uhdCustomBoostPackageURL
  type: string
  default: 'https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2'


steps:
# If we are requested to use a custom Boost package, then we download and build
# it first
- ${{ if parameters.uhdCustomBoostPackage }}:
  - bash: |
      cd $(Pipeline.Workspace)
      echo "Entering workspace directory:"
      pwd
      rm -rf boost
      mkdir boost
      cd boost
      # We reimplement tar's -a flag here so we can pipe from curl straight to tar
      if [[ "${{ parameters.uhdCustomBoostPackageURL }}" =~ bz2$ ]]; then
          export TAR_EXTRACT_FLAG="j"
      elif [[ "${{ parameters.uhdCustomBoostPackageURL }}" =~ gz2$ ]]; then
          export TAR_EXTRACT_FLAG="x"
      elif [[ "${{ parameters.uhdCustomBoostPackageURL }}" =~ xz$ ]]; then
          export TAR_EXTRACT_FLAG="J"
      fi
      curl -L ${{ parameters.uhdCustomBoostPackageURL }} | tar -x -$TAR_EXTRACT_FLAG
      export BOOST_DIR=`pwd`/`ls | head -1`
      echo "Using Boost directory: $BOOST_DIR"
      echo "##vso[task.setvariable variable=CustomBoostPath;isOutput=true;]$BOOST_DIR"
      cd $BOOST_DIR
      ./bootstrap.sh
      ./b2 -j$(nproc)
    displayName: "Build Custom Boost Version"
    name: build_boost_step

- script: |
    mkdir -p ${{ parameters.uhdBuildDir }}
    cd ${{ parameters.uhdBuildDir }}
    if [[ "${{ parameters.uhdEnableTraceLog }}" = "True" ]]; then
      echo "Enabling UHD Tracing"
      export UHD_CI_CMAKE_OPTIONS="-DUHD_LOG_MIN_LEVEL=trace $UHD_CI_CMAKE_OPTIONS"
    fi
    if [[ "${{ parameters.uhdAllowWarnings }}" = "False" ]]; then
      echo "Warnings not allowed for this build."
      export CXXFLAGS="-Werror -Wno-error=maybe-uninitialized $CXXFLAGS"
    fi
    export CXXFLAGS="${{ parameters.uhdCxxFlags }} $CXXFLAGS"
    if [[ "${{ parameters.uhdCustomBoostPackage }}" = "True" ]]; then
      export BOOST_CMAKE_DIR=$(dirname `find $(build_boost_step.CustomBoostPath)/stage/lib -name BoostConfig.cmake`)
      export UHD_CI_CMAKE_OPTIONS="-DBoost_INCLUDE_DIR=$(build_boost_step.CustomBoostPath) -DBoost_DIR=$BOOST_CMAKE_DIR -DBoost_LIBRARY_DIRS=$(build_boost_step.CustomBoostPath)/stage/lib $UHD_CI_CMAKE_OPTIONS"
    fi
    cmake \
      $UHD_CI_CMAKE_OPTIONS \
      ${{ parameters.uhdSrcDir }}/host
  displayName: cmake make UHD

- script: |
    cd ${{ parameters.uhdBuildDir }}
    make -j$(nproc) -k
  displayName: make UHD
- script: |
    cd ${{ parameters.uhdBuildDir }}
    ctest --no-compress-output --output-on-failure -T test
  continueOnError: true
  displayName: ctest make UHD