aboutsummaryrefslogtreecommitdiffstats
path: root/.ci/templates/steps-build-uhd-msbuild.yml
blob: 683937b5b41848fccb8c091eeab39084804bd6c2 (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
parameters:
- name: uhdSrcDir
  type: string
- name: uhdBuildDir
  type: string
- name: uhdReleaseBinaries
- name: cmakeCompiler
  type: string
- name: cmakeArch
  type: string
- name: vsArch
  type: string
- name: vsYear
  type: string
- name: uhdGenerateTestBinaries
  type: boolean
  default: false

steps:
- script: |
    mkdir ${{ parameters.uhdBuildDir }}
    cd ${{ parameters.uhdBuildDir }}
    if "${{ parameters.uhdReleaseBinaries }}" == "True" (
      echo "Setting Release Mode"
      SET UHD_CI_CMAKE_OPTIONS="-DUHD_RELEASE_MODE=release %UHD_CI_CMAKE_OPTIONS%"
    )
    if "${{ parameters.uhdGenerateTestBinaries}}" == "True" (
      echo "Setting CMAKE_INSTALL_PREFIX to ${{ parameters.uhdBuildDir }}-installed"
      SET UHD_CI_CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${{ parameters.uhdBuildDir }}-installed %UHD_CI_CMAKE_OPTIONS%"
    )
    cmake ${{ parameters.uhdSrcDir }}/host ^
      -DVCPKG_TARGET_TRIPLET=uhd-$(vsArch)-windows-static-md ^
      -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALL_DIR%/scripts/buildsystems/vcpkg.cmake ^
      -DSPECIFY_MSVC_VERSION=ON ^
      -DENABLE_DOXYGEN_SHORTNAMES=ON ^
      %UHD_CI_CMAKE_OPTIONS% ^
      -G "$(cmakeCompiler)" -A $(cmakeArch)
  displayName: cmake msbuild UHD

- script: |
    cd ${{ parameters.uhdBuildDir }}
    call "C:\Program Files (x86)\Microsoft Visual Studio\$(vsYear)\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" $(vsArch)
    msbuild.exe ALL_BUILD.vcxproj /p:configuration=release
  displayName: msbuild UHD

- script: |
    cd ${{ parameters.uhdBuildDir }}
    ctest --no-compress-output --output-on-failure -T test
  continueOnError: true
  displayName: ctest msbuild UHD

- script: |
    cd ${{ parameters.uhdBuildDir }}
    call "C:\Program Files (x86)\Microsoft Visual Studio\$(vsYear)\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" $(vsArch)
    msbuild.exe INSTALL.vcxproj /p:configuration=release
  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: |
    SET EXAMPLE_BUILD_DIR="${{ parameters.uhdBuildDir }}/build_init_usrp"
    SET EXAMPLE_SRC_DIR="${{ parameters.uhdSrcDir }}/host/examples/init_usrp"
    mkdir -p %EXAMPLE_BUILD_DIR%
    cd %EXAMPLE_BUILD_DIR%
    cmake ^
      %EXAMPLE_SRC_DIR% ^
      -DVCPKG_TARGET_TRIPLET=uhd-$(vsArch)-windows-static-md ^
      -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALL_DIR%/scripts/buildsystems/vcpkg.cmake ^
      -DCMAKE_INSTALL_PREFIX=${{ parameters.uhdBuildDir }}-installed ^
      -DCMAKE_PREFIX_PATH=${{ parameters.uhdBuildDir }}-installed ^
      -G "$(cmakeCompiler)" -A $(cmakeArch)
    call "C:\Program Files (x86)\Microsoft Visual Studio\$(vsYear)\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" $(vsArch)
    msbuild.exe ALL_BUILD.vcxproj /p:configuration=release
  displayName: Build init_usrp
  condition: and(succeeded(), ${{ parameters.uhdGenerateTestBinaries }})