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 }})