aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/boost_clang_windows.yml
blob: 6c2612de6e82bb5d7d9450b0c8b1d91722aa9cd8 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# This basically tests two things.
#
#   * If, instead of some kind of MinGW-born ar & ranlib, you only have
#     upstream LLVM distribution on Windows, you wouldn't be able to use
#     toolset=clang until 1.66.0.
#   * toolset=clang-win is broken until 1.69.0.

name: Boost & Clang on Windows

on:
  #push:
  #pull_request:
  schedule:
    # Weekly, at 5:30 AM on Saturday (somewhat randomly chosen).
    - cron: '30 5 * * 6'
  workflow_dispatch:

jobs:
  build:
    strategy:
      matrix:
        toolset: [clang, clang-cl]
        boost-version: [1.63.0, 1.64.0, 1.65.1, 1.66.0, 1.67.0, 1.68.0, 1.69.0, 1.70.0, 1.71.0, 1.74.0]
        include:
          - {toolset: clang, b2_toolset: clang}
          - {toolset: clang-cl, b2_toolset: clang-win}

    runs-on: windows-2019

    name: '${{ matrix.toolset }} / ${{ matrix.boost-version }}'

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Cache Boost
        uses: actions/cache@v2
        with:
          path: '${{ runner.workspace }}/boost/boost_*.tar.gz'
          key: 'boost_${{ matrix.boost-version }}'

      - name: Clean up PATH
        uses: egor-tensin/cleanup-path@v2
        if: runner.os == 'Windows'

      - name: Set common variables
        uses: ./.github/actions/common-variables
        with:
          toolset: '${{ matrix.toolset }}'

      - name: Set up Python
        uses: actions/setup-python@v2

      - name: Install Clang
        uses: egor-tensin/setup-clang@v1

      - name: Set up software environment
        uses: ./.github/actions/software-environment
        with:
          toolset: '${{ matrix.toolset }}'

      - name: Download Boost
        uses: ./.github/actions/download-boost
        with:
          boost-version: '${{ matrix.boost-version }}'

      - name: Bootstrap Boost
        run: |
          cd $env:BOOST_DIR
          .\bootstrap.bat
        continue-on-error: true

      - name: Check that Boost was bootstrapped
        uses: ./.github/actions/check-boost-bootstrapped

      - name: Write toolset-config.jam (clang)
        run: |
          echo 'using ${{ matrix.b2_toolset }} : : clang++.exe : <archiver>llvm-ar <ranlib>llvm-ranlib ;' > "$env:BOOST_DIR\toolset-config.jam"
        if: matrix.toolset == 'clang'
      - name: Write toolset-config.jam (clang-cl)
        run: |
          echo 'using ${{ matrix.b2_toolset }} ;' > "$env:BOOST_DIR\toolset-config.jam"
        if: matrix.toolset == 'clang-cl'

      - name: Build Boost.Filesystem
        run: |
          cd $env:BOOST_DIR

          $stagedir = "stage"
          $librarydir = "$env:BOOST_DIR\$stagedir\lib"
          echo "BOOST_LIBRARYDIR=$librarydir" >> $env:GITHUB_ENV

          .\b2.exe                     `
              "--stagedir=$stagedir"   `
              --layout=system          `
              --dump-configuration     `
              address-model=64         `
              "--user-config=$env:BOOST_DIR\toolset-config.jam" `
              variant=debug            `
              link=static              `
              runtime-link=static      `
              -d2 --dump-configuration `
              --with-filesystem        `
              --with-system
        continue-on-error: true

      - name: Boost.Filesystem failed to build
        run: $(Test-Path "$env:BOOST_LIBRARYDIR\libboost_filesystem.lib" -Type Leaf) -and $(throw "libboost_filesystem.lib was build?!")
        if: |
          (matrix.toolset == 'clang' && matrix.boost-version < '1.66.0') || (matrix.toolset == 'clang-cl' && matrix.boost-version < '1.69.0')
      - id: boost_filesystem_built
        name: Boost.Filesystem was built
        run: $(Test-Path "$env:BOOST_LIBRARYDIR\libboost_filesystem.lib" -Type Leaf) -or $(throw "libboost_filesystem.lib wasn't found")
        if: |
          !((matrix.toolset == 'clang' && matrix.boost-version < '1.66.0') || (matrix.toolset == 'clang-cl' && matrix.boost-version < '1.69.0'))

      # Check that we can link to the built libraries.
      - name: Build foo.exe using clang
        run: |
          clang++.exe                   `
              "-I$env:BOOST_DIR"        `
              -D BOOST_ALL_NO_LIB=1     `
              "-L$env:BOOST_LIBRARYDIR" `
              -llibboost_filesystem     `
              -llibboost_system         `
              -o foo.exe                `
              examples/boost/foo.cpp
        if: steps.boost_filesystem_built.conclusion == 'success' && matrix.toolset == 'clang'

      - name: Build foo.exe using clang-cl
        run: |
          clang-cl.exe                `
              /EHsc                   `
              /MTd                    `
              "/I$env:BOOST_DIR"      `
              /D BOOST_ALL_NO_LIB=1   `
              "/Fefoo.exe"            `
              examples/boost/foo.cpp  `
              libboost_filesystem.lib `
              libboost_system.lib     `
              /link "/LIBPATH:$env:BOOST_LIBRARYDIR"
        if: steps.boost_filesystem_built.conclusion == 'success' && matrix.toolset == 'clang-cl'

      - name: foo.exe
        run: .\foo.exe
        if: steps.boost_filesystem_built.conclusion == 'success'