From 047085a985d4ccd3397537852f75600982398bf4 Mon Sep 17 00:00:00 2001 From: mattprost Date: Wed, 15 Jun 2022 12:48:49 -0500 Subject: ci: Build init_usrp example for macOS Generating this binary allows us to sanity check the linking for UHD builds on macOS. Signed-off-by: mattprost --- .ci/templates/job-uhd-build-src.yml | 1 + .../steps-build-uhd-make-homebrew-macos.yml | 45 +++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/.ci/templates/job-uhd-build-src.yml b/.ci/templates/job-uhd-build-src.yml index a09047e1b..3ef0b6161 100644 --- a/.ci/templates/job-uhd-build-src.yml +++ b/.ci/templates/job-uhd-build-src.yml @@ -83,6 +83,7 @@ jobs: parameters: uhdSrcDir: $(Build.SourcesDirectory) uhdBuildDir: $(Build.BinariesDirectory)/uhddev/build + uhdGenerateTestBinaries: true - ${{ if eq(parameters.toolset, 'ninja') }}: - template: steps-build-uhd-ninja.yml diff --git a/.ci/templates/steps-build-uhd-make-homebrew-macos.yml b/.ci/templates/steps-build-uhd-make-homebrew-macos.yml index 6feaed48b..44726946b 100644 --- a/.ci/templates/steps-build-uhd-make-homebrew-macos.yml +++ b/.ci/templates/steps-build-uhd-make-homebrew-macos.yml @@ -3,9 +3,14 @@ parameters: type: string - name: uhdBuildDir type: string +- name: uhdGenerateTestBinaries + type: boolean + default: false steps: - 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 mako numpy requests ruamel.yaml @@ -15,12 +20,20 @@ steps: mkdir -p ${{ parameters.uhdBuildDir }} cd ${{ parameters.uhdBuildDir }} source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate - cmake ${{ parameters.uhdSrcDir }}/host + 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 \ + -DENABLE_SIM=OFF \ + ${{ parameters.uhdSrcDir }}/host displayName: cmake homebrew macOS UHD - script: | - source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate cd ${{ parameters.uhdBuildDir }} + source ${{ parameters.uhdBuildDir }}/pyenv/bin/activate make -j$(sysctl -n hw.ncpu) -k displayName: make homebrew macOS UHD @@ -30,6 +43,34 @@ steps: 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 \ + -DENABLE_SIM=OFF \ + -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 -- cgit v1.2.3