aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/.github/workflows/boost_clang_windows.yml
blob: 797db7e2d492b73d48b1b906603279510ffcc333 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                                        

                






                                                                
             






                                                                                                       
                         
 



                                                               
                                 
 
                         
                              

                                                              
                                                  
 
                           
                                         







                                                


                                     






                                                    
                                          



                                              
                                                      
















































































                                                                                                                                                
# 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@v3

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

      - name: Clean up PATH
        uses: egor-tensin/cleanup-path@v3
        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@v4
        with:
          python-version: '3.x'

      - 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'