blob: b88581c54cb768c9332c3d7431ce2ece18c046f9 (
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
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'
- name: uhdGenerateTestBinaries
type: boolean
default: false
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
if [[ "${{ parameters.uhdGenerateTestBinaries }}" = "True" ]]; then
mkdir -p ${{ parameters.uhdBuildDir }}-installed
echo "Setting CMAKE_INSTALL_PREFIX to ${{ parameters.uhdBuildDir }}-installed"
export UHD_CI_CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${{ parameters.uhdBuildDir }}-installed"
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
- script: |
cd ${{ parameters.uhdBuildDir }}
make install
displayName: Install uhd to uhdBuildDir-installed
condition: and(succeeded(), ${{ parameters.uhdGenerateTestBinaries }})
# init_usrp is an example for how to write third-party apps using CMake that
# link against UHD. This will test the UHDConfig.cmake (and related) CMake
# files, as well as the example. We can only do this if UHD was previously
# installed.
# We need to match the install prefix with the previous step in order to find
# UHDConfig.cmake.
- script: |
export EXAMPLE_BUILD_DIR="${{ parameters.uhdBuildDir }}/build_init_usrp"
export EXAMPLE_SRC_DIR="${{ parameters.uhdSrcDir }}/host/examples/init_usrp"
mkdir -p $EXAMPLE_BUILD_DIR
cd $EXAMPLE_BUILD_DIR
if [[ "${{ parameters.uhdCustomBoostPackage }}" = "True" ]]; then
export BOOST_CMAKE_DIR=$(dirname `find $(build_boost_step.CustomBoostPath)/stage/lib -name BoostConfig.cmake`)
export EXAMPLE_CMAKE_OPTIONS="-DBoost_INCLUDE_DIR=$(build_boost_step.CustomBoostPath) -DBoost_DIR=$BOOST_CMAKE_DIR -DBoost_LIBRARY_DIRS=$(build_boost_step.CustomBoostPath)/stage/lib $EXAMPLE_CMAKE_OPTIONS"
fi
cmake \
-DCMAKE_INSTALL_PREFIX=${{ parameters.uhdBuildDir }}-installed \
$EXAMPLE_CMAKE_OPTIONS $EXAMPLE_SRC_DIR && \
make -j$(nproc) -k
displayName: Build init_usrp
condition: and(succeeded(), ${{ parameters.uhdGenerateTestBinaries }})
|