mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
160 lines
5.9 KiB
YAML
160 lines
5.9 KiB
YAML
parameters:
|
|
- name: uhdSrcDir
|
|
type: string
|
|
- name: uhdBuildDir
|
|
type: string
|
|
- name: uhdGenerateTestBinaries
|
|
type: boolean
|
|
default: false
|
|
- 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: cmake_args
|
|
type: string
|
|
default: " "
|
|
- name: grpc_version
|
|
type: string
|
|
|
|
steps:
|
|
- ${{ 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 }}" =~ gz$ ]]; then
|
|
export TAR_EXTRACT_FLAG="z"
|
|
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
|
|
BOOST_INSTALL_DIR=${{ parameters.uhdBuildDir }}-boost
|
|
./bootstrap.sh --prefix=${BOOST_INSTALL_DIR} --includedir=headers --libdir=dist --with-libraries=chrono,date_time,filesystem,program_options,serialization,test,thread
|
|
./b2 -j$(nproc) --prefix=${BOOST_INSTALL_DIR} install
|
|
displayName: "Build Custom Boost Version"
|
|
name: build_boost_step
|
|
|
|
- script: |
|
|
mkdir -p ${{ parameters.uhdBuildDir }}
|
|
cd ${{ parameters.uhdBuildDir }}
|
|
pyenv exec python3 -m venv ${{ parameters.uhdBuildDir }}/pyenv
|
|
source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate
|
|
python3 -m pip install --upgrade pip
|
|
python3 -m pip install mako numpy requests ruamel.yaml
|
|
displayName: Install python UHD deps
|
|
|
|
- task: Cache@2
|
|
displayName: "Cache grpc installation"
|
|
inputs:
|
|
key: '"grpc-macos-${{ parameters.grpc_version }}"'
|
|
path: $(Agent.BuildDirectory)/grpc-${{ parameters.grpc_version }}-install
|
|
cacheHitVar: cache_grpc
|
|
|
|
- checkout: grpc
|
|
submodules: true
|
|
displayName: clone grpc
|
|
condition: and(succeeded(), ne(variables.cache_grpc, 'true'))
|
|
|
|
- script: |
|
|
set -e
|
|
SOURCE_DIR=$(Build.SourcesDirectory)/grpc
|
|
BUILD_DIR=$(Agent.BuildDirectory)/grpc-${{ parameters.grpc_version }}-build
|
|
INSTALL_DIR=$(Agent.BuildDirectory)/grpc-${{ parameters.grpc_version }}-install
|
|
mkdir -p $BUILD_DIR && cd $BUILD_DIR
|
|
cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
|
|
make -j $(nproc)
|
|
make -j $(nproc) install
|
|
displayName: compile grpc
|
|
condition: and(succeeded(), ne(variables.cache_grpc, 'true'))
|
|
|
|
- script: |
|
|
INSTALL_DIR=$(Agent.BuildDirectory)/grpc-${{ parameters.grpc_version }}-install
|
|
echo GRPC_INSTALL_DIR=$INSTALL_DIR
|
|
echo "##vso[task.setvariable variable=GRPC_INSTALL_DIR]$INSTALL_DIR"
|
|
ls -l $INSTALL_DIR
|
|
ls -l $INSTALL_DIR/bin
|
|
ls -l $INSTALL_DIR/lib
|
|
displayName: list grpc
|
|
|
|
- script: |
|
|
mkdir -p ${{ parameters.uhdBuildDir }}
|
|
cd ${{ parameters.uhdBuildDir }}
|
|
source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate
|
|
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"
|
|
export UHD_CI_CMAKE_SIM="-DENABLE_SIM=OFF"
|
|
fi
|
|
CMAKE_PREFIX_PATH_OPTIONS="-DCMAKE_PREFIX_PATH=$GRPC_INSTALL_DIR"
|
|
if [[ "${{ parameters.uhdCustomBoostPackage }}" = "True" ]]; then
|
|
BOOST_INSTALL_DIR=${{ parameters.uhdBuildDir }}-boost
|
|
CMAKE_PREFIX_PATH_OPTIONS="$CMAKE_PREFIX_PATH_OPTIONS;$BOOST_INSTALL_DIR"
|
|
fi
|
|
if [[ "${{ parameters.cmake_args }}" != " " ]]; then
|
|
echo "Adding additional cmake args: ${{ parameters.cmake_args }}"
|
|
fi
|
|
cmake \
|
|
$UHD_CI_CMAKE_OPTIONS \
|
|
$UHD_CI_CMAKE_SIM \
|
|
$CMAKE_PREFIX_PATH_OPTIONS \
|
|
${{ parameters.cmake_args }} \
|
|
${{ parameters.uhdSrcDir }}/host
|
|
displayName: cmake homebrew macOS UHD
|
|
|
|
- script: |
|
|
cd ${{ parameters.uhdBuildDir }}
|
|
source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate
|
|
make -j$(sysctl -n hw.ncpu) -k
|
|
displayName: make homebrew macOS UHD
|
|
|
|
- script: |
|
|
cd ${{ parameters.uhdBuildDir }}
|
|
ctest --no-compress-output --output-on-failure -T test
|
|
continueOnError: true
|
|
displayName: ctest make homebrew macOS UHD
|
|
|
|
- script: |
|
|
cd ${{ parameters.uhdBuildDir }}
|
|
source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate
|
|
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
|
|
source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate
|
|
cmake \
|
|
$UHD_CI_CMAKE_SIM \
|
|
-DCMAKE_INSTALL_PREFIX=${{ parameters.uhdBuildDir }}-installed \
|
|
-DCMAKE_PREFIX_PATH=${{ parameters.uhdBuildDir }}-installed \
|
|
$EXAMPLE_SRC_DIR && \
|
|
make -j$(sysctl -n hw.ncpu) -k
|
|
displayName: Build init_usrp
|
|
condition: and(succeeded(), ${{ parameters.uhdGenerateTestBinaries }})
|
|
|
|
- script: |
|
|
rm -rf ${{ parameters.uhdBuildDir }}/pyenv
|
|
displayName: Delete venv
|