aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/actions/check-libraries/action.yml
blob: 0e1812fdbf0d2d614161ae0c181bc7a778242641 (plain) (blame)
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
name: Check that Boost libraries were built
description: Check that Boost libraries were built
inputs:
  librarydir:
    description: Directory with the library files
    required: true
  libraries:
    description: Libraries to check
    required: true
  toolset:
    description: Toolset used
    required: false
    default: auto
  static:
    description: Look for static libraries
    required: false
    default: 0
runs:
  using: composite
  steps:
    - run: |
        New-Variable os -Value '${{ runner.os }}' -Option Constant
        New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant

        New-Variable librarydir -Value '${{ inputs.librarydir }}' -Option Constant
        New-Variable toolset -Value '${{ inputs.toolset }}' -Option Constant
        New-Variable static -Value ('${{ inputs.static }}' -eq '1') -Option Constant

        dir $librarydir

        if ($static) {
            $prefix = 'lib'
            $ext = '.a'
            if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) {
                $ext = '.lib'
            }
        } else {
            $prefix = 'lib'
            if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) {
                $prefix = ''
            }
            $ext = '.so'
            if ($windows_host) {
                $ext = '.dll'
            }
        }

        $expected = '${{ inputs.libraries }}'
        $expected = $expected.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)
        $expected = $expected | %{"${prefix}boost_$_$ext"}

        foreach ($lib in $expected) {
            $path = Join-Path $librarydir $lib
            $(Test-Path $path -Type Leaf) -or $(throw "Couldn't find Boost library at: $path")
        }
      shell: pwsh