├── .appveyor.yml ├── .azure-pipelines.yml ├── .codecov.yml ├── .drone.star ├── .drone ├── after-install.bat ├── after-install.sh ├── before-install.bat ├── before-install.sh ├── drone.bat └── drone.sh ├── .gitattributes ├── .github └── workflows │ ├── ci.yml │ └── old_ci.yml ├── .travis.yml ├── .yamllint ├── CMake.md ├── CMakeLists.txt ├── LICENSE ├── README.md ├── README.template.md ├── ci ├── add-apt-keys.sh ├── add-apt-repositories.sh ├── appveyor │ ├── cygwin-update.bat │ ├── install.bat │ └── mingw.bat ├── azure-pipelines │ ├── build.sh │ ├── install.bat │ └── install.sh ├── build.bat ├── build.sh ├── codecov.ps1 ├── codecov.sh ├── common_install.bat ├── common_install.sh ├── coverity.sh ├── drone │ ├── freebsd-cxx-install.sh │ ├── functions.star │ ├── linux-cxx-install.sh │ ├── osx-cxx-install.sh │ ├── windows-cxx-install.bat │ └── windows-cxx-install.sh ├── enforce.sh ├── get_libname.py ├── github │ ├── codecov.sh │ ├── coverity.sh │ ├── install.bat │ ├── install.sh │ └── setup_bdde.sh ├── opencppcoverage.ps1 ├── setup_bdde.sh ├── setup_ccache.sh └── travis │ ├── bdde.sh │ ├── build.sh │ ├── codecov.sh │ ├── coverity.sh │ ├── cppcheck.sh │ ├── install.sh │ ├── intelicc.cfg │ ├── intelicc.sh │ └── valgrind.sh ├── images └── boost.png ├── include └── boost │ └── boost-ci │ └── boost_ci.hpp ├── meta └── libraries.json └── test ├── CMakeLists.txt ├── Jamfile ├── cmake_test ├── CMakeLists.txt └── main.cpp ├── test.cpp └── test2.hpp /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2016, 2017 Peter Dimov 2 | # Copyright 2017 - 2019 James E. King III 3 | # Copyright 2019 - 2021 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | 7 | # 8 | # Generic Appveyor build script for boostorg repositories 9 | # See: https://github.com/boostorg/boost-ci/ 10 | # 11 | # Instructions for customizing this script for your library: 12 | # 13 | # 1. Customize the compilers and language levels you want. 14 | # 2. If you have more than include/, src/, test/, example/, examples/, 15 | # benchmark/ or tools/ directories, set the environment variable DEPINST. 16 | # For example if your build uses code in "bench/" and "fog/" directories: 17 | # - DEPINST: --include bench --include fog 18 | # 3. Enable pull request builds in your boostorg/ account. 19 | # 20 | # That's it - the script will do everything else for you. 21 | # 22 | 23 | version: 1.0.{build}-{branch} 24 | 25 | shallow_clone: true 26 | 27 | branches: 28 | only: 29 | - master 30 | - develop 31 | - /bugfix\/.*/ 32 | - /feature\/.*/ 33 | - /fix\/.*/ 34 | - /pr\/.*/ 35 | 36 | skip_commits: 37 | files: 38 | - LICENSE 39 | - meta/* 40 | - README.md 41 | 42 | matrix: 43 | fast_finish: false 44 | # Adding MAYFAIL to any matrix job allows it to fail but the build stays green: 45 | allow_failures: 46 | - MAYFAIL: true 47 | 48 | environment: 49 | global: 50 | B2_CI_VERSION: 1 51 | GIT_FETCH_JOBS: 4 52 | # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties 53 | # to use the default for a given environment, comment it out; recommend you build debug and release however: 54 | # on Windows it is important to exercise all the possibilities, especially shared vs static, however most 55 | # libraries that care about this exercise it in their Jamfiles... 56 | B2_ADDRESS_MODEL: 32,64 57 | B2_LINK: shared,static 58 | # B2_THREADING: threading=multi,single 59 | B2_VARIANT: release 60 | 61 | matrix: 62 | - FLAVOR: Visual Studio 2008, 2010, 2012 63 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 64 | B2_TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0 65 | B2_ADDRESS_MODEL: 32 # No 64bit support 66 | 67 | - FLAVOR: Visual Studio 2013, 2015 68 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 69 | B2_TOOLSET: msvc-12.0,msvc-14.0 70 | 71 | - FLAVOR: Visual Studio 2017 C++14/17 72 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 73 | B2_CXXSTD: 14,17 74 | B2_TOOLSET: msvc-14.1 75 | 76 | - FLAVOR: Visual Studio 2017 C++2a Strict 77 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 78 | B2_CXXFLAGS: -permissive- 79 | B2_CXXSTD: 2a 80 | B2_TOOLSET: msvc-14.1 81 | 82 | - FLAVOR: Visual Studio 2019 83 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 84 | B2_CXXFLAGS: -permissive- 85 | B2_CXXSTD: 14,17,2a 86 | B2_TOOLSET: msvc-14.2 87 | 88 | - FLAVOR: Visual Studio 2022 89 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 90 | B2_CXXFLAGS: -permissive- 91 | B2_CXXSTD: 14,17,20 92 | B2_TOOLSET: msvc-14.3 93 | 94 | - FLAVOR: clang-cl 95 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 96 | B2_CXXSTD: 11,14,17,latest 97 | B2_TOOLSET: clang-win 98 | 99 | - FLAVOR: cygwin (32-bit) 100 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 101 | ADDPATH: C:\cygwin\bin; 102 | B2_ADDRESS_MODEL: 32 103 | B2_CXXSTD: 11,14,1z 104 | B2_TOOLSET: gcc 105 | 106 | - FLAVOR: cygwin (64-bit) 107 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 108 | ADDPATH: C:\cygwin64\bin; 109 | B2_ADDRESS_MODEL: 64 110 | B2_CXXSTD: 11,14,1z 111 | B2_TOOLSET: gcc 112 | 113 | # (Currently) the images up to 2017 use an older Cygwin 114 | # This tests that the library works with more recent versions 115 | - FLAVOR: cygwin (64-bit, latest) 116 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 117 | ADDPATH: C:\cygwin64\bin; 118 | B2_ADDRESS_MODEL: 64 119 | B2_CXXSTD: 11,14,1z 120 | B2_TOOLSET: gcc 121 | 122 | - FLAVOR: mingw32 123 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 124 | B2_ADDRESS_MODEL: 32 125 | ADDPATH: C:\mingw\bin; 126 | B2_CXXSTD: 11,14,1z 127 | B2_TOOLSET: gcc 128 | 129 | - FLAVOR: mingw64 (32-bit) 130 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 131 | ADDPATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin; 132 | B2_ADDRESS_MODEL: 32 133 | B2_CXXSTD: 11,14,17,2a 134 | B2_TOOLSET: gcc 135 | 136 | - FLAVOR: mingw64 137 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 138 | ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin; 139 | B2_ADDRESS_MODEL: 64 140 | B2_CXXSTD: 11,14,17,2a 141 | B2_TOOLSET: gcc 142 | 143 | - FLAVOR: CodeCov (VS 2019) 144 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 145 | B2_CXXFLAGS: -permissive- 146 | B2_CXXSTD: 14 147 | B2_TOOLSET: msvc-14.2 148 | COVERAGE: true 149 | 150 | install: 151 | - git clone --depth 1 https://github.com/boostorg/boost-ci.git C:\boost-ci-cloned 152 | # Copy ci folder if not testing Boost.CI 153 | - if NOT "%APPVEYOR_PROJECT_NAME%" == "boost-ci" xcopy /s /e /q /i /y C:\boost-ci-cloned\ci .\ci 154 | - rmdir /s /q C:\boost-ci-cloned 155 | - ci\appveyor\install.bat 156 | 157 | build: off 158 | 159 | test_script: ci\build.bat 160 | 161 | for: 162 | # CodeCov coverage build 163 | - matrix: 164 | only: [COVERAGE: true] 165 | test_script: [ps: ci\codecov.ps1] 166 | -------------------------------------------------------------------------------- /.azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2015-2019 Rene Rivera. 3 | # Copyright 2019 Mateusz Loskot 4 | # Copyright 2020-2024 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 7 | 8 | # 9 | # Generic Azure Pipelines build script for boostorg repositories 10 | # See: https://github.com/boostorg/boost-ci/ 11 | # 12 | # Instructions for customizing this script for your library: 13 | # 14 | # 1. Customize the compilers and language levels you want. 15 | # 2. If you have more than include/, src/, test/, example/, examples/, 16 | # benchmark/ or tools/ directories, set the environment variable DEPINST. 17 | # For example if your build uses code in "bench/" and "fog/" directories: 18 | # - DEPINST: --include bench --include fog 19 | # 3. Enable pull request builds in your boostorg/ account. 20 | # 21 | # That's it - the script will do everything else for you. 22 | 23 | trigger: 24 | branches: 25 | include: 26 | - develop 27 | - master 28 | - bugfix/* 29 | - feature/* 30 | - fix/* 31 | - pr/* 32 | 33 | pr: [develop, master, main] 34 | 35 | variables: 36 | GIT_FETCH_JOBS: 4 37 | NET_RETRY_COUNT: 5 38 | B2_CI_VERSION: 1 39 | B2_VARIANT: release,debug 40 | B2_LINK: shared,static 41 | 42 | # Dummy runtime parameter to allow creating conditional jobs 43 | parameters: 44 | - name: jobs 45 | type: object 46 | default: 47 | - { compiler: gcc-4.8, cxxstd: '11', os: ubuntu-20.04, container: 'ubuntu:16.04' } 48 | - { compiler: gcc-4.9, cxxstd: '11', os: ubuntu-20.04, container: 'ubuntu:16.04' } 49 | - { compiler: gcc-5, cxxstd: '11', os: ubuntu-20.04, container: 'ubuntu:18.04' } 50 | - { compiler: gcc-6, cxxstd: '11,14', os: ubuntu-20.04, container: 'ubuntu:18.04' } 51 | - { compiler: gcc-7, cxxstd: '11,14,17', os: ubuntu-20.04 } 52 | - { compiler: gcc-8, cxxstd: '14,17,2a', os: ubuntu-20.04 } 53 | - { compiler: gcc-9, cxxstd: '14,17,2a', os: ubuntu-20.04 } 54 | - { compiler: gcc-10, cxxstd: '14,17,20', os: ubuntu-20.04 } 55 | - { compiler: gcc-11, cxxstd: '14,17,20', os: ubuntu-20.04 } 56 | - { compiler: clang-3.5, cxxstd: '11', os: ubuntu-20.04, container: 'ubuntu:16.04' } 57 | - { compiler: clang-3.6, cxxstd: '11', os: ubuntu-20.04, container: 'ubuntu:16.04' } 58 | - { compiler: clang-3.7, cxxstd: '11', os: ubuntu-20.04, container: 'ubuntu:16.04' } 59 | - { compiler: clang-3.8, cxxstd: '11,14', os: ubuntu-20.04, container: 'ubuntu:16.04' } 60 | - { compiler: clang-3.9, cxxstd: '11,14', os: ubuntu-20.04, container: 'ubuntu:16.04' } 61 | - { compiler: clang-4.0, cxxstd: '11,14', os: ubuntu-20.04, container: 'ubuntu:16.04' } 62 | - { compiler: clang-5.0, cxxstd: '11,14,17', os: ubuntu-20.04, container: 'ubuntu:16.04' } 63 | - { compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-20.04 } 64 | - { compiler: clang-7, cxxstd: '14,17', os: ubuntu-20.04 } 65 | - { compiler: clang-8, cxxstd: '14,17', os: ubuntu-20.04 } 66 | - { compiler: clang-9, cxxstd: '14,17,2a', os: ubuntu-20.04 } 67 | - { compiler: clang-10, cxxstd: '14,17,20', os: ubuntu-20.04 } 68 | - { compiler: clang-11, cxxstd: '14,17,20', os: ubuntu-20.04 } 69 | - { compiler: clang-12, cxxstd: '14,17,20', os: ubuntu-22.04, gcc_toolchain: 12 } 70 | - { compiler: clang-13, cxxstd: '14,17,20', os: ubuntu-22.04, gcc_toolchain: 12 } 71 | - { compiler: clang-14, cxxstd: '14,17,20', os: ubuntu-22.04, gcc_toolchain: 12 } 72 | - { name: Linux_clang_6_libcxx, 73 | compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-20.04, container: 'ubuntu:18.04', install: 'clang-6.0 libc++-dev libc++abi-dev', env: {B2_STDLIB: libc++ } } 74 | # OSX 75 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-12, xcode: '13.1' } 76 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-12, xcode: '13.2.1' } 77 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-12, xcode: '13.3.1' } 78 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-12, xcode: '13.4' } 79 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-12, xcode: '13.4.1' } 80 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-12, xcode: '14.0.1' } 81 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-13, xcode: '14.1' } 82 | - { compiler: clang, cxxstd: '14,17,2a', os: macOS-13, xcode: '14.3.1' } 83 | - { compiler: clang, cxxstd: '14,17,20', os: macOS-13, xcode: '15.1' } 84 | - { compiler: clang, cxxstd: '14,17,20', os: macOS-13, xcode: '15.2' } 85 | - { compiler: clang, cxxstd: '14,17,20', os: macOS-14, xcode: '15.3' } 86 | - { compiler: clang, cxxstd: '14,17,20', os: macOS-14, xcode: '15.4' } 87 | - { compiler: clang, cxxstd: '14,17,20,23', os: macOS-14, xcode: '16.0' } 88 | 89 | stages: 90 | - stage: Test 91 | jobs: 92 | # Dynamically generate jobs to be able to insert containers, see https://stackoverflow.com/questions/70046143 93 | - ${{ each item in parameters.jobs }}: 94 | - ${{ if item.name }}: 95 | job: ${{ item.name }} 96 | ${{ elseif contains(item.os, 'macOS') }}: 97 | job: macOS_${{ replace(item.xcode, '.', '_') }} 98 | ${{ else }}: 99 | job: Linux_${{ replace(replace(item.compiler, '-', '_'), '.', '_') }} 100 | pool: 101 | vmImage: ${{ item.os }} 102 | ${{ if item.container }}: 103 | container: 104 | image: ${{ item.container }} 105 | # Workaround for missing sudo: https://github.com/microsoft/azure-pipelines-agent/issues/2043 106 | options: --name ci-container -v /usr/bin/docker:/tmp/docker:ro 107 | variables: 108 | B2_COMPILER: ${{ item.compiler }} 109 | B2_CXXSTD: ${{ item.cxxstd }} 110 | ${{ if not(contains(item.os, 'macOS')) }}: 111 | B2_USE_CCACHE: 1 112 | B2_CCACHE_DIR: $(Pipeline.Workspace)/.ccache 113 | ${{ if item.xcode }}: 114 | XCODE_APP: /Applications/Xcode_${{ item.xcode }}.app 115 | ${{ if item.install }}: 116 | PACKAGES: ${{ item.install }} 117 | ${{ if item.gcc_toolchain }}: 118 | GCC_TOOLCHAIN: ${{ item.gcc_toolchain }} 119 | ${{ each var in item.env }}: 120 | ${{var.Key}}: ${{var.Value}} 121 | steps: 122 | - ${{ if item.container }}: 123 | - bash: | 124 | set -ex 125 | /tmp/docker exec -t -u 0 ci-container \ 126 | sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::='--force-confold' -y install sudo software-properties-common" 127 | # Need (newer) git 128 | sudo add-apt-repository ppa:git-core/ppa 129 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update 130 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install g++ python libpython-dev git 131 | displayName: 'Install required sw for containers' 132 | - task: Cache@2 133 | condition: eq(variables.B2_USE_CCACHE, '1') 134 | inputs: 135 | key: 'ccache|"${{ item.os }}-${{ item.container }}"|"${{ item.compiler }}"' 136 | path: $(B2_CCACHE_DIR) 137 | displayName: Get CCache 138 | - bash: | 139 | set -ex 140 | 141 | for i in {1..$NET_RETRY_COUNT}; do 142 | git clone --depth 1 --branch master https://github.com/boostorg/boost-ci.git boost-ci-cloned && break || sleep 10 143 | done 144 | # Copy ci folder if not testing Boost.CI 145 | [[ $(basename "$BUILD_REPOSITORY_NAME") = "boost-ci" ]] || cp -prf boost-ci-cloned/ci . 146 | rm -rf boost-ci-cloned 147 | source ci/azure-pipelines/install.sh 148 | displayName: 'Install' 149 | - bash: | 150 | set -ex 151 | echo "SELF=$SELF" 152 | echo "BOOST_ROOT=$BOOST_ROOT" 153 | 154 | cd $BOOST_ROOT/libs/$SELF 155 | ci/azure-pipelines/build.sh 156 | 157 | - job: Windows 158 | timeoutInMinutes: 120 159 | strategy: 160 | matrix: 161 | VS_2019: { B2_TOOLSET: msvc-14.2, B2_CXXSTD: '14,17,20', B2_ADDRESS_MODEL: '32,64', VM_IMAGE: windows-2019 } 162 | VS_2019_strict: { B2_TOOLSET: msvc-14.2, B2_CXXSTD: '14,17,20', B2_ADDRESS_MODEL: '32,64', VM_IMAGE: windows-2019, B2_CXXFLAGS: -permissive- } 163 | VS_2022: { B2_TOOLSET: msvc-14.3, B2_CXXSTD: '14,17,20', B2_ADDRESS_MODEL: '32,64', VM_IMAGE: windows-2022 } 164 | VS_2022_strict: { B2_TOOLSET: msvc-14.3, B2_CXXSTD: '14,17,20', B2_ADDRESS_MODEL: '32,64', VM_IMAGE: windows-2022, B2_CXXFLAGS: -permissive- } 165 | 166 | pool: 167 | vmImage: $(VM_IMAGE) 168 | steps: 169 | - script: | 170 | git clone --depth 1 --branch master https://github.com/boostorg/boost-ci.git boost-ci-cloned 171 | REM Copy ci folder if not testing Boost.CI 172 | if "%BUILD_REPOSITORY_NAME%" == "%BUILD_REPOSITORY_NAME:boost-ci=%" xcopy /s /e /q /i /y boost-ci-cloned\ci .\ci 173 | rmdir /s /q boost-ci-cloned 174 | ci\azure-pipelines\install.bat 175 | displayName: 'Install' 176 | - script: ci\build.bat 177 | displayName: 'Build' 178 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2019 - 2021 Alexander Grund 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 4 | # 5 | # Sample codecov configuration file. Edit as required 6 | 7 | codecov: 8 | max_report_age: off 9 | require_ci_to_pass: yes 10 | notify: 11 | # Increase this if you have multiple coverage collection jobs 12 | after_n_builds: 1 13 | wait_for_ci: yes 14 | 15 | # Change how pull request comments look 16 | comment: 17 | layout: "reach,diff,flags,files,footer" 18 | 19 | # Ignore specific files or folders. Glob patterns are supported. 20 | # See https://docs.codecov.com/docs/ignoring-paths 21 | ignore: 22 | - extra/**/* 23 | # - test/**/* 24 | -------------------------------------------------------------------------------- /.drone.star: -------------------------------------------------------------------------------- 1 | # Use, modification, and distribution are 2 | # subject to the Boost Software License, Version 1.0. (See accompanying 3 | # file LICENSE.txt) 4 | # 5 | # Copyright Rene Rivera 2020. 6 | # Copyright Alexander Grund 2022. 7 | 8 | # For Drone CI we use the Starlark scripting language to reduce duplication. 9 | # As the yaml syntax for Drone CI is rather limited. 10 | 11 | # Base environment for all jobs 12 | globalenv={'B2_CI_VERSION': '1', 'B2_VARIANT': 'release'} 13 | 14 | # Wrapper function to apply the globalenv to all jobs 15 | def job( 16 | # job specific environment options 17 | env={}, 18 | **kwargs): 19 | real_env = dict(globalenv) 20 | real_env.update(env) 21 | return job_impl(env=real_env, **kwargs) 22 | 23 | def main(ctx): 24 | return [ 25 | job(compiler='clang-3.5', cxxstd='11', os='ubuntu-16.04'), 26 | job(compiler='clang-3.6', cxxstd='11,14', os='ubuntu-16.04'), 27 | job(compiler='clang-3.8', cxxstd='11,14', os='ubuntu-16.04'), 28 | job(compiler='clang-3.9', cxxstd='11,14', os='ubuntu-18.04'), 29 | job(compiler='clang-4.0', cxxstd='11,14', os='ubuntu-18.04'), 30 | job(compiler='clang-5.0', cxxstd='11,14,1z', os='ubuntu-18.04'), 31 | job(compiler='clang-6.0', cxxstd='11,14,17', os='ubuntu-18.04'), 32 | job(compiler='clang-7', cxxstd='11,14,17', os='ubuntu-18.04'), 33 | job(compiler='clang-8', cxxstd='11,14,17,2a', os='ubuntu-18.04'), 34 | job(compiler='clang-9', cxxstd='11,14,17,2a', os='ubuntu-18.04'), 35 | job(compiler='clang-10', cxxstd='11,14,17,2a', os='ubuntu-18.04'), 36 | job(compiler='clang-11', cxxstd='11,14,17,2a', os='ubuntu-22.04'), 37 | job(compiler='clang-12', cxxstd='11,14,17,20', os='ubuntu-22.04'), 38 | job(compiler='clang-13', cxxstd='11,14,17,20,2b', os='ubuntu-22.04'), 39 | job(compiler='clang-14', cxxstd='11,14,17,20,2b', os='ubuntu-22.04'), 40 | job(compiler='clang-15', cxxstd='11,14,17,20,2b', os='ubuntu-22.04', add_llvm=True), 41 | 42 | job(compiler='gcc-4.7', cxxstd='11', os='ubuntu-16.04'), 43 | job(compiler='gcc-4.8', cxxstd='11', os='ubuntu-16.04'), 44 | job(compiler='gcc-4.9', cxxstd='11', os='ubuntu-16.04'), 45 | job(compiler='gcc-5', cxxstd='11,14,1z', os='ubuntu-18.04'), 46 | job(compiler='gcc-6', cxxstd='11,14,1z', os='ubuntu-18.04'), 47 | job(compiler='gcc-7', cxxstd='11,14,1z', os='ubuntu-18.04'), 48 | job(compiler='gcc-8', cxxstd='11,14,17,2a', os='ubuntu-18.04'), 49 | job(compiler='gcc-9', cxxstd='11,14,17,2a', os='ubuntu-18.04'), 50 | job(compiler='gcc-10', cxxstd='11,14,17,20', os='ubuntu-22.04'), 51 | job(compiler='gcc-11', cxxstd='11,14,17,20,2b', os='ubuntu-22.04'), 52 | job(compiler='gcc-12', cxxstd='11,14,17,20,2b', os='ubuntu-22.04'), 53 | 54 | job(name='Coverage', buildtype='codecov', 55 | compiler='gcc-8', cxxstd='11,14,17,2a', os='ubuntu-18.04'), 56 | job(name='Coverity Scan', buildtype='coverity', 57 | compiler='clang', cxxstd=None, os='ubuntu-18.04', packages=''), 58 | # Sanitizers 59 | job(name='ASAN', asan=True, 60 | compiler='gcc-12', cxxstd='11,14,17,20', os='ubuntu-22.04'), 61 | job(name='UBSAN', ubsan=True, 62 | compiler='gcc-12', cxxstd='11,14,17,20', os='ubuntu-22.04'), 63 | job(name='TSAN', tsan=True, 64 | compiler='gcc-12', cxxstd='11,14,17,20', os='ubuntu-22.04'), 65 | job(name='Clang 14 w/ sanitizers', asan=True, ubsan=True, 66 | compiler='clang-14', cxxstd='11,14,17,20', os='ubuntu-22.04'), 67 | job(name='Clang 11 libc++ w/ sanitizers', asan=True, ubsan=True, # libc++-11 is the latest working with ASAN: https://github.com/llvm/llvm-project/issues/59432 68 | compiler='clang-11', cxxstd='11,14,17,20', os='ubuntu-20.04', stdlib='libc++', install='libc++-11-dev libc++abi-11-dev'), 69 | job(name='Valgrind', valgrind=True, 70 | compiler='clang-6.0', cxxstd='11,14,1z', os='ubuntu-18.04', install='libc6-dbg libc++-dev libstdc++-8-dev'), 71 | 72 | # libc++ 73 | job(compiler='clang-6.0', cxxstd='11,14,17,2a', os='ubuntu-18.04', stdlib='libc++', install='libc++-dev libc++abi-dev'), 74 | job(compiler='clang-7', cxxstd='11,14,17,2a', os='ubuntu-20.04', stdlib='libc++', install='libc++-7-dev libc++abi-7-dev'), 75 | job(compiler='clang-8', cxxstd='11,14,17,2a', os='ubuntu-20.04', stdlib='libc++', install='libc++-8-dev libc++abi-8-dev'), 76 | job(compiler='clang-9', cxxstd='11,14,17,2a', os='ubuntu-20.04', stdlib='libc++', install='libc++-9-dev libc++abi-9-dev'), 77 | job(compiler='clang-10', cxxstd='11,14,17,20', os='ubuntu-20.04', stdlib='libc++', install='libc++-10-dev libc++abi-10-dev'), 78 | job(compiler='clang-11', cxxstd='11,14,17,20', os='ubuntu-20.04', stdlib='libc++', install='libc++-11-dev libc++abi-11-dev'), 79 | job(compiler='clang-12', cxxstd='11,14,17,20', os='ubuntu-22.04', stdlib='libc++', install='libc++-12-dev libc++abi-12-dev libunwind-12-dev'), 80 | job(compiler='clang-13', cxxstd='11,14,17,20', os='ubuntu-22.04', stdlib='libc++', install='libc++-13-dev libc++abi-13-dev'), 81 | job(compiler='clang-14', cxxstd='11,14,17,20', os='ubuntu-22.04', stdlib='libc++', install='libc++-14-dev libc++abi-14-dev'), 82 | job(compiler='clang-15', cxxstd='11,14,17,20', os='ubuntu-22.04', stdlib='libc++', install='libc++-15-dev libc++abi-15-dev', add_llvm=True), 83 | 84 | # FreeBSD 85 | job(compiler='clang-10', cxxstd='11,14,17,20', os='freebsd-13.1'), 86 | job(compiler='clang-15', cxxstd='11,14,17,20', os='freebsd-13.1'), 87 | job(compiler='gcc-11', cxxstd='11,14,17,20', os='freebsd-13.1', linkflags='-Wl,-rpath=/usr/local/lib/gcc11'), 88 | # OSX 89 | job(compiler='clang', cxxstd='11,14,17,2a', os='osx-xcode-10.1'), 90 | job(compiler='clang', cxxstd='11,14,17,2a', os='osx-xcode-10.3'), 91 | job(compiler='clang', cxxstd='11,14,17,2a', os='osx-xcode-11.1'), 92 | job(compiler='clang', cxxstd='11,14,17,2a', os='osx-xcode-11.7'), 93 | job(compiler='clang', cxxstd='11,14,17,2a', os='osx-xcode-12'), 94 | job(compiler='clang', cxxstd='11,14,17,20', os='osx-xcode-12.5.1'), 95 | job(compiler='clang', cxxstd='11,14,17,20', os='osx-xcode-13.0'), 96 | job(compiler='clang', cxxstd='11,14,17,20', os='osx-xcode-13.4.1'), 97 | job(compiler='clang', cxxstd='11,14,17,20,2b', os='osx-xcode-14.0'), 98 | job(compiler='clang', cxxstd='11,14,17,20,2b', os='osx-xcode-14.3.1'), 99 | job(compiler='clang', cxxstd='11,14,17,20,2b', os='osx-xcode-15.0.1'), 100 | # ARM64 101 | job(compiler='clang-12', cxxstd='11,14,17,20', os='ubuntu-20.04', arch='arm64', add_llvm=True), 102 | job(compiler='gcc-11', cxxstd='11,14,17,20', os='ubuntu-20.04', arch='arm64'), 103 | # S390x 104 | job(compiler='clang-12', cxxstd='11,14,17,20', os='ubuntu-20.04', arch='s390x', add_llvm=True), 105 | job(compiler='gcc-11', cxxstd='11,14,17,20', os='ubuntu-20.04', arch='s390x'), 106 | # Windows 107 | job(compiler='msvc-14.0', cxxstd=None, os='windows', env={'B2_DONT_EMBED_MANIFEST': 1}), 108 | job(compiler='msvc-14.1', cxxstd=None, os='windows'), 109 | job(compiler='msvc-14.2', cxxstd=None, os='windows'), 110 | job(compiler='msvc-14.3', cxxstd=None, os='windows'), 111 | job(compiler='msvc-14.0', cxxstd='14,17,20', os='windows', env={'B2_DONT_EMBED_MANIFEST': 1}), 112 | job(compiler='msvc-14.1', cxxstd='14,17,20', os='windows'), 113 | job(compiler='msvc-14.2', cxxstd='14,17,20', os='windows'), 114 | job(compiler='msvc-14.3', cxxstd='14,17,20,latest', os='windows'), 115 | ] 116 | 117 | # from https://github.com/boostorg/boost-ci 118 | load("@boost_ci//ci/drone/:functions.star", "linux_cxx", "windows_cxx", "osx_cxx", "freebsd_cxx", "job_impl") 119 | -------------------------------------------------------------------------------- /.drone/after-install.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Replace with actual code or remove this file 4 | echo Done with installation 5 | -------------------------------------------------------------------------------- /.drone/after-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Replace with actual code or remove this file 4 | echo "Done with installation" 5 | -------------------------------------------------------------------------------- /.drone/before-install.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Replace with actual code or remove this file 4 | echo Doing (fake) custom installation 5 | -------------------------------------------------------------------------------- /.drone/before-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Replace with actual code or remove this file 4 | echo "Doing (fake) custom installation" 5 | -------------------------------------------------------------------------------- /.drone/drone.bat: -------------------------------------------------------------------------------- 1 | @ECHO ON 2 | 3 | 4 | git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 5 | REM Copy ci folder if not testing Boost.CI 6 | if "%DRONE_REPO%" == "%DRONE_REPO:boost-ci=%" xcopy /s /e /q /i /y boost-ci-cloned\ci .\ci 7 | rmdir /s /q boost-ci-cloned 8 | 9 | set BOOST_CI_TARGET_BRANCH=%DRONE_BRANCH% 10 | set BOOST_CI_SRC_FOLDER=%cd% 11 | 12 | @ECHO OFF 13 | echo ========================^> INSTALL 14 | 15 | set custom_script=%BOOST_CI_SRC_FOLDER%\.drone\before-install.bat 16 | if exist %custom_script% call %custom_script% 17 | 18 | call %BOOST_CI_SRC_FOLDER%\ci\common_install.bat 19 | 20 | set custom_script=%BOOST_CI_SRC_FOLDER%\.drone\after-install.bat 21 | if exist %custom_script% call %custom_script% 22 | 23 | echo ========================^> COMPILE 24 | 25 | if NOT "%DRONE_JOB_BUILDTYPE%" == "boost" echo Ignoring DRONE_JOB_BUILDTYPE=%DRONE_JOB_BUILDTYPE% and doing a Boost build 26 | 27 | call %BOOST_CI_SRC_FOLDER%\ci\build.bat 28 | -------------------------------------------------------------------------------- /.drone/drone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020 Rene Rivera, Sam Darwin 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | 7 | set -e 8 | 9 | export USER=$(whoami) 10 | export CC=${CC:-gcc} 11 | export PATH=~/.local/bin:/usr/local/bin:$PATH 12 | 13 | git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 14 | [ "$(basename $DRONE_REPO)" == "boost-ci" ] || cp -prf boost-ci-cloned/ci . 15 | rm -rf boost-ci-cloned 16 | 17 | export BOOST_CI_TARGET_BRANCH="$DRONE_BRANCH" 18 | export BOOST_CI_SRC_FOLDER=$(pwd) 19 | export CODECOV_NAME=${CODECOV_NAME:-"Drone CI"} 20 | 21 | set +x 22 | echo '==================================> INSTALL' 23 | 24 | if [[ $(uname) == "Linux" ]]; then 25 | error=0 26 | if ! { echo 0 | sudo tee /proc/sys/kernel/randomize_va_space > /dev/null; } && [[ -n ${B2_ASAN:-} ]]; then 27 | echo -e "\n\nWARNING: Failed to disable KASLR. ASAN might fail with 'DEADLYSIGNAL'." 28 | error=1 29 | fi 30 | # sysctl just ignores some failures and does't return an error, only output 31 | if { ! out=$(sudo sysctl vm.mmap_rnd_bits=28 2>&1) || [[ "$out" == *"ignoring:"* ]]; } && [[ -n ${B2_TSAN:-} ]]; then 32 | echo -e "\n\nWARNING: Failed to change KASLR. TSAN might fail with 'FATAL: ThreadSanitizer: unexpected memory mapping'." 33 | error=1 34 | fi 35 | if ((error == 1)); then 36 | [[ "${DRONE_EXTRA_PRIVILEGED:-0}" == "True" ]] || echo 'Try passing `privileged=True` to the job in .drone.star' 37 | echo -e "\n" 38 | fi 39 | fi 40 | 41 | scripts=( 42 | "$BOOST_CI_SRC_FOLDER/.drone/before-install.sh" 43 | "$BOOST_CI_SRC_FOLDER/ci/common_install.sh" 44 | "$BOOST_CI_SRC_FOLDER/.drone/after-install.sh" 45 | ) 46 | for script in "${scripts[@]}"; do 47 | if [ -e "$script" ]; then 48 | echo "==============================> RUN $script" 49 | source "$script" 50 | set +x 51 | fi 52 | done 53 | 54 | echo "B2 config: $(env | grep B2_ || true)" 55 | echo "==================================> SCRIPT ($DRONE_JOB_BUILDTYPE)" 56 | 57 | case "$DRONE_JOB_BUILDTYPE" in 58 | boost) 59 | $BOOST_CI_SRC_FOLDER/ci/build.sh 60 | ;; 61 | codecov) 62 | $BOOST_CI_SRC_FOLDER/ci/travis/codecov.sh 63 | ;; 64 | valgrind) 65 | $BOOST_CI_SRC_FOLDER/ci/travis/valgrind.sh 66 | ;; 67 | coverity) 68 | echo "DRONE_BRANCH=$DRONE_BRANCH, DRONE_BUILD_EVENT=$DRONE_BUILD_EVENT, DRONE_REPO=$DRONE_REPO" 69 | if [[ "$DRONE_BRANCH" =~ ^(master|develop)$ ]] && [[ "$DRONE_BUILD_EVENT" =~ ^(push|cron)$ ]]; then 70 | if [ -z "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] || [ -z "$COVERITY_SCAN_TOKEN" ]; then 71 | echo "Coverity details not set up" 72 | [ -n "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] || echo 'Missing $COVERITY_SCAN_NOTIFICATION_EMAIL' 73 | [ -n "$COVERITY_SCAN_TOKEN" ] || echo 'Missing $COVERITY_SCAN_TOKEN' 74 | exit 1 75 | fi 76 | export BOOST_REPO="$DRONE_REPO" 77 | export BOOST_BRANCH="$DRONE_BRANCH" 78 | $BOOST_CI_SRC_FOLDER/ci/coverity.sh 79 | fi 80 | ;; 81 | *) 82 | echo "Unknown build type: $DRONE_JOB_BUILDTYPE" 83 | ;; 84 | esac 85 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=auto !eol 3 | *.gitattributes text eol=lf 4 | 5 | # Scripts 6 | *.bat text eol=crlf 7 | *.cmd text eol=crlf 8 | *.ps1 text eol=crlf 9 | *.py text eol=lf 10 | *.sh text eol=lf 11 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2021 Peter Dimov 2 | # Copyright 2021 Andrey Semashev 3 | # Copyright 2021-2024 Alexander Grund 4 | # Copyright 2022 James E. King III 5 | # 6 | # Distributed under the Boost Software License, Version 1.0. 7 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 8 | --- 9 | name: CI 10 | 11 | on: 12 | pull_request: 13 | push: 14 | branches: 15 | - master 16 | - develop 17 | - bugfix/** 18 | - feature/** 19 | - fix/** 20 | - pr/** 21 | paths-ignore: 22 | - LICENSE 23 | - meta/** 24 | - README.md 25 | 26 | concurrency: 27 | group: ${{format('{0}:{1}', github.repository, github.ref)}} 28 | cancel-in-progress: true 29 | 30 | env: 31 | GIT_FETCH_JOBS: 8 32 | NET_RETRY_COUNT: 5 33 | B2_CI_VERSION: 1 34 | B2_VARIANT: debug,release 35 | B2_LINK: shared,static 36 | LCOV_BRANCH_COVERAGE: 0 37 | CODECOV_NAME: Github Actions 38 | 39 | jobs: 40 | posix: 41 | defaults: 42 | run: 43 | shell: bash 44 | 45 | strategy: 46 | fail-fast: false 47 | matrix: 48 | include: 49 | # Linux, gcc 50 | - { compiler: gcc-4.4, cxxstd: '98,0x', os: ubuntu-latest, container: 'ubuntu:16.04' } 51 | - { compiler: gcc-4.6, cxxstd: '0x', os: ubuntu-latest, container: 'ubuntu:16.04' } 52 | - { compiler: gcc-4.7, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } 53 | - { compiler: gcc-4.8, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } 54 | - { compiler: gcc-4.9, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } 55 | - { compiler: gcc-5, cxxstd: '11,14,1z', os: ubuntu-latest, container: 'ubuntu:18.04' } 56 | - { compiler: gcc-6, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:18.04' } 57 | - { compiler: gcc-7, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:20.04' } 58 | - { compiler: gcc-8, cxxstd: '11,14,17,2a', os: ubuntu-latest, container: 'ubuntu:20.04' } 59 | - { compiler: gcc-9, cxxstd: '11,14,17,2a', os: ubuntu-22.04 } 60 | - { compiler: gcc-10, cxxstd: '11,14,17,20', os: ubuntu-22.04 } 61 | - { compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-22.04 } 62 | - { compiler: gcc-12, cxxstd: '11,14,17,20', os: ubuntu-22.04 } 63 | - { compiler: gcc-13, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } 64 | - { compiler: gcc-14, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } 65 | 66 | - { name: GCC w/ sanitizers, sanitize: yes, 67 | compiler: gcc-13, cxxstd: '11,14,17,20', os: ubuntu-24.04 } 68 | - { name: Collect coverage, coverage: yes, 69 | compiler: gcc-13, cxxstd: '2b', os: ubuntu-24.04, install: 'g++-13-multilib gcc-multilib', address-model: '32,64' } 70 | 71 | # Linux, clang 72 | - { compiler: clang-3.5, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } 73 | - { compiler: clang-3.6, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } 74 | - { compiler: clang-3.7, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } 75 | - { compiler: clang-3.8, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } 76 | - { compiler: clang-3.9, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04' } 77 | - { compiler: clang-4.0, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04' } 78 | - { compiler: clang-5.0, cxxstd: '11,14,1z', os: ubuntu-latest, container: 'ubuntu:18.04' } 79 | - { compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:20.04' } 80 | - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:20.04' } 81 | # Note: clang-8 does not fully support C++20, so it is not compatible with some libstdc++ versions in this mode 82 | - { compiler: clang-8, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:20.04' } 83 | - { compiler: clang-9, cxxstd: '11,14,17,2a', os: ubuntu-latest, container: 'ubuntu:20.04' } 84 | - { compiler: clang-10, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:20.04' } 85 | - { compiler: clang-11, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:20.04' } 86 | - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:20.04' } 87 | - { compiler: clang-13, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:22.04' } 88 | - { compiler: clang-14, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:22.04' } 89 | - { compiler: clang-15, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:22.04' } 90 | - { compiler: clang-16, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } 91 | - { compiler: clang-17, cxxstd: '11,14,17,20,23', os: ubuntu-latest, container: 'ubuntu:24.04' } 92 | - { compiler: clang-18, cxxstd: '11,14,17,20,23,2c', os: ubuntu-24.04 } 93 | 94 | # libc++ 95 | - { compiler: clang-6.0, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04', stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } 96 | - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:20.04', stdlib: libc++ } 97 | - { name: Clang w/ sanitizers, sanitize: yes, 98 | compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-latest, container: 'ubuntu:20.04', stdlib: libc++ } 99 | 100 | # OSX, clang 101 | - { name: MacOS w/ clang and sanitizers, 102 | compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-13, sanitize: yes } 103 | - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-14 } 104 | - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-15 } 105 | 106 | # Coverity Scan 107 | # requires two github secrets in repo to activate; see ci/github/coverity.sh 108 | # does not run on pull requests, only on pushes into develop and master 109 | - { name: Coverity, coverity: yes, 110 | compiler: clang-12, cxxstd: '20', os: ubuntu-22.04, ccache: no } 111 | 112 | # multiarch (bigendian testing) - does not support coverage yet 113 | - { name: Big-endian, multiarch: yes, 114 | compiler: clang, cxxstd: '17', os: ubuntu-22.04, ccache: no, distro: fedora, edition: 34, arch: s390x } 115 | 116 | 117 | timeout-minutes: 120 118 | runs-on: ${{matrix.os}} 119 | container: 120 | image: ${{matrix.container}} 121 | volumes: 122 | - /node20217:/node20217:rw,rshared 123 | - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} 124 | env: {B2_USE_CCACHE: 1} 125 | 126 | steps: 127 | - name: Setup environment 128 | run: | 129 | if [ -f "/etc/debian_version" ]; then 130 | echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV 131 | export DEBIAN_FRONTEND=noninteractive 132 | fi 133 | if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then 134 | apt-get -o Acquire::Retries=$NET_RETRY_COUNT update 135 | apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install sudo software-properties-common curl 136 | # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 137 | curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg 138 | for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done 139 | apt-get -o Acquire::Retries=$NET_RETRY_COUNT update 140 | osver=$(lsb_release -sr | cut -f1 -d.) 141 | pkgs="g++ git xz-utils" 142 | # Ubuntu 22+ has only Python 3 in the repos 143 | if [ -n "$osver" ] && [ "$osver" -ge "20" ]; then 144 | pkgs+=" python-is-python3 libpython3-dev" 145 | else 146 | pkgs+=" python libpython-dev" 147 | fi 148 | apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install $pkgs 149 | fi 150 | # For jobs not compatible with ccache, use "ccache: no" in the matrix 151 | if [[ "${{ matrix.ccache }}" == "no" ]]; then 152 | echo "B2_USE_CCACHE=0" >> $GITHUB_ENV 153 | fi 154 | if [[ "${{ matrix.sanitize }}" == "yes" ]]; then 155 | echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/test/suppressions.txt" >> $GITHUB_ENV 156 | fi 157 | git config --global pack.threads 0 158 | if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then 159 | # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 160 | curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 161 | fi 162 | 163 | - uses: actions/checkout@v4 164 | with: 165 | # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' 166 | fetch-depth: ${{ matrix.coverage && '0' || '1' }} 167 | 168 | - name: Cache ccache 169 | uses: actions/cache@v4 170 | if: env.B2_USE_CCACHE 171 | with: 172 | path: ~/.ccache 173 | key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} 174 | restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- 175 | 176 | - name: Fetch Boost.CI 177 | uses: actions/checkout@v4 178 | with: 179 | repository: boostorg/boost-ci 180 | ref: master 181 | path: boost-ci-cloned 182 | 183 | - name: Get CI scripts folder 184 | run: | 185 | # Copy ci folder if not testing Boost.CI 186 | [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . 187 | rm -rf boost-ci-cloned 188 | 189 | - name: Install packages 190 | if: startsWith(matrix.os, 'ubuntu') 191 | run: | 192 | SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") 193 | SOURCES=("${{join(matrix.sources, '" "')}}") 194 | # Add this by default 195 | SOURCE_KEYS+=('http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F') 196 | SOURCES+=(ppa:ubuntu-toolchain-r/test) 197 | 198 | ci/add-apt-keys.sh "${SOURCE_KEYS[@]}" 199 | # Initial update before adding sources required to get e.g. keys 200 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update 201 | ci/add-apt-repositories.sh "${SOURCES[@]}" 202 | 203 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update 204 | if [[ -z "${{matrix.install}}" ]]; then 205 | compiler="${{matrix.compiler}}" 206 | pkgs="${compiler/gcc-/g++-}" 207 | [[ -z "${{matrix.gcc_toolchain}}" ]] || pkgs+=" g++-${{matrix.gcc_toolchain}}" 208 | if [[ "${{matrix.stdlib}}" == "libc++" && $compiler == "clang-"* ]]; then 209 | ver=${compiler#*-} 210 | pkgs+=" libc++-${ver}-dev libc++abi-${ver}-dev" 211 | fi 212 | else 213 | pkgs="${{matrix.install}}" 214 | fi 215 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install $pkgs 216 | 217 | - name: Setup GCC Toolchain 218 | if: matrix.gcc_toolchain 219 | run: | 220 | GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" 221 | echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV 222 | if ! command -v dpkg-architecture; then 223 | apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install dpkg-dev 224 | fi 225 | MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" 226 | mkdir -p "$GCC_TOOLCHAIN_ROOT" 227 | ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" 228 | ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" 229 | mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" 230 | ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" 231 | 232 | - name: Setup multiarch 233 | if: matrix.multiarch 234 | run: ci/github/setup_bdde.sh 235 | env: 236 | BDDE_DISTRO: ${{matrix.distro}} 237 | BDDE_EDITION: ${{matrix.edition}} 238 | BDDE_ARCH: ${{matrix.arch}} 239 | 240 | - name: Setup Boost 241 | run: source ci/github/install.sh 242 | env: 243 | B2_ADDRESS_MODEL: ${{matrix.address-model}} 244 | B2_COMPILER: ${{matrix.compiler}} 245 | B2_CXXSTD: ${{matrix.cxxstd}} 246 | B2_SANITIZE: ${{matrix.sanitize}} 247 | B2_STDLIB: ${{matrix.stdlib}} 248 | # Optional. Variables set here (to non-empty) will override the top-level environment variables 249 | B2_DEFINES: ${{matrix.defines}} 250 | B2_VARIANT: ${{matrix.variant}} 251 | B2_LINK: ${{matrix.link}} 252 | # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. 253 | # Set the (B2) target(s) to build, defaults to the test folder of the current library 254 | # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` 255 | # B2_TARGETS: libs/foo/test//bar 256 | 257 | - name: Setup coverage collection 258 | if: matrix.coverage 259 | run: ci/github/codecov.sh "setup" 260 | 261 | - name: Run tests 262 | if: '!matrix.coverity' 263 | run: ci/build.sh 264 | 265 | - name: Collect coverage 266 | if: matrix.coverage 267 | run: ci/codecov.sh "collect" 268 | 269 | - name: Upload coverage 270 | if: matrix.coverage 271 | uses: codecov/codecov-action@v5 272 | with: 273 | fail_ci_if_error: true 274 | disable_search: true 275 | files: coverage.info 276 | name: ${{env.CODECOV_NAME}} (POSIX) 277 | token: ${{secrets.CODECOV_TOKEN}} 278 | verbose: true 279 | 280 | - name: Run coverity 281 | if: matrix.coverity && github.event_name == 'push' && (github.ref_name == 'develop' || github.ref_name == 'master') 282 | run: ci/github/coverity.sh 283 | env: 284 | COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }} 285 | COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} 286 | 287 | windows: 288 | defaults: 289 | run: 290 | shell: cmd 291 | strategy: 292 | fail-fast: false 293 | matrix: 294 | include: 295 | - { toolset: msvc-14.0, cxxstd: '14,latest', addrmd: '32,64', os: windows-2019 } 296 | - { toolset: msvc-14.2, cxxstd: '14,17,20', addrmd: '32,64', os: windows-2019 } 297 | - { toolset: msvc-14.3, cxxstd: '14,17,20,latest',addrmd: '32,64', os: windows-2022 } 298 | - { name: Collect coverage, coverage: yes, 299 | toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 } 300 | - { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 } 301 | - { toolset: gcc, cxxstd: '11,14,17,2a', addrmd: '64', os: windows-2019 } 302 | 303 | runs-on: ${{matrix.os}} 304 | 305 | steps: 306 | - uses: actions/checkout@v4 307 | 308 | - name: Fetch Boost.CI 309 | uses: actions/checkout@v4 310 | with: 311 | repository: boostorg/boost-ci 312 | ref: master 313 | path: boost-ci-cloned 314 | - name: Get CI scripts folder 315 | run: | 316 | REM Copy ci folder if not testing Boost.CI 317 | if "%GITHUB_REPOSITORY%" == "%GITHUB_REPOSITORY:boost-ci=%" xcopy /s /e /q /i /y boost-ci-cloned\ci .\ci 318 | rmdir /s /q boost-ci-cloned 319 | 320 | - name: Setup Boost 321 | run: ci\github\install.bat 322 | 323 | - name: Run tests 324 | if: '!matrix.coverage' 325 | run: ci\build.bat 326 | env: 327 | B2_TOOLSET: ${{matrix.toolset}} 328 | B2_CXXSTD: ${{matrix.cxxstd}} 329 | B2_ADDRESS_MODEL: ${{matrix.addrmd}} 330 | B2_DEFINES: ${{matrix.defines}} 331 | B2_VARIANT: ${{matrix.variant}} 332 | B2_LINK: ${{matrix.link}} 333 | 334 | - name: Collect coverage 335 | shell: powershell 336 | if: matrix.coverage 337 | run: ci\opencppcoverage.ps1 338 | env: 339 | B2_TOOLSET: ${{matrix.toolset}} 340 | B2_CXXSTD: ${{matrix.cxxstd}} 341 | B2_ADDRESS_MODEL: ${{matrix.addrmd}} 342 | B2_DEFINES: ${{matrix.defines}} 343 | B2_VARIANT: ${{matrix.variant}} 344 | B2_LINK: ${{matrix.link}} 345 | 346 | - name: Upload coverage 347 | if: matrix.coverage 348 | uses: codecov/codecov-action@v5 349 | with: 350 | disable_search: true 351 | files: __out/cobertura.xml 352 | name: ${{env.CODECOV_NAME}} (Windows) 353 | token: ${{secrets.CODECOV_TOKEN}} 354 | verbose: true 355 | 356 | MSYS2: 357 | defaults: 358 | run: 359 | shell: msys2 {0} 360 | strategy: 361 | fail-fast: false 362 | matrix: 363 | include: 364 | - { sys: MINGW32, compiler: gcc, cxxstd: '11,17,20' } 365 | - { sys: MINGW64, compiler: gcc, cxxstd: '11,17,20' } 366 | 367 | runs-on: windows-latest 368 | 369 | steps: 370 | - uses: actions/checkout@v4 371 | 372 | - name: Setup MSYS2 environment 373 | uses: msys2/setup-msys2@v2 374 | with: 375 | msystem: ${{matrix.sys}} 376 | update: true 377 | install: git python 378 | pacboy: gcc:p cmake:p ninja:p 379 | 380 | - name: Fetch Boost.CI 381 | uses: actions/checkout@v4 382 | with: 383 | repository: boostorg/boost-ci 384 | ref: master 385 | path: boost-ci-cloned 386 | - name: Get CI scripts folder 387 | run: | 388 | # Copy ci folder if not testing Boost.CI 389 | [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . 390 | rm -rf boost-ci-cloned 391 | 392 | - name: Setup Boost 393 | run: ci/github/install.sh 394 | env: 395 | B2_COMPILER: ${{matrix.compiler}} 396 | B2_CXXSTD: ${{matrix.cxxstd}} 397 | B2_SANITIZE: ${{matrix.sanitize}} 398 | B2_STDLIB: ${{matrix.stdlib}} 399 | B2_DEFINES: ${{matrix.defines}} 400 | B2_VARIANT: ${{matrix.variant}} 401 | B2_LINK: ${{matrix.link}} 402 | 403 | - name: Run tests 404 | run: ci/build.sh 405 | 406 | # Run also the CMake tests to avoid having to setup another matrix for CMake on MSYS 407 | - name: Run CMake tests 408 | run: | 409 | cd "$BOOST_ROOT" 410 | mkdir __build_cmake_test__ && cd __build_cmake_test__ 411 | cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. 412 | cmake --build . --target tests --config Debug -j$B2_JOBS 413 | ctest --output-on-failure --build-config Debug 414 | 415 | CMake: 416 | defaults: 417 | run: 418 | shell: bash 419 | 420 | strategy: 421 | fail-fast: false 422 | matrix: 423 | include: 424 | - { os: ubuntu-latest, build_shared: ON, build_type: Debug, generator: 'Unix Makefiles' } 425 | - { os: ubuntu-latest, build_shared: OFF, build_type: Debug, generator: 'Unix Makefiles' } 426 | - { os: windows-2019, build_shared: ON, build_type: Debug, generator: 'Visual Studio 16 2019' } 427 | - { os: windows-2019, build_shared: OFF, build_type: Debug, generator: 'Visual Studio 16 2019' } 428 | 429 | timeout-minutes: 120 430 | runs-on: ${{matrix.os}} 431 | 432 | steps: 433 | - uses: actions/checkout@v4 434 | - name: Fetch Boost.CI 435 | uses: actions/checkout@v4 436 | with: 437 | repository: boostorg/boost-ci 438 | ref: master 439 | path: boost-ci-cloned 440 | 441 | - name: Get CI scripts folder 442 | run: | 443 | # Copy ci folder if not testing Boost.CI 444 | [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . 445 | rm -rf boost-ci-cloned 446 | 447 | - name: Setup Boost 448 | run: source ci/github/install.sh 449 | env: {B2_DONT_BOOTSTRAP: 1} 450 | 451 | - name: Run CMake tests 452 | run: | 453 | cd "$BOOST_ROOT" 454 | mkdir __build_cmake_test__ && cd __build_cmake_test__ 455 | cmake -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. 456 | cmake --build . --target tests --config ${{matrix.build_type}} -j$B2_JOBS 457 | ctest --output-on-failure --build-config ${{matrix.build_type}} 458 | 459 | - name: Run CMake subdir tests 460 | run: | 461 | cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" # New unified folder 462 | [ -d "$cmake_test_folder" ] || cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_subdir_test" 463 | cd "$cmake_test_folder" 464 | mkdir __build_cmake_subdir_test__ && cd __build_cmake_subdir_test__ 465 | cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=OFF -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} .. 466 | cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS 467 | ctest --output-on-failure --build-config ${{matrix.build_type}} 468 | 469 | - name: Install Library 470 | run: | 471 | cd "$BOOST_ROOT" 472 | mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ 473 | cmake -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_INSTALL_PREFIX=$HOME/local -DBoost_VERBOSE=ON -DBoost_DEBUG=ON .. 474 | cmake --build . --target install --config ${{matrix.build_type}} -j$B2_JOBS 475 | - name: Run CMake install tests 476 | run: | 477 | cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" # New unified folder 478 | [ -d "$cmake_test_folder" ] || cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_install_test" 479 | cd "$cmake_test_folder" 480 | mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ 481 | cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_PREFIX_PATH=$HOME/local .. 482 | cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS 483 | ctest --output-on-failure --build-config ${{matrix.build_type}} 484 | -------------------------------------------------------------------------------- /.github/workflows/old_ci.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2021 Peter Dimov 2 | # Copyright 2021 Andrey Semashev 3 | # Copyright 2021-2024 Alexander Grund 4 | # 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 7 | 8 | name: Compatibility CI 9 | 10 | on: 11 | pull_request: 12 | push: 13 | branches: 14 | - master 15 | - develop 16 | - feature/** 17 | 18 | concurrency: 19 | group: ${{format('compat-{0}:{1}', github.repository, github.ref)}} 20 | cancel-in-progress: true 21 | 22 | env: 23 | NET_RETRY_COUNT: 5 24 | 25 | jobs: 26 | posix: 27 | defaults: 28 | run: 29 | shell: bash 30 | 31 | strategy: 32 | fail-fast: false 33 | matrix: 34 | include: 35 | - name: Old var usage 36 | env: 37 | B2_TOOLSET: gcc-13 38 | B2_ADDRESS_MODEL: address-model=64 39 | B2_LINK: link=shared,static 40 | B2_THREADING: threading=multi,single 41 | B2_VARIANT: variant=release 42 | # Possible (ab)usage 43 | B2_CXXFLAGS: define=norecover 44 | B2_DEFINES: define=BOOST_NO_STRESS_TEST=1 45 | B2_LINKFLAGS: linkflags=-fuse-ld=gold 46 | os: ubuntu-24.04 47 | install: g++-13 48 | - name: Old var usage, multiple values per key 49 | env: 50 | B2_TOOLSET: gcc-13 51 | B2_ADDRESS_MODEL: address-model=64 52 | B2_LINK: link=shared,static 53 | B2_THREADING: threading=multi,single 54 | B2_VARIANT: variant=release 55 | # Possible (ab)usage 56 | B2_CXXFLAGS: define=norecover 57 | B2_DEFINES: define=BOOST_NO_STRESS_TEST=1 define=BOOST_IMPORTANT=1 58 | B2_LINKFLAGS: linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=all linkflags=-fuse-ld=gold 59 | os: ubuntu-24.04 60 | install: g++-13 61 | 62 | - name: New var usage, multiple values per key 63 | env: 64 | B2_CI_VERSION: 1 65 | B2_TOOLSET: gcc-13 66 | B2_ADDRESS_MODEL: 64 67 | B2_LINK: shared,static 68 | B2_THREADING: threading=multi,single 69 | B2_VARIANT: release 70 | B2_DEFINES: BOOST_NO_STRESS_TEST=1 BOOST_IMPORTANT=1 BOOST_ALSO_IMPORTANT="with space" 71 | B2_LINKFLAGS: -fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold 72 | B2_FLAGS: define=BOOST_CI_TEST_DEFINES=1 73 | os: ubuntu-24.04 74 | install: g++-13 75 | 76 | - name: Travis-like coverage collection 77 | coverage: yes 78 | env: 79 | B2_TOOLSET: gcc-13 80 | B2_CXXSTD: 03,11 81 | B2_DEFINES: define=BOOST_NO_STRESS_TEST=1 82 | os: ubuntu-24.04 83 | install: g++-13 84 | - name: Travis-like coverage collection with set CXX/LINK-flags 85 | coverage: yes 86 | env: 87 | B2_TOOLSET: gcc-13 88 | B2_CXXSTD: 03,11 89 | B2_CXXFLAGS: cxxflags=-g0 90 | B2_LINKFLAGS: linkflags=-fuse-ld=gold 91 | os: ubuntu-24.04 92 | install: g++-13 93 | - name: Coverage LCOV v2.0 94 | coverage: yes 95 | os: ubuntu-22.04 96 | install: 'libcapture-tiny-perl libdatetime-perl' 97 | address-model: '32,64' 98 | env: 99 | B2_TOOLSET: gcc-12 100 | B2_CXXSTD: 14,17 101 | B2_DEFINES: define=BOOST_NO_STRESS_TEST=1 102 | LCOV_VERSION: 'v2.0' 103 | 104 | name: ${{matrix.name}} 105 | timeout-minutes: 120 106 | runs-on: ${{matrix.os}} 107 | env: ${{matrix.env}} 108 | 109 | steps: 110 | - name: Setup environment 111 | run: | 112 | [ ! -f "/etc/debian_version" ] || echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV 113 | git config --global pack.threads 0 114 | 115 | - uses: actions/checkout@v4 116 | if: '!matrix.coverage' 117 | - uses: actions/checkout@v4 118 | if: 'matrix.coverage' 119 | with: { fetch-depth: 0 } 120 | 121 | - name: Install packages 122 | if: startsWith(matrix.os, 'ubuntu') 123 | run: | 124 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update 125 | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install ${{matrix.install}} 126 | 127 | - name: Setup Boost 128 | run: source ci/github/install.sh 129 | 130 | - name: Run tests 131 | if: '!matrix.coverage' 132 | run: ci/build.sh 133 | 134 | - name: Collect and upload coverage (old way) 135 | if: matrix.coverage 136 | run: ci/travis/codecov.sh 137 | env: 138 | CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} 139 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Peter Dimov 2 | # Copyright 2017 - 2019 James E. King III 3 | # Copyright 2019 - 2020 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | 7 | # 8 | # Generic Travis CI build script for boostorg repositories 9 | # See: https://github.com/boostorg/boost-ci 10 | # 11 | # Instructions for customizing this script for your library: 12 | # 13 | # 1. Customize the compilers and language levels you want in the 'jobs'. 14 | # 2. If you have more than include/, src/, test/, example/, examples/, or 15 | # tools/ directories, modify your Travis CI project and add the environment 16 | # variable DEPINST. For example if your build uses code in "bench/" and 17 | # "fog/" directories, then set DEPINST to the following: 18 | # --include bench --include fog 19 | # 3. If you want to enable Coverity Scan, you need to provide the environment 20 | # variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in 21 | # your github settings. 22 | # 4. If you want to enable a big-endian build, you need to uncomment the 23 | # big-endian build job. 24 | # 5. Enable pull request builds in your boostorg/ account. 25 | # 26 | # That's it - the scripts will do everything else for you. 27 | 28 | language: cpp 29 | os: linux 30 | dist: xenial 31 | 32 | branches: 33 | only: 34 | - master 35 | - develop 36 | - /bugfix\/.*/ 37 | - /feature\/.*/ 38 | - /fix\/.*/ 39 | - /pr\/.*/ 40 | 41 | env: 42 | global: 43 | - B2_CI_VERSION=1 44 | - CODECOV_NAME=Travis 45 | # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties 46 | # - B2_ADDRESS_MODEL=64,32 47 | # - B2_LINK=shared,static 48 | # - B2_THREADING=threading=multi,single 49 | - B2_VARIANT=release 50 | 51 | install: 52 | - git clone --depth 1 https://github.com/boostorg/boost-ci.git boost-ci-cloned 53 | # Copy ci folder if not testing Boost.CI 54 | - [[ $(basename "$TRAVIS_BUILD_DIR") = "boost-ci" ]] || cp -prf boost-ci-cloned/ci . 55 | - rm -rf boost-ci-cloned 56 | - source ci/travis/install.sh 57 | 58 | script: $BOOST_ROOT/libs/$SELF/ci/travis/build.sh 59 | 60 | # Default toolsets in Ubuntu 61 | # 62 | # trusty xenial bionic 63 | # 14.04 16.04 18.04 64 | # ------ ------ ------ 65 | # clang 3.4 3.8 6.0 66 | # gcc 4.8.2 5.3.1 7.3.0 67 | 68 | anchors: 69 | libcpp: &libcpp { apt: { packages: [libc++-dev, libc++-helpers] } } 70 | # More reliable way to add this as "ubuntu-toolchain-r-test" may fail on travis whitelisting 71 | ubuntu-toolchain-r-test: 72 | - &ubuntu-toolchain-r-test 73 | sourceline: "ppa:ubuntu-toolchain-r/test" 74 | llvm-toolchain-xenial-9: &llvm-toolchain-xenial-9 75 | sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' 76 | key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' 77 | llvm-toolchain-xenial-10: &llvm-toolchain-xenial-10 78 | sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main' 79 | key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' 80 | clang-33: &clang-33 { apt: { packages: [ "clang-3.3"] } } 81 | clang-34: &clang-34 { apt: { packages: [ "clang-3.4"] } } 82 | clang-35: &clang-35 { apt: { packages: [ "clang-3.5"], sources: [ *ubuntu-toolchain-r-test ] } } 83 | clang-36: &clang-36 { apt: { packages: [ "clang-3.6"], sources: [ *ubuntu-toolchain-r-test ] } } 84 | clang-37: &clang-37 { apt: { packages: [ "clang-3.7"], sources: [ *ubuntu-toolchain-r-test ] } } 85 | clang-38: &clang-38 { apt: { packages: [ "clang-3.8"], sources: [ *ubuntu-toolchain-r-test ] } } 86 | clang-39: &clang-39 { apt: { packages: [ "clang-3.9"], sources: [ *ubuntu-toolchain-r-test ] } } 87 | clang-4: &clang-4 { apt: { packages: [ "clang-4.0", 88 | "libstdc++-6-dev" ], sources: [ "llvm-toolchain-xenial-4.0", 89 | *ubuntu-toolchain-r-test ] } } 90 | clang-5: &clang-5 { apt: { packages: [ "clang-5.0", 91 | "libstdc++-7-dev" ], sources: [ "llvm-toolchain-xenial-5.0", 92 | *ubuntu-toolchain-r-test ] } } 93 | clang-6: &clang-6 { apt: { packages: [ "clang-6.0", 94 | "libc6-dbg", 95 | "libc++-dev", 96 | "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-6.0", 97 | *ubuntu-toolchain-r-test ] } } 98 | clang-7: &clang-7 { apt: { packages: [ "clang-7", 99 | "libc6-dbg", 100 | "libc++-dev", 101 | "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-7", 102 | *ubuntu-toolchain-r-test ] } } 103 | clang-8: &clang-8 { apt: { packages: [ "clang-8", 104 | "libc6-dbg", 105 | "libc++-dev", 106 | "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-8", 107 | *ubuntu-toolchain-r-test ] } } 108 | clang-9: &clang-9 { apt: { packages: [ "clang-9" ], sources: [ *llvm-toolchain-xenial-9, 109 | *ubuntu-toolchain-r-test ] } } 110 | clang-10: &clang-10 { apt: { packages: [ "clang-10"], sources: [ *llvm-toolchain-xenial-10, 111 | *ubuntu-toolchain-r-test ] } } 112 | 113 | gcc-44: &gcc-44 { apt: { packages: [ "g++-4.4" ], sources: [ *ubuntu-toolchain-r-test ] } } 114 | gcc-46: &gcc-46 { apt: { packages: [ "g++-4.6" ], sources: [ *ubuntu-toolchain-r-test ] } } 115 | gcc-47: &gcc-47 { apt: { packages: [ "g++-4.7" ], sources: [ *ubuntu-toolchain-r-test ] } } 116 | gcc-48: &gcc-48 { apt: { packages: [ "g++-4.8" ], sources: [ *ubuntu-toolchain-r-test ] } } 117 | gcc-49: &gcc-49 { apt: { packages: [ "g++-4.9" ], sources: [ *ubuntu-toolchain-r-test ] } } 118 | gcc-5: &gcc-5 { apt: { packages: [ "g++-5" ], sources: [ *ubuntu-toolchain-r-test ] } } 119 | gcc-6: &gcc-6 { apt: { packages: [ "g++-6" ], sources: [ *ubuntu-toolchain-r-test ] } } 120 | gcc-7: &gcc-7 { apt: { packages: [ "g++-7" ], sources: [ *ubuntu-toolchain-r-test ] } } 121 | gcc-8: &gcc-8 { apt: { packages: [ "g++-8" ], sources: [ *ubuntu-toolchain-r-test ] } } 122 | gcc-9: &gcc-9 { apt: { packages: [ "g++-9" ], sources: [ *ubuntu-toolchain-r-test ] } } 123 | 124 | jobs: 125 | allow_failures: 126 | - env: 127 | - COPY="all the environment settings from your job" 128 | 129 | include: 130 | - compiler: g++-8 131 | env: 132 | - COMMENT=codecov.io 133 | - B2_CXXSTD=03,11 134 | - B2_DEFINES="BOOST_NO_STRESS_TEST=1" 135 | addons: *gcc-8 136 | script: $BOOST_ROOT/libs/$SELF/ci/travis/codecov.sh 137 | 138 | - compiler: g++-8 139 | env: 140 | - COMMENT=asan 141 | - B2_VARIANT=debug 142 | - B2_CXXSTD=03,11,14 143 | - B2_ASAN=1 144 | - B2_DEFINES="BOOST_NO_STRESS_TEST=1" 145 | addons: *gcc-8 146 | 147 | - compiler: g++-8 148 | env: 149 | - COMMENT=tsan 150 | - B2_VARIANT=debug 151 | - B2_CXXSTD=03,11,14 152 | - B2_TSAN=1 153 | - B2_DEFINES="BOOST_NO_STRESS_TEST=1" 154 | addons: *gcc-8 155 | 156 | - compiler: g++-8 157 | env: 158 | - COMMENT=ubsan 159 | - B2_VARIANT=debug 160 | - B2_CXXSTD=03,11,14 161 | - B2_UBSAN=1 162 | - B2_DEFINES="BOOST_NO_STRESS_TEST=1" 163 | - B2_LINKFLAGS="-fuse-ld=gold" 164 | addons: *gcc-8 165 | 166 | - compiler: clang-6.0 167 | env: 168 | - COMMENT=valgrind 169 | - B2_CXXSTD=03,11,14 170 | - B2_DEFINES="BOOST_NO_STRESS_TEST=1" 171 | - B2_VARIANT=debug 172 | - B2_TESTFLAGS=testing.launcher=valgrind 173 | - VALGRIND_OPTS=--error-exitcode=1 174 | addons: *clang-6 175 | script: 176 | - cd $BOOST_ROOT/libs/$SELF 177 | - ci/travis/valgrind.sh 178 | 179 | # libstdc++ 180 | - { dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI 181 | compiler: g++-4.8 , env: [ "B2_CXXSTD=03,11" ], addons: *gcc-48 } 182 | - { dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI 183 | compiler: g++-4.9 , env: [ "B2_CXXSTD=03,11" ], addons: *gcc-49 } 184 | - { compiler: g++-5 , env: [ "B2_CXXSTD=03,11" ], addons: *gcc-5 } 185 | - { compiler: g++-6 , env: [ "B2_CXXSTD=11,14" ], addons: *gcc-6 } 186 | - { compiler: g++-7 , env: [ "B2_CXXSTD=14,17" ], addons: *gcc-7 } 187 | - { compiler: g++-8 , env: [ "B2_CXXSTD=17,2a" ], addons: *gcc-8 } 188 | - { compiler: g++-9 , env: [ "B2_CXXSTD=17,2a" ], addons: *gcc-9 } 189 | - { dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI 190 | compiler: clang-3.8, env: [ "B2_CXXSTD=03,11" ], addons: *clang-38 } 191 | - { compiler: clang-4.0, env: [ "B2_CXXSTD=11,14" ], addons: *clang-4 } 192 | - { compiler: clang-5.0, env: [ "B2_CXXSTD=11,14" ], addons: *clang-5 } 193 | - { compiler: clang-6.0, env: [ "B2_CXXSTD=14,17" ], addons: *clang-6 } 194 | - { compiler: clang-7 , env: [ "B2_CXXSTD=17,2a" ], addons: *clang-7 } 195 | - { compiler: clang-8 , env: [ "B2_CXXSTD=17,2a" ], addons: *clang-8 } 196 | - { compiler: clang-9 , env: [ "B2_CXXSTD=03,11,14,17,2a" ], addons: *clang-9 } 197 | - { compiler: clang-10 , env: [ "B2_CXXSTD=03,11,14,17,2a" ], addons: *clang-10 } 198 | 199 | # libc++ 200 | - { compiler: clang-6.0, env: [ "B2_CXXSTD=03,11,14", "B2_STDLIB=libc++" ], addons: *clang-6 } 201 | - { os: "osx", 202 | compiler: clang , env: [ "B2_CXXSTD=03,11,17" ] } 203 | 204 | # to enable Intel ICC define INTEL_ICC_SERIAL_NUMBER and the following (under development): 205 | # - { env: [ "B2_TOOLSET=intel-linux", "B2_CXXSTD=11,14,17" ], addons: *gcc-7, 206 | # script: cd $BOOST_ROOT/libs/$SELF && ci/travis/intelicc.sh } 207 | 208 | # uncomment to enable a big-endian build job, just note that it is 5-10 times slower 209 | # than a regular build and travis has a 50 minute time limit per job 210 | # - os: linux 211 | # compiler: gcc 212 | # env: 213 | # - COMMENT=big-endian 214 | # - B2_CXXSTD=03 215 | # - B2_DEFINES="BOOST_NO_STRESS_TEST=1" 216 | # - BDDE_OS=red 217 | # - BDDE_ARCH=ppc64 218 | # script: 219 | # - cd $BOOST_ROOT/libs/$SELF 220 | # - ci/travis/bdde.sh 221 | 222 | # - os: linux 223 | # env: 224 | # - COMMENT=cppcheck 225 | # script: 226 | # - cd $BOOST_ROOT/libs/$SELF 227 | # - ci/travis/cppcheck.sh 228 | 229 | #################### Jobs to run on pushes to master, develop ################### 230 | 231 | # Coverity Scan 232 | - if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (develop, master)) AND (type IN (cron, push)) 233 | compiler: clang 234 | env: [ COMMENT="Coverity Scan" ] 235 | script: 236 | - cd $BOOST_ROOT/libs/$SELF 237 | - ci/travis/coverity.sh 238 | 239 | notifications: 240 | email: 241 | false 242 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | braces: 6 | level: warning 7 | brackets: 8 | level: warning 9 | colons: 10 | level: warning 11 | commas: 12 | level: warning 13 | indentation: 14 | level: warning 15 | line-length: 16 | max: 200 17 | truthy: 18 | level: error 19 | 20 | -------------------------------------------------------------------------------- /CMake.md: -------------------------------------------------------------------------------- 1 | # CMake in Boost 2 | 3 | This document is meant to provide useful hints for Boost library maintainers to integrate CMake into their library. 4 | 5 | TOC: 6 | 7 | 1. [Quickstart](#quickstart) 8 | 1. How to add your [tests](#tests) to the CMake build 9 | 1. The special [tests](#ci-tests) that [Boost.CI](https://github.com/boostorg/boost-ci) additionally uses 10 | 1. Quick CMake [intro](#cmake-primer) of the CMake commands/functions you might need 11 | 1. Additional info for [header-only](#header-only-libraries) libraries and [CMake scopes](#scopes) 12 | 1. How the [Boost super-project](#boost-super-project--boostcmake) works 13 | 14 | ## Quickstart 15 | 16 | ### Build 17 | 18 | As the minimum you need a `CMakeLists.txt` file (or "CML") for short) in the root directory of the library. 19 | The [CMakeLists from Boost.CI](CMakeLists.txt) can be used as a starting point with only small modifications required. 20 | 21 | ### Tests 22 | 23 | You may also want a CML in the "test" folder for your tests. 24 | To avoid duplicating tests in B2 and CMake you can use `include(BoostTestJamfile)` to get access to `boost_test_jamfile(FILE Jamfile.v2)` which will "translate" (only) `run .cpp ;` into CMake tests. 25 | You can also use `boost_test(NAME SOURCES .cpp)` to add tests semi-automated. 26 | Both read a CMake variable which you can set with `set(BOOST_TEST_LINK_LIBRARIES )` to have your Boost library linked to each test after adding it (see [below](#cmake-primer)). 27 | 28 | See [BoostTest.cmake](https://github.com/boostorg/cmake/blob/develop/include/BoostTest.cmake) 29 | (included by [BoostTestJamfile.cmake](https://github.com/boostorg/cmake/blob/develop/include/BoostTestJamfile.cmake)) 30 | for full details of the helper macros. 31 | 32 | Of course you can use [`add_executable`](https://cmake.org/cmake/help/latest/command/add_executable.html) and [`add_test`](https://cmake.org/cmake/help/latest/command/add_test.html) to create your tests manually. 33 | You should then use a unique name for the created binaries. 34 | The ones created by the `boost_test` macro use `${PROJECT_NAME}-` as the prefix for each test. 35 | 36 | ### CI Tests 37 | 38 | Additionally the Boost.CI CI scripts reference subfolders of the `test` folder to test 2 common cases: 39 | 1. Searching for the installed library and using it. 40 | 1. Including the library to be built alongside the library/application that uses it. 41 | 42 | For this the folders `cmake_install_test` and `cmake_subdir_test` are used for each case respectively. 43 | They should contain a simple CML and a minimal program to check that the library can be linked to, its headers are found and the program runs. 44 | There is no need for more than a very small "Hello World"-example here as the real tests should be in the (parent) "test" folder. 45 | 46 | As there is practically no difference (or: "should be") between both use cases both can instead be combined into a single `cmake_test` folder with a single CML and CPP-file. 47 | The CI config detects the presence of a `cmake_test` folder and configures each case with `BOOST_CI_INSTALL_TEST` set to either `ON` or `OFF`. 48 | See the [Boost.CI cmake_test CML](test/cmake_test/CMakeLists.txt) for an example. 49 | 50 | ## CMake primer 51 | 52 | Key elements usually required by Boost libraries are (in order of use, with `` as placeholders): 53 | 54 | - [`cmake_minimum_required`](https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html)`(VERSION )`: 55 | Will error if the CMake being used is older than specified. 56 | Possibly changes behavior according to [CMake policies](https://cmake.org/cmake/help/latest/command/cmake_policy.html), i.e. potentially incompatible changes introduced in some CMake version. 57 | The `` can be `...` which basically means: Require at least CMake `` and enable all policies up to the current CMake version or ``. 58 | - [`project`](https://cmake.org/cmake/help/latest/command/project.html)`( VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)`: 59 | **Must** come first (after `cmake_minimum_required`), the name should be specific & unique enough (e.g. `boost_locale`) but doesn't matter much. 60 | The version uses `BOOST_SUPERPROJECT_VERSION` set by the top-level [Boost CML](https://github.com/boostorg/boost/blob/da041154c6bac1a4aa98254a7d6819059e8ac0b0/CMakeLists.txt#L15) 61 | **if** that is used, i.e. not when the library is built on its own or as part of another project via [`add_subdirectory`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html). 62 | Finally `LANGUAGES` overrides the default and avoids needlessly initializing the C compiler. 63 | - [`add_library`](https://cmake.org/cmake/help/latest/command/add_library.html)`(boost_ )`: 64 | Register the library and its source files as a target. 65 | `` is a list of relative paths (space separated so double-quote if the path contains spaces) and can (and should) contain headers too, so they show up in IDEs. 66 | For getting all headers without explicitly listing them use `file(GLOB_RECURSE headers include/*.hpp)` prior to this command and pass `${headers}` to this command. 67 | This is not recommended for source files because sources should be explicitly listed in order to regenerate the build system when the list of sources changes. 68 | **Special case:** For [header-only libraries](#header-only-libraries) use `INTERFACE` instead of ``. 69 | - [`add_library`](https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries)`(Boost:: ALIAS boost_)`: 70 | Register the ("Boost")-namespaced target which **users** will use instead of the `boost_` target. 71 | This makes usage more conventional and allows to detect missing libraries earlier but the "real" target (the one with the sources) cannot have special characters in its name. 72 | Hence the need to have an actual library namespaced/prefixed with `"boost_"` (which we can manipulate) and an alias prefixed with `"Boost::"`. 73 | **IMPORTANT:** The `` here and above **must** be the library/repository name with non-alphanumeric characters replaced by underscores in order to be compatible with expectations by the [Boost super-project](#boost-super-project--boostcmake). 74 | Examples: `add_library(Boost::locale ALIAS boost_locale)`, `add_library(Boost::type_traits ALIAS boost_type_traits)`. 75 | It makes sense to use the name of the real target (e.g. `boost_locale`) as the project name. 76 | - [`target_include_directories`](https://cmake.org/cmake/help/latest/command/target_include_directories.html)`(boost_ PUBLIC include)`: 77 | Add the `"include"` folder (i.e. a relative path) to the list of header search directories for this target/library and those using it (hence the `"PUBLIC"`). 78 | You can add more paths (space separated) and/or restrict the "scope" of those paths. 79 | To e.g. additionally add the "`src/helpers`" directory only when compiling this library use `target_include_directories(boost_ PUBLIC include PRIVATE src/helpers)` instead 80 | or `target_include_directories(boost_ PRIVATE src/helpers)` in addition to the above. 81 | - [`target_link_libraries`](https://cmake.org/cmake/help/latest/command/target_link_libraries.html)`(boost_ PUBLIC PRIVATE )`: 82 | Add the libraries as dependencies. 83 | This means their `PUBLIC` includes are visible when compiling `boost_` and if the dependency is not header-only that library is linked to this library. 84 | If your "`PUBLIC`" headers include headers of a dependency then it needs to be here as `PUBLIC`. 85 | If you only include those headers in your compiled sources then the dependency can be `PRIVATE`. 86 | Boost dependencies should be their namespaced name, e.g. `Boost::type_traits` or `Boost::core`. 87 | **IMPORTANT:** Each Boost dependency must be listed on its own line because the [Boost super-project](#boost-super-project--boostcmake) uses a very simple dependency scanner. 88 | 89 | Optionally you may want to use: 90 | 91 | - [`target_sources`](https://cmake.org/cmake/help/latest/command/target_sources.html)`(boost_ PRIVATE )`: 92 | If you don't want to or cannot pass (all) sources (and/or headers) to the `add_library` command you can add them with this command. 93 | Note that you (almost) always need to use `PRIVATE` here. 94 | - [`target_compile_definitions`](https://cmake.org/cmake/help/latest/command/target_compile_definitions.html)`(boost_ PRIVATE =)`: 95 | Add definitions to be used when compiling the library, i.e. `-D=value`. 96 | The `=` part is optional to define a valueless preprocessor symbol. 97 | - [`target_compile_features`](https://cmake.org/cmake/help/latest/command/target_compile_features.html)`(boost_locale PUBLIC cxx_std_11)`: 98 | Require (at least) C++11. 99 | Can also be used for any other (supported) [compiler feature](https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html). 100 | - [`if`](https://cmake.org/cmake/help/latest/command/if.html)`()\n\nendif()`: 101 | CMake supports also conditionals. 102 | Often you want `if()` (check if variable is not "false", i.e. unset, empty, `"OFF"`, `"FALSE"` etc.) or `if( STREQUAL "")` or `if(NOT STREQUAL )`. 103 | Examples: 104 | - `if(BOOST_SUPERPROJECT_SOURCE_DIR)` 105 | If the [super-project](#boost-super-project--boostcmake) is being built 106 | - `if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)` 107 | If CMake was invoked on the library folder, i.e. not the root Boost folder, using predefined variables. 108 | - `if(MSVC)` 109 | If the Visual Studio compiler is used. 110 | - `if(MSVC)` 111 | If the Visual Studio compiler is used. 112 | - `if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 113 | If either GCC or Clang (or "AppleClang") is used. 114 | 115 | ### Header-only libraries 116 | 117 | All of the above applies (almost) unchanged to header-only libraries: 118 | They are added as 2 targets and with their dependencies just as compiled libraries but with `add_library(boost_ INTERFACE)`, i.e. no sources and use of `INTERFACE`. 119 | The "sources" (i.e. headers) *can* then be added via [`target_sources`](https://cmake.org/cmake/help/latest/command/target_sources.html) in CMake >= 3.19. 120 | 121 | The only other difference is the use of `INTERFACE` instead of `PUBLIC`/`PRIVATE` in the `target_*` commands. 122 | The single exception of this rule is `target_sources` which needs `PRIVATE` as you want to associate the headers with this target (only) and not consumers of it. 123 | 124 | ### Scopes 125 | 126 | `PUBLIC`, `PRIVATE` & `INTERFACE` are "scopes" in CMake. 127 | - `PRIVATE`: Compile requirements, i.e. what is required for building the library. 128 | - `INTERFACE`: Usage requirements, i.e. what is required for using/linking to the library. 129 | - `PUBLIC`: Combines `PRIVATE` and `INTERFACE`, i.e. what is required for building **and** using the library. 130 | 131 | To decide between `PUBLIC` and `PRIVATE` check what is visible in headers included by users, including transitive includes (e.g. `detail/*.hpp`). 132 | For example: 133 | You most likely have a `/config.hpp` which is included by every header a user might include and that `config.hpp` includes ``. 134 | Hence even though a user never includes your config header directly it will transitively be included and hence also `` from Boost.Config. 135 | Therefore `Boost::config` is a `PUBLIC` dependency. 136 | 137 | For header-only libraries **everything** is "user-visible" so `PUBLIC` but there is no compiled part so `INTERFACE` is enough (and `PUBLIC` would actually be an error reported by CMake). 138 | 139 | ## Boost super-project / Boost.CMake 140 | 141 | CMake can be invoked on the Boost root folder due to its [CML](https://github.com/boostorg/boost/blob/master/CMakeLists.txt) which is its own project including each library as subprojects. 142 | Hence the top-level Boost project is called the "super-project". 143 | This is achieved with the [Boost.CMake](https://github.com/boostorg/cmake) submodule. 144 | The most important CMake variables (passed on the command line as `cmake -D= <...>`) are: 145 | 146 | - `BOOST_INCLUDE_LIBRARIES`: 147 | Similar to the `--with` B2 option 148 | - `BOOST_EXCLUDE_LIBRARIES`: 149 | Similar to the `--without-` B2 option 150 | - `CMAKE_BUILD_TYPE`: 151 | Can be e.g. `Debug` or `Release` 152 | - `BUILD_SHARED_LIBS`: 153 | Set to `ON` for shared or `OFF` for static libraries. 154 | - `BUILD_TESTING`: 155 | Set to `ON` or `OFF` (default) to build tests. This needs to be checked by [each libraries CML](https://github.com/boostorg/boost-ci/blob/dd0e6f1a934baa4ec8a588f36ef80fba9929fac2/CMakeLists.txt#L20-L22). 156 | 157 | In short what the super-project does is check each library folder for a `CMakeLists.txt` and include that if found. 158 | It will then search for the `Boost::` and `boost_` targets with `` derived from the repository/folder name of the library. 159 | Those targets will be added to-be-installed and the name and location of the library file are changed to match that of the B2 build. 160 | The super-project build will also try to automatically find and include dependencies of the library by checking for lines containing **only** `Boost::`. 161 | 162 | For this to work, libraries **must** follow the convention to have 2 targets named `Boost::` and `boost_` with `` being the repository/folder name. 163 | Any special character in the name needs to be replaced by underscores. 164 | Also any Boost dependency (i.e. `Boost::` targets) must be listed on its own line (whitespace is allowed). 165 | 166 | **Note:** Building Boost via CMake is experimental! 167 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Peter Dimov 2 | # Copyright 2021 Alexander Grund 3 | # Distributed under the Boost Software License, Version 1.0. 4 | # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt 5 | 6 | cmake_minimum_required(VERSION 3.5...3.16) 7 | 8 | project(boost_ci VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) 9 | 10 | add_library(boost_boost_ci INTERFACE) 11 | add_library(Boost::boost_ci ALIAS boost_boost_ci) 12 | 13 | if(NOT CMAKE_VERSION VERSION_LESS "3.19") 14 | file(GLOB_RECURSE headers include/*.hpp) 15 | target_sources(boost_boost_ci PRIVATE ${headers}) 16 | endif() 17 | 18 | target_include_directories(boost_boost_ci INTERFACE include) 19 | 20 | target_link_libraries(boost_boost_ci 21 | INTERFACE 22 | Boost::config 23 | ) 24 | 25 | if(BUILD_TESTING) 26 | add_subdirectory(test) 27 | endif() 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Boost](images/boost.png "Boost") 2 | 3 | # Boost.CI 4 | 5 | This repository contains scripts that enable continuous integration (CI) with 6 | [Appveyor](https://www.appveyor.com/), 7 | [Azure Pipelines](https://github.com/marketplace/azure-pipelines), 8 | [codecov.io](https://codecov.io/), 9 | [Coverity Scan](https://scan.coverity.com/), 10 | [GitHub Actions](https://github.com/features/actions), 11 | [Drone](https://drone.io/), 12 | and [Travis CI](https://travis-ci.org/). 13 | These scripts are intended to be downloaded and used during boost repository builds to improve project quality. 14 | In most cases the scripts are self-configuring. 15 | Some integrations require additional setup actions to complete. 16 | 17 | Boost.CI also allows you to run a big-endian build on Travis CI and Github Actions. 18 | 19 | ### Build Status 20 | 21 | GH Actions | Appveyor | Azure Pipelines | Drone | codecov.io | 22 | ---------- | -------- | --------------- | ----- | ---------- | 23 | [![Build status](https://github.com/boostorg/boost-ci/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/boost-ci/actions/workflows/ci.yml) | [![Build status](https://ci.appveyor.com/api/projects/status/ynnd2l3gu4oiyium/branch/master?svg=true)](https://ci.appveyor.com/project/Flamefire/boost-ci/branch/master) | [![Build Status](https://dev.azure.com/boostorg/boost-ci/_apis/build/status/boostorg.boost-ci?branchName=master)](https://dev.azure.com/boostorg/boost-ci/_build/latest?definitionId=8&branchName=master) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/boost-ci/status.svg)](https://drone.cpp.al/boostorg/boost-ci) | [![codecov](https://codecov.io/gh/boostorg/boost-ci/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/boost-ci/branch/master) | 24 | 25 | ## Summary (TL;DR) 26 | 27 | Here are all the steps you need to take as a Boost repository maintainer to enable all of these CI features in your repository. 28 | (Note that you may skip some steps, e.g. if you don't need a specific CI service): 29 | 30 | 1. Checkout `develop` and then make a new branch called `ci`. 31 | 1. Copy the `.appveyor.yml` file from this repository into the *top level* of your repository. 32 | 1. Copy the `.azure-pipelines.yml` file from this repository into the top level of your repository. 33 | 1. Copy the `.travis.yml` file from this repository into the top level of your repository. 34 | 1. Copy the `.github/workflows/ci.yml` file from this repository into the the same folder in your repository. 35 | * Note that those include CMake tests, so see the [CMake docs](CMake.md#ci-tests) for details and requirements. 36 | * For some features to work the `B2_CI_VERSION` variable set in those configs is relevant as without that a legacy codepath will be used to ensure compatibility with old CI configs 37 | 1. Copy the `.drone.star` file and optionally the `.drone` directory from this repository to the top level of your repository. 38 | 1. Copy the `.codecov.yml` file from this repository to the top level of your repository and edit if required. Note that **only** the file in the default branch (usually `master`) is considered! 39 | 1. Copy the `LICENSE` file from this repository to the top level of your repository. This adds the `BSL-1.0` designation to your repository on github. 40 | 1. [optional] Copy the `README.template.md` file from this repository to the top level `README.md` of your repository. If you already have a README.md then you can take what you need from the template version to improve it, if desired. Otherwise, you will need to customize README.md for your repository. One useful step is to fixup the repository name using the command `sed -i 's/template//g' README.md`, and then update the first line description. 41 | 1. In Appveyor, add a project for your fork of the repository. No customization is needed. 42 | 1. In Travis CI, add a project for your fork of the repository. Later you will customize it for Coverity Scan, but for now no settings changes are necessary. 43 | 1. Commit these changes and push to your personal fork in the ci branch. 44 | 1. Create a pull request in your fork of /ci to /develop. Do not target boostorg/develop. 45 | 1. Observe that the CI services are running the build jobs. Fix up any issues found. Note this may uncover defects in your repository code. 46 | 1. If you are the owner or an admin for your repository, add projects in Appveyor and Travis CI for the boostorg/ project (not your fork). If you are just a contributor in the repository, create an [issue in Boost.Admin](https://github.com/boostorg/admin/issues) requesting Appveyor and Travis CI to be enabled for the repository. 47 | 1. Commit the changes to develop. This will kick off a build. 48 | 1. Update the badge matrix in README.md with the correct links for your CI projects in use (e.g. Appveyor, Github Actions, Drone). 49 | 1. Create a Coverity Scan account if you have not already done so. 50 | 1. Create a new Coverity Scan github based project for your official boostorg repository. 51 | 1. In the CI settings (Github Actions, Drone and/or Travis) for your boostorg repository project add the following as **secrets**: 52 | * `CODECOV_TOKEN` is the "Repository Upload Token" from the project settings on [Codecov](https://codecov.io). 53 | * `COVERITY_SCAN_NOTIFICATION_EMAIL` is your email account (doesn't need to be a secret, but can be an environment variable for the repo). 54 | * `COVERITY_SCAN_TOKEN` is the scan token you can find in the project settings in Coverity Scan. 55 | * For GHA this is "Settings" -> "Secrets and Variables" -> "Actions" -> "Repository secrets" 56 | * In Drone it is "Settings" -> "Secrets" (**Different names:** `coverity_scan_email`, `coverity_scan_token`) 57 | 1. Update the README.md to put the correct Coverity Scan badge project number into the badge URLs. 58 | 1. This will kick off a build on the develop branch that will include Coverity Scan results. 59 | 1. To activate Drone, visit https://drone.cpp.al. Authorize Drone: Click the "Authorize cppalliance-drone" button. Sync repositories: Click the "sync" button. A list of repositories will appear. For the relevant repo, click and then choose "Activate Repository". In the settings page, change Configuration from .drone.yml to .drone.star. "Save". 60 | 1. More pointers about Drone: 61 | * Ensure that shell scripts are executable: `chmod 755 .drone/drone.sh` 62 | * The install-script (in `ci/drone`) and run-script (in `.drone`) for the Unix-ish jobs will be downloaded from Boost.CI if they don't exist, so you only need them when you want to customize the build. 63 | * The `.drone/{before,after}-install.*` scripts are sourced around the common_install step (which e.g. bootstraps B2) of the [default build](.drone/drone.sh), if they exist. So you can remove them when not required. 64 | * "asan" jobs require elevated privileges. Contact an administrator or open an issue at [drone-ci](https://github.com/CPPAlliance/drone-ci) to set your drone repository to "Trusted". 65 | * If not using asan, simply remove the jobs. 66 | * **Codecov:** Copy the "Repository Upload Token" from the settings page of your repo on [Codecov](https://codecov.io) to a secret named `codecov_token` on the settings page of your repo on [Drone](https://drone.cpp.al). 67 | * **Coverity:** Copy the token from the repos settings page on [Coverity](https://scan.coverity.com/) and an E-Mail-Address to a secrets named `coverity_scan_token` and `coverity_scan_email` respectively on the settings page of your repo on [Drone](https://drone.cpp.al). 68 | * If you need a package installed on MacOS or FreeBSD, by the root user, please open an issue. 69 | * Further info available at https://github.com/CPPAlliance/drone-ci 70 | 71 | ## Code coverage 72 | 73 | Multiple CI configs contain jobs collecting code coverage data. 74 | E.g. Github Actions and Drone CI for Linux and Appveyor for Windows. 75 | Especially the latter allows to collect coverage data for Windows-only codeparts or code using e.g. `wchar_t` which is different on Windows than on other platforms. 76 | 77 | ### Exclusion of coverage data 78 | 79 | If you want to exclude parts of your code from coverage analysis you can use the LCOV comments/macros: 80 | 81 | - `// LCOV_EXCL_LINE` for a single line 82 | - `// LCOV_EXCL_START` and `// LCOV_EXCL_STOP` for a range of code 83 | 84 | See the LCov manual for more information. 85 | 86 | To exclude whole files or folders you can use the `ignore`-object and glob patterns in in the `.codecov.yml` file. 87 | See the example file in the root of this repository for a starting point. 88 | **Important**: Codecov only considers the configuration file of the *default* branch (usually: `master`), **not** the one in the current build/PR branch. 89 | See the [CodeCov documentation](https://docs.codecov.com/docs/codecov-yaml) for details. 90 | 91 | ## Repositories using Boost.CI 92 | 93 | The [CMT Stale Repo Tracker](https://travis-ci.org/jeking3/boost-merge-reminder) identifies many repositories using Boost.CI and 94 | the [CMT Status Spreadsheet](https://docs.google.com/spreadsheets/d/1aFdTMdJmmD9L5IyvJx-nj3BrMVztmlNo8QwyEzLD2io/edit?usp=sharing) shows the current state of each. 95 | There may be additional repositories using Boost.CI that are not listed. Boost.CI does not track usage internally. 96 | 97 | ## How It Works 98 | 99 | The CI config files (such as `.appveyor.yml`, `.azure-pipeline.yml` and `.github/workflows/ci.yml`) must exist in your repository and will contain your customizations for build types, languages, and platforms. 100 | The templates provided will get you started with the build jobs listed below. 101 | 102 | These scripts will copy resources from the Boost.CI repository when needed in order to provide scripting necessary to run all these jobs successfully. 103 | 104 | Build jobs that will severely impact performance (such as `valgrind`) will define `BOOST_NO_STRESS_TEST` so those can be skipped or hobbled. 105 | 106 | ## Topic Branch Support 107 | 108 | The configuration for Github Actions, Azure Pipelines, Appveyor and Travis CI allow for automated branch builds on branch pushes matching these names: 109 | 110 | - master 111 | - develop 112 | - bugfix/* 113 | - feature/* 114 | - fix/* 115 | - pr/* 116 | 117 | Note that when opening a Pull Request (PR) the use of a topic branch name is not required and even discouraged as PRs are always built on CI and the use of a topic branch name will lead to duplicating all builds. 118 | 119 | A good strategy is to only use a topic branch name when actively working on a changeset and when you want CI to run for each push of that branch. 120 | When the changeset is (mostly) done it is advised to rename the branch right before opening a PR to avoid that double-build issue. 121 | This can be done easily via the GitHub website (check the "branches" link at the repo overview page) or of course via command line (push to a new remote branch and delete the old one). 122 | 123 | ## Defaults, Builds and Services 124 | 125 | By default the builds target multiple different C++ versions (from C++11 to C++20), and this can be customized. 126 | To see what kind of coverage these builds provide, see some build results as follows or click the badges above: 127 | 128 | - AppVeyor : https://ci.appveyor.com/project/Flamefire/boost-ci/branch/master 129 | - Github Actions : https://github.com/boostorg/boost-ci/actions/workflows/ci.yml 130 | - Azure Pipelines : https://dev.azure.com/boostorg/boost-ci/_build/latest?definitionId=8&branchName=master 131 | - Travis CI : https://travis-ci.org/boostorg/uuid/builds/449557162 132 | 133 | Without any customization the scripts can provide the following services (example only, see the actual CI scripts for current configurations): 134 | 135 | | CI | description | toolset | cxxflags/std | address-model | variant | 136 | | :-------- | :---------------------- | :---------- | :--------------------------| :------------ | :-------------- | 137 | | Appveyor | MSVC 2019 C++2a Strict | `msvc-14.2` | `2a`, `-permissive-` | `64` | `release` | 138 | | Appveyor | MSVC 2017 C++2a Strict | `msvc-14.1` | `2a`, `-permissive-` | `64` | `release` | 139 | | Appveyor | MSVC 2017 C++17 | `msvc-14.1` | `17` | `64` | `debug` | 140 | | Appveyor | MSVC 2017 C++17 | `clang-win` | `11` | `64` | `release` | 141 | | Appveyor | MSVC 2017 C++14 Default | `msvc-14.1` | default (14) | `32,64` | `release` | 142 | | Appveyor | MSVC 2015 C++14 Default | `msvc-14.0` | default (14) | `32,64` | `debug` | 143 | | Appveyor | MSVC 2013 | `msvc-12.0` | default (most of 11) | default | `release` | 144 | | Appveyor | MSVC 2012 | `msvc-11.0` | default (some of 11) | default | `release` | 145 | | Appveyor | MSVC 2010 | `msvc-10.0` | default (some of 0x) | default | `release` | 146 | | Appveyor | cygwin | `gcc` | `11` | `32` | `debug` | 147 | | Appveyor | cygwin64 | `gcc` | `11,17` | `64` | `release` | 148 | | Appveyor | mingw | `gcc` | `11` | `32` | `debug` | 149 | | Appveyor | mingw64 | `gcc` | `11,17` | `64` | `release` | 150 | | Azure P. | gcc 4.8 | `gcc-4.8` | `11` | default | `debug,release` | 151 | | Azure P. | gcc 4.9 | `gcc-4.9` | `11` | default | `debug,release` | 152 | | Azure P. | gcc 5 | `gcc-5` | `11` | default | `debug,release` | 153 | | Azure P. | gcc 6 | `gcc-6` | `11,14` | default | `debug,release` | 154 | | Azure P. | gcc 7 | `gcc-7` | `11,14,17` | default | `debug,release` | 155 | | Azure P. | gcc 8 | `gcc-8` | `14,17,2a` | default | `debug,release` | 156 | | Azure P. | clang-3.5 | `clang-3.5` | `11` | default | `debug,release` | 157 | | Azure P. | clang-3.6 | `clang-3.6` | `11` | default | `debug,release` | 158 | | Azure P. | clang-3.7 | `clang-3.7` | `11` | default | `debug,release` | 159 | | Azure P. | clang-3.8 | `clang-3.8` | `11,14` | default | `debug,release` | 160 | | Azure P. | clang-3.9 | `clang-3.8` | `11,14` | default | `debug,release` | 161 | | Azure P. | clang-4.0 | `clang-4.0` | `11,14,17` | default | `debug,release` | 162 | | Azure P. | clang-5.0 | `clang-5.0` | `11,14,17` | default | `debug,release` | 163 | | Azure P. | clang-6.0 | `clang-6.0` | `14,17,2a` | default | `debug,release` | 164 | | Azure P. | clang-6.0-libc++ | `clang-6.0` | `11,14,17,2a`, `libc++` | default | `debug,release` | 165 | | Azure P. | clang-7 | `clang-7` | `14,17,2a` | default | `debug,release` | 166 | | Azure P. | clang-8 | `clang-8` | `14,17,2a` | default | `debug,release` | 167 | | Azure P. | MSVC 2019 C++2a Strict | `msvc-14.2` | `2a`, `-permissive-` | `64` | `debug,release` | 168 | | Azure P. | MSVC 2017 C++2a Strict | `msvc-14.1` | `2a`, `-permissive-` | `64` | `debug,release` | 169 | | Azure P. | MSVC 2017 C++17 | `msvc-14.1` | `17` | `32,64` | `debug,release` | 170 | | Azure P. | MSVC 2017 C++14 Default | `msvc-14.1` | default (14) | `32,64` | `debug,release` | 171 | | Azure P. | MSVC 2015 C++14 Default | `msvc-14.0` | default (14) | `32,64` | `debug,release` | 172 | | Azure P. | Xcode 10.1 | `clang` | `14,17,2a` | default | `debug,release` | 173 | | Azure P. | Xcode 10.0 | `clang` | `14,17,2a` | default | `debug,release` | 174 | | Azure P. | Xcode 9.4.1 | `clang` | `11,14,17` | default | `debug,release` | 175 | | Azure P. | Xcode 9.4 | `clang` | `11,14,17` | default | `debug,release` | 176 | | Azure P. | Xcode 9.3.1 | `clang` | `11,14` | default | `debug,release` | 177 | | Azure P. | Xcode 9.3 | `clang` | `11,14` | default | `debug,release` | 178 | | Azure P. | Xcode 9.2 | `clang` | `11,14` | default | `debug,release` | 179 | | Azure P. | Xcode 9.1 | `clang` | `11` | default | `debug,release` | 180 | | Azure P. | Xcode 9.0.1 | `clang` | `11` | default | `debug,release` | 181 | | Azure P. | Xcode 9.0 | `clang` | `11` | default | `debug,release` | 182 | | Azure P. | Xcode 8.3.3 | `clang` | `11` | default | `debug,release` | 183 | | Travis CI | gcc 4.8 | `gcc-4.8` | `11` | default | `release` | 184 | | Travis CI | gcc 4.9 | `gcc-4.9` | `11` | default | `release` | 185 | | Travis CI | gcc 5 | `gcc-5` | `11` | default | `release` | 186 | | Travis CI | gcc 6 | `gcc-6` | `11,14` | default | `release` | 187 | | Travis CI | gcc 7 | `gcc-7` | `14,17` | default | `release` | 188 | | Travis CI | gcc 8 | `gcc-8` | `17,2a` | default | `release` | 189 | | Travis CI | gcc 9 | `gcc-9` | `17,2a` | default | `release` | 190 | | Travis CI | clang-3.8 | `clang-3.8` | `11` | default | `release` | 191 | | Travis CI | clang-4.0 | `clang-4.0` | `11,14` | default | `release` | 192 | | Travis CI | clang-5.0 | `clang-5.0` | `11,14` | default | `release` | 193 | | Travis CI | clang-6.0 | `clang-6.0` | `14,17` | default | `release` | 194 | | Travis CI | clang-6.0-libc++ | `clang-6.0` | `11,14`, `libc++` | default | `release` | 195 | | Travis CI | clang-7 | `clang-7` | `17,2a` | default | `release` | 196 | | Travis CI | clang-8 | `clang-8` | `17,2a` | default | `release` | 197 | | Travis CI | osx (clang) | `clang` | `11,17` | default | `release` | 198 | | Travis CI | big-endian | `gcc` | default | default | `debug` | 199 | | Travis CI | codecov.io | `gcc-8` | default | default | `debug` | 200 | | Travis CI | covscan | `clang` | default | default | `debug` | 201 | | Travis CI | asan | `gcc-8` | `11,14` | default | `debug` | 202 | | Travis CI | tsan | `gcc-8` | `11,14` | default | `debug` | 203 | | Travis CI | ubsan | `gcc-8` | `11,14` | default | `debug` | 204 | | Travis CI | valgrind | `clang-6.0` | `11,14` | default | `debug` | 205 | -------------------------------------------------------------------------------- /README.template.md: -------------------------------------------------------------------------------- 1 | MyTemplate, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), is a placeholder for an actual README for your repository. 2 | 3 | ### License 4 | 5 | Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). 6 | 7 | ### Properties 8 | 9 | * C++11 10 | * Header-Only 11 | 12 | ### Build Status 13 | 14 | Branch | Travis | GH Actions | Appveyor | Azure Pipelines | Coverity Scan | codecov.io | Deps | Docs | Tests | 15 | :-------------: | ------ | ---------- | -------- | --------------- |-------------- | ---------- | ---- | ---- | ----- | 16 | [`master`](https://github.com/boostorg/template/tree/master) | [![Build Status](https://travis-ci.org/boostorg/template.svg?branch=master)](https://travis-ci.org/boostorg/template) | [![CI](https://github.com/boostorg/template/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/template/actions/workflows/ci.yml) | [![Build status](https://ci.appveyor.com/api/projects/status/github/boostorg/template?branch=master&svg=true)](https://ci.appveyor.com/project/maintainer/template-xyzzy/branch/master) | [![Build Status](https://dev.azure.com/maintainer/template/_apis/build/status/pipeline?branchName=master)](https://dev.azure.com/maintainer/template/_build/latest?definitionId=6&branchName=master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/BADLE-NUMBER-LIKE-13982/badge.svg)](https://scan.coverity.com/projects/boostorg-template) | [![codecov](https://codecov.io/gh/boostorg/template/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/template/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/template.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/template/doc/html/template.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/template.html) 17 | [`develop`](https://github.com/boostorg/template/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/template.svg?branch=develop)](https://travis-ci.org/boostorg/template) | [![CI](https://github.com/boostorg/template/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/template/actions/workflows/ci.yml) | [![Build status](https://ci.appveyor.com/api/projects/status/github/boostorg/template?branch=develop&svg=true)](https://ci.appveyor.com/project/maintainer/template-xyzzy/branch/develop) | [![Build Status](https://dev.azure.com/maintainer/template/_apis/build/status/pipeline?branchName=develop)](https://dev.azure.com/maintainer/template/_build/latest?definitionId=6&branchName=develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/BADGE-NUMBER-LIKE-13982/badge.svg)](https://scan.coverity.com/projects/boostorg-template) | [![codecov](https://codecov.io/gh/boostorg/template/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/template/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/template.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/template/doc/html/template.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/template.html) 18 | 19 | ### Directories 20 | 21 | | Name | Purpose | 22 | | ----------- | ------------------------------ | 23 | | `doc` | documentation | 24 | | `example` | examples | 25 | | `include` | headers | 26 | | `test` | unit tests | 27 | 28 | ### More information 29 | 30 | * [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-template) 31 | * [Report bugs](https://github.com/boostorg/template/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. 32 | * Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). 33 | * Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[template]` tag at the beginning of the subject line. 34 | 35 | -------------------------------------------------------------------------------- /ci/add-apt-keys.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2023-2024 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Add APT keys 9 | # - Each argument should be a key URL or a key ID (0x...) 10 | # - $NET_RETRY_COUNT is the amount of retries attempted 11 | 12 | set -eu 13 | 14 | function do_add_key 15 | { 16 | key_url=$1 17 | # If a keyserver URL (e.g. http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F) 18 | # use the hash as the filename, 19 | # if it is an ID, e.g. 0x1E9377A2BA9EF27F, use it as the filename, and http://keyserver.ubuntu.com/pks/lookup as the URL 20 | # else assume the URL contains a filename, e.g. https://apt.llvm.org/llvm-snapshot.gpg.key 21 | if [[ "$key_url" =~ .*keyserver.*search=0x([A-F0-9]+) ]]; then 22 | keyfilename="${BASH_REMATCH[1]}.key" 23 | elif [[ $key_url =~ ^0x[A-F0-9]+$ ]]; then 24 | keyfilename=${key_url#0x}.key 25 | key_url="http://keyserver.ubuntu.com/pks/lookup?op=get&search=$key_url" 26 | else 27 | keyfilename=$(basename -s .key "$key_url") 28 | fi 29 | echo -e "\tDownloading APT key from '$key_url' to '$keyfilename'" 30 | if ! curl -sSL --retry "${NET_RETRY_COUNT:-5}" "$key_url" | sudo gpg --dearmor -o "/etc/apt/trusted.gpg.d/${keyfilename}"; then 31 | echo "Failed downloading $keyfilename" 32 | return 1 33 | fi 34 | } 35 | 36 | for key_url in "$@"; do 37 | [[ -n $key_url ]] || continue 38 | do_add_key "$key_url" 39 | done 40 | -------------------------------------------------------------------------------- /ci/add-apt-repositories.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2023 Sam Darwin 4 | # Copyright 2023-2024 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Add APT keys, i.e. wrapper around add-apt-repository 10 | # - Each argument should be a repository name 11 | # - $NET_RETRY_COUNT is the amount of retries attempted 12 | 13 | set -eu 14 | 15 | function do_add_repository { 16 | name=$1 17 | echo -e "\tAdding repository $name" 18 | for i in $(seq "${NET_RETRY_COUNT:-3}"); do 19 | if [[ $i -ne 1 ]]; then 20 | sleep 10 21 | echo -e "\tRetrying" 22 | fi 23 | if sudo -E apt-add-repository -y "$name"; then 24 | return 0 25 | fi 26 | done 27 | echo "Failed adding $name" 28 | return 1 # Failed 29 | } 30 | 31 | for repo_name in "$@"; do 32 | [[ -n $repo_name ]] || continue 33 | do_add_repository "$repo_name" 34 | done 35 | -------------------------------------------------------------------------------- /ci/appveyor/cygwin-update.bat: -------------------------------------------------------------------------------- 1 | :: 2 | :: cygwin additional install Script for Appveyor - updates cygwin to latest 3 | :: Copyright (C) 2018 James E. King III 4 | :: Distributed under the Boost Software License, Version 1.0. 5 | :: (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | :: 7 | 8 | @ECHO ON 9 | :: Occasionally build slaves complain about a mismatched cygwin1.dll so 10 | :: in case that happens let's see what is going on. 11 | WHERE cygwin1.dll 12 | 13 | IF "%PATH:~0,12%" == "C:\cygwin64\" (SET CYGWIN_SUFFIX=_64) 14 | 15 | appveyor DownloadFile https://cygwin.com/setup-x86%CYGWIN_SUFFIX%.exe 16 | setup-x86%CYGWIN_SUFFIX%.exe -q 17 | setup-x86%CYGWIN_SUFFIX%.exe -q -P clang 18 | -------------------------------------------------------------------------------- /ci/appveyor/install.bat: -------------------------------------------------------------------------------- 1 | @ECHO ON 2 | 3 | REM Handle old appveyor configs 4 | IF NOT DEFINED B2_CI_VERSION ( 5 | IF DEFINED CXXFLAGS ( 6 | SET B2_CXXFLAGS=%CXXFLAGS% 7 | SET CXXFLAGS= 8 | ) 9 | ) 10 | SET BOOST_CI_TARGET_BRANCH=%APPVEYOR_REPO_BRANCH% 11 | SET BOOST_CI_SRC_FOLDER=%APPVEYOR_BUILD_FOLDER% 12 | 13 | call %~dp0\..\common_install.bat 14 | -------------------------------------------------------------------------------- /ci/appveyor/mingw.bat: -------------------------------------------------------------------------------- 1 | :: 2 | :: MinGW Build Script for Appveyor, leveraging the MSYS2 installation 3 | :: Copyright (C) 2018 - 2019 James E. King III 4 | :: Distributed under the Boost Software License, Version 1.0. 5 | :: (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | :: 7 | 8 | @ECHO ON 9 | SETLOCAL EnableDelayedExpansion 10 | 11 | :: Set up the toolset 12 | echo using gcc : %FLAVOR% : %ARCH%-w64-mingw32-g++.exe ; > %USERPROFILE%\user-config.jam 13 | SET UPPERFLAVOR=%FLAVOR% 14 | CALL :TOUPPER UPPERFLAVOR 15 | 16 | :: Update pacman. Notes about new keys and zstd archive format at https://www.msys2.org/news 17 | 18 | if not exist "C:\TEMP" mkdir C:\TEMP 19 | 20 | ( 21 | echo echo "Parsing pacman version" 22 | echo upgradepacman="no" 23 | echo pacversion=$(pacman -V ^| grep -o -E '[0-9]+\.[0-9]+\.[0-9]' ^| head -n 1 ^) 24 | echo echo "pacman version is $pacversion" 25 | echo arrversion=(${pacversion//./ }^) 26 | echo majorversion=${arrversion[0]} 27 | echo minorversion=${arrversion[1]} 28 | echo if [ "$majorversion" -lt "5" ]; then 29 | echo upgradepacman="yes" 30 | echo elif [ "$majorversion" -eq "5" ] ^&^& [ "$minorversion" -lt "2" ]; then 31 | echo upgradepacman="yes" 32 | echo fi 33 | echo if [ "$upgradepacman" = "yes" ] ; then 34 | echo echo "Now upgrading pacman" 35 | echo echo "Keys:" 36 | echo curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz 37 | echo curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig 38 | echo pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig 39 | echo pacman --noconfirm -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz 40 | echo echo "Packages:" 41 | echo pacman --noconfirm -U "http://repo.msys2.org/msys/x86_64/libzstd-1.4.5-2-x86_64.pkg.tar.xz" 42 | echo pacman --noconfirm -U "http://repo.msys2.org/msys/x86_64/zstd-1.4.5-2-x86_64.pkg.tar.xz" 43 | echo pacman --noconfirm -U "http://repo.msys2.org/msys/x86_64/pacman-5.2.2-5-x86_64.pkg.tar.xz" 44 | echo else 45 | echo echo "Not upgrading pacman" 46 | echo fi 47 | )>C:\TEMP\updatepacman.sh 48 | 49 | c:\msys64\usr\bin\bash -l -c "/c/TEMP/updatepacman.sh" || EXIT /B 1 50 | 51 | :: Install packages needed to build boost 52 | :: Optional: comment out ones this library does not need, 53 | :: so people can copy this script to another library. 54 | 55 | FOR %%a IN ("gcc" "icu" "libiconv" "openssl" "xz" "zlib") DO ( 56 | :: check if the package has already been installed. 57 | c:\msys64\usr\bin\bash -l -c "pacman -Qi mingw-w64-%ARCH%-%%a" >nul 2>&1 58 | 59 | if %errorlevel 1 ( 60 | c:\msys64\usr\bin\env MSYSTEM=%UPPERFLAVOR% c:\msys64\usr\bin\bash -l -c ^ 61 | "pacman -Sy --needed --noconfirm %FLAVOR%/mingw-w64-%ARCH%-%%a" || EXIT /B 1 62 | ) 63 | ) 64 | c:\msys64\usr\bin\env MSYSTEM=%UPPERFLAVOR% c:\msys64\usr\bin\bash -l -c ^ 65 | "pacman --sync --needed --noconfirm python3" || EXIT /B 1 66 | 67 | :: 68 | :: Fix older build script definitions 69 | :: 70 | if NOT DEFINED B2_CI_VERSION ( 71 | IF DEFINED CXXSTD (SET B2_CXXSTD=%CXXSTD%) 72 | IF DEFINED CXXSTD (SET CXXSTD=) 73 | :: Those 2 were broken 74 | IF DEFINED CXXFLAGS (EXIT /B 1) 75 | IF DEFINED DEFINES (EXIT /B 1) 76 | :: This is done by build.bat now 77 | IF DEFINED B2_CXXSTD (SET B2_CXXSTD=cxxstd=%B2_CXXSTD%) 78 | ) 79 | 80 | :: 81 | :: Now build things... 82 | :: 83 | 84 | SET B2_TOOLCXX=toolset=gcc-%FLAVOR% 85 | 86 | c:\msys64\usr\bin\env MSYSTEM=%UPPERFLAVOR% c:\msys64\usr\bin\bash -l -c ^ 87 | "cd %CD:\=/% && ./bootstrap.sh --with-toolset=gcc" || EXIT /B 1 88 | 89 | c:\msys64\usr\bin\env MSYSTEM=%UPPERFLAVOR% c:\msys64\usr\bin\bash -l -c ^ 90 | "cd %CD:\=/% && ./b2 --abbreviate-paths libs/%SELF:\=/%/test %B2_TOOLCXX% %B2_CXXSTD% %B2_CXXFLAGS% %B2_DEFINES% %B2_THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_VARIANT% -j3" || EXIT /B 1 91 | EXIT /B 0 92 | 93 | :: 94 | :: Function to uppercase a variable 95 | :: from: https://stackoverflow.com/questions/34713621/batch-converting-variable-to-uppercase 96 | :: 97 | 98 | :TOUPPER 99 | @ECHO OFF 100 | FOR %%a IN ("a=A" "b=B" "c=C" "d=D" "e=E" "f=F" "g=G" "h=H" "i=I" 101 | "j=J" "k=K" "l=L" "m=M" "n=N" "o=O" "p=P" "q=Q" "r=R" 102 | "s=S" "t=T" "u=U" "v=V" "w=W" "x=X" "y=Y" "z=Z" ) DO ( CALL SET %~1=%%%~1:%%~a%% ) 103 | @ECHO ON 104 | GOTO :EOF 105 | -------------------------------------------------------------------------------- /ci/azure-pipelines/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Bash script to run in Linux images of Azure Pipelines to 9 | # perform a bjam build. 10 | # 11 | . $(dirname "${BASH_SOURCE[0]}")/../build.sh 12 | -------------------------------------------------------------------------------- /ci/azure-pipelines/install.bat: -------------------------------------------------------------------------------- 1 | @ECHO ON 2 | setlocal enabledelayedexpansion 3 | 4 | SET BOOST_CI_TARGET_BRANCH=%BUILD_SOURCEBRANCHNAME% 5 | SET BOOST_CI_SRC_FOLDER=%BUILD_SOURCESDIRECTORY% 6 | 7 | call %~dp0\..\common_install.bat 8 | 9 | REM Persist variables 10 | @ECHO OFF 11 | echo ##vso[task.setvariable variable=SELF]%SELF% 12 | echo ##vso[task.setvariable variable=BOOST_ROOT]%BOOST_ROOT% 13 | -------------------------------------------------------------------------------- /ci/azure-pipelines/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Copyright 2019 Mateusz Loskot 5 | # Copyright 2021-2024 Alexander Grund 6 | # Distributed under the Boost Software License, Version 1.0. 7 | # (See accompanying file LICENSE_1_0.txt or copy at 8 | # http://www.boost.org/LICENSE_1_0.txt) 9 | # 10 | # Executes the install phase for Azure Pipelines (AzP) 11 | # 12 | # 13 | # If your repository has additional directories beyond 14 | # "example", "examples", "tools", and "test" then you 15 | # can add them in the environment variable DEPINST. 16 | # i.e. - DEPINST="--include dirname1 --include dirname2" 17 | # 18 | # To install packages set PACKAGES and optionally LLVM_REPO 19 | 20 | set -ex 21 | 22 | function get_compiler_package { 23 | local result="$1" 24 | result="${result/gcc-/g++-}" 25 | result="${result/clang++-/clang-}" 26 | echo "$result" 27 | } 28 | 29 | if [ "$AGENT_OS" == "Darwin" ]; then 30 | unset -f cd 31 | fi 32 | 33 | # CI builds set BUILD_SOURCEBRANCHNAME 34 | # Pull request builds set SYSTEM_PULLREQUEST_TARGETBRANCH. 35 | export BOOST_CI_TARGET_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH:-$BUILD_SOURCEBRANCHNAME}" 36 | export BOOST_CI_SRC_FOLDER="$BUILD_SOURCESDIRECTORY" 37 | 38 | if [ -z "$B2_COMPILER" ]; then 39 | export B2_COMPILER="$CXX" 40 | fi 41 | 42 | if [ "$AGENT_OS" != "Darwin" ]; then 43 | # If no package set install at least the compiler if not already found 44 | if [[ -z "$PACKAGES" ]] && ! command -v $B2_COMPILER; then 45 | PACKAGES="$(get_compiler_package "$B2_COMPILER")" 46 | fi 47 | 48 | if [ -n "$PACKAGES" ]; then 49 | for i in {1..${NET_RETRY_COUNT:-3}}; do 50 | sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 10 51 | done 52 | if [ -n "${LLVM_REPO}" ]; then 53 | curl -sSL --retry ${NET_RETRY_COUNT:-5} https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg 54 | for i in {1..${NET_RETRY_COUNT:-3}}; do 55 | sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS:-xenial}/ ${LLVM_REPO} main" && break || sleep 10 56 | done 57 | fi 58 | sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" update 59 | sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ${PACKAGES} 60 | fi 61 | 62 | if [[ -z "$GCC_TOOLCHAIN_ROOT" ]] && [[ -n "$GCC_TOOLCHAIN" ]]; then 63 | GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" 64 | echo "##vso[task.setvariable variable=GCC_TOOLCHAIN_ROOT]$GCC_TOOLCHAIN_ROOT" 65 | if ! command -v dpkg-architecture; then 66 | apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install dpkg-dev 67 | fi 68 | MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" 69 | mkdir -p "$GCC_TOOLCHAIN_ROOT" 70 | ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" 71 | ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" 72 | mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" 73 | ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/$GCC_TOOLCHAIN" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/$GCC_TOOLCHAIN" 74 | fi 75 | fi 76 | 77 | old_B2_TOOLSET="$B2_TOOLSET" 78 | 79 | . $(dirname "${BASH_SOURCE[0]}")/../common_install.sh 80 | 81 | # AzP requires to run special task in order to export job-scoped variable from a script. 82 | # 83 | # NOTE: The set +x is required! See the troubleshooting guide: 84 | # https://docs.microsoft.com/en-us/azure/devops/pipelines/troubleshooting#variables-having--single-quote-appended 85 | 86 | set +x 87 | echo "##vso[task.setvariable variable=SELF]$SELF" 88 | echo "##vso[task.setvariable variable=BOOST_ROOT]$BOOST_ROOT" 89 | [ -n "old_B2_TOOLSET" ] || echo "##vso[task.setvariable variable=B2_TOOLSET]$B2_TOOLSET" 90 | echo "##vso[task.setvariable variable=B2_COMPILER]$B2_COMPILER" 91 | set -x 92 | -------------------------------------------------------------------------------- /ci/build.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | setlocal enabledelayedexpansion 3 | 4 | IF NOT DEFINED B2_CI_VERSION ( 5 | echo You need to set B2_CI_VERSION in your CI script 6 | exit /B 1 7 | ) 8 | 9 | IF DEFINED ADDPATH (SET "PATH=%ADDPATH%%PATH%") 10 | 11 | SET B2_TOOLCXX=toolset=%B2_TOOLSET% 12 | 13 | IF DEFINED B2_CXXSTD (SET B2_CXXSTD=cxxstd=%B2_CXXSTD%) 14 | IF DEFINED B2_CXXFLAGS (SET B2_CXXFLAGS=cxxflags=%B2_CXXFLAGS%) 15 | IF DEFINED B2_DEFINES (SET B2_DEFINES=define=%B2_DEFINES%) 16 | IF DEFINED B2_INCLUDE (SET B2_INCLUDE=include=%B2_INCLUDE%) 17 | IF DEFINED B2_ADDRESS_MODEL (SET B2_ADDRESS_MODEL=address-model=%B2_ADDRESS_MODEL%) 18 | IF DEFINED B2_LINK (SET B2_LINK=link=%B2_LINK%) 19 | IF DEFINED B2_VARIANT (SET B2_VARIANT=variant=%B2_VARIANT%) 20 | 21 | set SELF_S=%SELF:\=/% 22 | IF NOT DEFINED B2_TARGETS (SET B2_TARGETS=libs/!SELF_S!/test) 23 | IF NOT DEFINED B2_JOBS (SET B2_JOBS=3) 24 | 25 | REM clang-win requires to use the linker for the manifest 26 | IF "%B2_TOOLSET%" == "clang-win" ( 27 | IF NOT DEFINED B2_FLAGS ( 28 | SET B2_FLAGS=embed-manifest-via=linker 29 | ) ELSE ( 30 | SET B2_FLAGS=embed-manifest-via=linker %B2_FLAGS% 31 | ) 32 | ) 33 | 34 | cd %BOOST_ROOT% 35 | 36 | IF DEFINED SCRIPT ( 37 | call libs\%SELF%\%SCRIPT% 38 | ) ELSE ( 39 | REM Echo the complete build command to the build log 40 | ECHO b2 --abbreviate-paths %B2_TARGETS% %B2_TOOLCXX% %B2_CXXSTD% %B2_CXXFLAGS% %B2_DEFINES% %B2_INCLUDE% %B2_THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_VARIANT% -j%B2_JOBS% %B2_FLAGS% 41 | REM Now go build... 42 | b2 --abbreviate-paths %B2_TARGETS% %B2_TOOLCXX% %B2_CXXSTD% %B2_CXXFLAGS% %B2_DEFINES% %B2_INCLUDE% %B2_THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_VARIANT% -j%B2_JOBS% %B2_FLAGS% 43 | ) 44 | -------------------------------------------------------------------------------- /ci/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2022 James E. King III 4 | # Copyright 2020 - 2025 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Bash script to perform a bjam build 10 | # 11 | 12 | set -eux 13 | 14 | : "${B2_TARGETS:="libs/$SELF/test"}" 15 | 16 | . "$(dirname "${BASH_SOURCE[0]}")"/enforce.sh 17 | 18 | export UBSAN_OPTIONS=print_stacktrace=1,report_error_type=1,${UBSAN_OPTIONS:-} 19 | 20 | cd "$BOOST_ROOT" 21 | 22 | # Save previous config if present. Append to that after finish 23 | b2_config="$BOOST_ROOT/bin.v2/config.log" 24 | if [[ -f "$b2_config" ]]; then 25 | prev_config=$(mktemp) 26 | mv "$b2_config" "$prev_config" 27 | function prepend_config { 28 | [[ -f "$b2_config" ]] || return 29 | echo "=========================== END PREVIOUS CONFIG ======================" >> "$prev_config" 30 | cat "$b2_config" >> "$prev_config" 31 | mv "$prev_config" "$b2_config" 32 | } 33 | trap prepend_config EXIT 34 | fi 35 | 36 | # shellcheck disable=SC2086 37 | ${B2_WRAPPER:-} ./b2 ${B2_TARGETS} "${B2_ARGS[@]}" "$@" 38 | 39 | if [ "${B2_USE_CCACHE:-0}" == "1" ] && command -v ccache &> /dev/null; then 40 | echo "CCache summary" 41 | ccache -s 42 | fi 43 | -------------------------------------------------------------------------------- /ci/codecov.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2019 - 2021 Alexander Grund 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | $ErrorActionPreference = "Stop" 6 | 7 | $scriptPath = split-path $MyInvocation.MyCommand.Path 8 | 9 | # Install uploader 10 | Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe 11 | 12 | # Verify integrity 13 | if (Get-Command "gpg.exe" -ErrorAction SilentlyContinue){ 14 | $ProgressPreference = 'SilentlyContinue' 15 | Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc 16 | Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM 17 | Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig 18 | 19 | $ErrorActionPreference = "Continue" 20 | gpg.exe --logger-fd 1 --import codecov.asc 21 | if ($LASTEXITCODE -ne 0) { Throw "Importing the key failed." } 22 | gpg.exe --logger-fd 1 --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM 23 | if ($LASTEXITCODE -ne 0) { Throw "Signature validation of the SHASUM failed." } 24 | If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { 25 | echo "SHASUM verified" 26 | } Else { 27 | exit 1 28 | } 29 | } 30 | 31 | &"$scriptPath\opencppcoverage.ps1" 32 | if ($LASTEXITCODE -ne 0) { Throw "Coverage collection failed." } 33 | 34 | # Upload 35 | ./codecov.exe --name Appveyor --env APPVEYOR_BUILD_WORKER_IMAGE --verbose --nonZero --dir __out --rootDir "${env:BOOST_CI_SRC_FOLDER}" 36 | if ($LASTEXITCODE -ne 0) { Throw "Upload of coverage data failed." } 37 | -------------------------------------------------------------------------------- /ci/codecov.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2022 James E. King III 4 | # Copyright 2021-2024 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Bash script to to perform codecov.io integration 10 | # 11 | 12 | # Same requirements as build.sh 13 | # Requires env vars: 14 | # - BOOST_CI_SRC_FOLDER 15 | # - BOOST_ROOT 16 | # - SELF 17 | # Call with either "setup", "collect" or "upload" as parameter 18 | 19 | # 20 | # If you want to exclude content from the coverage report you must check in 21 | # a .codecov.yml file as is found in the boost-ci project, and it must be 22 | # in the default branch for the repository. It will not be picked up from 23 | # a pull request. 24 | # 25 | 26 | set -eux 27 | 28 | . "$(dirname "${BASH_SOURCE[0]}")"/enforce.sh 29 | 30 | coverage_action=${1:-''} 31 | 32 | if [[ "$coverage_action" == "setup" ]]; then 33 | if [ -z "${B2_CI_VERSION:-}" ]; then 34 | # Old CI version needs to use the prefixes 35 | export B2_VARIANT="variant=debug" 36 | export B2_CXXFLAGS="${B2_CXXFLAGS:+$B2_CXXFLAGS }cxxflags=-fkeep-static-functions cxxflags=--coverage" 37 | export B2_LINKFLAGS="${B2_LINKFLAGS:+$B2_LINKFLAGS } linkflags=--coverage" 38 | else 39 | export B2_VARIANT=debug 40 | export B2_CXXFLAGS="${B2_CXXFLAGS:+$B2_CXXFLAGS }-fkeep-static-functions --coverage" 41 | export B2_LINKFLAGS="${B2_LINKFLAGS:+$B2_LINKFLAGS }--coverage" 42 | fi 43 | 44 | elif [[ "$coverage_action" == "collect" ]] || [[ "$coverage_action" == "upload" ]]; then 45 | if [ -z "${GCOV:-}" ]; then 46 | ver=7 # default 47 | if [ "${B2_TOOLSET%%-*}" == "gcc" ]; then 48 | if [[ "$B2_TOOLSET" =~ gcc- ]]; then 49 | ver="${B2_TOOLSET##*gcc-}" 50 | elif [[ "$B2_COMPILER" =~ gcc- ]]; then 51 | ver="${B2_COMPILER##*gcc-}" 52 | fi 53 | fi 54 | GCOV=gcov-${ver} 55 | fi 56 | 57 | : "${LCOV_VERSION:=v2.3}" # Set default lcov version to install 58 | : "${LCOV_OPTIONS:=}" 59 | 60 | : "${LCOV_BRANCH_COVERAGE:=1}" # Set default for branch coverage 61 | 62 | : "${LCOV_IGNORE_ERRORS_LEVEL:="standard"}" # Set default error level. See below. 63 | 64 | case $LCOV_IGNORE_ERRORS_LEVEL in 65 | off) 66 | # All errors are potentially fatal. 67 | lcov_errors_to_ignore="";; 68 | minimal) 69 | # A suggested minimum even when trying to catch errors. 70 | lcov_errors_to_ignore="unused";; 71 | all) 72 | # ignore all lcov errors 73 | lcov_errors_to_ignore="annotate,branch,callback,category,child,count,corrupt,deprecated,empty,excessive,fork,format,inconsistent,internal,mismatch,missing,negative,package,parallel,path,range,source,unmapped,unsupported,unused,usage,utility,version";; 74 | standard) 75 | # A recommended default. 76 | # The majority of boost libraries should pass. 77 | # Notes about this setting: 78 | # inconsistent - This error indicates that your coverage data is internally inconsistent: it makes two or more mutually exclusive claims. 79 | # mismatch - Incorrect or inconsistent information found in coverage data and/or source code - for example, the source code contains overlapping exclusion directives. 80 | # unused - The include/exclude/erase/substitute/omit pattern did not match any file pathnames. 81 | # 82 | lcov_errors_to_ignore="inconsistent,mismatch,unused";; 83 | *) 84 | echo "The value of LCOV_IGNORE_ERRORS_LEVEL ($LCOV_IGNORE_ERRORS_LEVEL) is not recognized." 85 | echo "Please correct this. Exiting." 86 | exit 1 87 | esac 88 | 89 | if [ -n "${lcov_errors_to_ignore}" ]; then 90 | lcov_ignore_errors_flag="--ignore-errors ${lcov_errors_to_ignore}" 91 | else 92 | lcov_ignore_errors_flag="" 93 | fi 94 | 95 | # The four LEVELs for error suppression above are meant to cover the most common cases. 96 | # You can still select a fully custom option by using $LCOV_OPTIONS (in which case you may set $LCOV_IGNORE_ERRORS_LEVEL=off). 97 | 98 | if [[ "$LCOV_VERSION" =~ ^v1 ]]; then 99 | LCOV_OPTIONS="${LCOV_OPTIONS} --rc lcov_branch_coverage=${LCOV_BRANCH_COVERAGE}" 100 | 101 | elif [[ "$LCOV_VERSION" =~ ^v[2-9] ]]; then 102 | sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install \ 103 | libcapture-tiny-perl libdatetime-perl libjson-xs-perl || true 104 | # libcpanel-json-xs-perl 105 | LCOV_OPTIONS="${LCOV_OPTIONS} --rc branch_coverage=${LCOV_BRANCH_COVERAGE} ${lcov_ignore_errors_flag}" 106 | fi 107 | 108 | # Remove extra whitespace 109 | LCOV_OPTIONS=$(echo ${LCOV_OPTIONS} | xargs echo) 110 | 111 | rm -rf /tmp/lcov 112 | cd /tmp 113 | git clone --depth 1 -b "${LCOV_VERSION}" https://github.com/linux-test-project/lcov.git 114 | export PATH=/tmp/lcov/bin:$PATH 115 | command -v lcov 116 | lcov --version 117 | 118 | # switch back to the original source code directory 119 | cd "$BOOST_CI_SRC_FOLDER" 120 | 121 | # coverage files are in ../../b2 from this location 122 | lcov ${LCOV_OPTIONS} --gcov-tool="$GCOV" --directory "$BOOST_ROOT" --capture --output-file all.info 123 | # dump a summary on the console 124 | lcov ${LCOV_OPTIONS} --list all.info 125 | 126 | # all.info contains all the coverage info for all projects - limit to ours 127 | # first we extract the interesting headers for our project then we use that list to extract the right things 128 | for f in $(for h in include/boost/*; do echo "$h"; done | cut -f2- -d/); do echo "*/$f*"; done > /tmp/interesting 129 | echo headers that matter: 130 | cat /tmp/interesting 131 | xargs --verbose -L 999999 -a /tmp/interesting lcov ${LCOV_OPTIONS} --extract all.info "*/libs/$SELF/*" --output-file coverage.info 132 | 133 | # dump a summary on the console - helps us identify problems in pathing 134 | # note this has test file coverage in it - if you do not want to count test 135 | # files against your coverage numbers then use a .codecov.yml file which 136 | # must be checked into the default branch (it is not read or used from a 137 | # pull request) 138 | lcov ${LCOV_OPTIONS} --list coverage.info 139 | 140 | if [[ "$coverage_action" == "upload" ]] && [[ "${BOOST_CI_CODECOV_IO_UPLOAD:-}" != "skip" ]]; then 141 | # 142 | # upload to codecov.io 143 | # 144 | curl -Os https://uploader.codecov.io/latest/linux/codecov 145 | 146 | # Verify Download 147 | if command -v gpg &> /dev/null && command -v gpgv &> /dev/null; then 148 | curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import 149 | 150 | curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM 151 | curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig 152 | 153 | gpgv codecov.SHA256SUM.sig codecov.SHA256SUM 154 | shasum -a 256 -c codecov.SHA256SUM 155 | fi 156 | 157 | chmod +x codecov 158 | ./codecov --verbose --nonZero ${CODECOV_NAME:+--name "$CODECOV_NAME"} ${CODECOV_TOKEN:+--token "$CODECOV_TOKEN"} -f coverage.info -X search 159 | # end of [[ "$BOOST_CI_CODECOV_IO_UPLOAD" != "skip" ]] section 160 | fi 161 | else 162 | echo "Invalid parameter for codecov.sh: '$coverage_action'." >&2 163 | false 164 | fi 165 | -------------------------------------------------------------------------------- /ci/common_install.bat: -------------------------------------------------------------------------------- 1 | REM Generic install script for Windows 2 | REM The following CI specific environment variables need to be set: 3 | REM - BOOST_CI_TARGET_BRANCH 4 | REM - BOOST_CI_SRC_FOLDER 5 | 6 | @ECHO ON 7 | 8 | if not DEFINED SELF ( 9 | for /F "delims=" %%i in ('python %~dp0\get_libname.py') do ( 10 | set SELF=%%i 11 | call set SELF=%%SELF:/=\%% 12 | ) 13 | ) 14 | echo SELF=%SELF% 15 | if "%SELF%" == "" EXIT /B 1 16 | 17 | cd .. || EXIT /B 1 18 | REM BOOST_BRANCH is the superproject branch we check out and build against 19 | if "%BOOST_BRANCH%" == "" ( 20 | set BOOST_BRANCH=develop 21 | if "%BOOST_CI_TARGET_BRANCH%" == "master" set BOOST_BRANCH=master 22 | ) 23 | git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root || EXIT /B 1 24 | cd boost-root || EXIT /B 1 25 | git submodule update -q --init tools/boostdep || EXIT /B 1 26 | xcopy /s /e /q /I %BOOST_CI_SRC_FOLDER% libs\%SELF% || EXIT /B 1 27 | set BOOST_ROOT=%cd% 28 | 29 | REM All further variables set affect only this batch file 30 | SETLOCAL enabledelayedexpansion 31 | 32 | set DEPINST_ARGS= 33 | if not "%GIT_FETCH_JOBS%" == "" ( 34 | set DEPINST_ARGS=--git_args "--jobs %GIT_FETCH_JOBS%" 35 | ) 36 | python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools %DEPINST_ARGS% %DEPINST% %SELF:\=/% || EXIT /B 1 37 | 38 | if defined ADDPATH (set "PATH=%ADDPATH%%PATH%") 39 | 40 | @ECHO OFF 41 | if "%B2_TOOLSET%" == "gcc" ( 42 | set cxx_exe="g++.exe" 43 | )else if "%B2_TOOLSET%" == "clang-win" ( 44 | set cxx_exe="clang-cl.exe" 45 | )else ( 46 | set cxx_exe="" 47 | ) 48 | if NOT %cxx_exe% == "" ( 49 | call :GetPath %cxx_exe%,cxx_path 50 | call :GetVersion %cxx_exe%,cxx_version 51 | echo Compiler location: !cxx_path! 52 | echo Compiler version: !cxx_version! 53 | ) 54 | @ECHO ON 55 | 56 | REM Bootstrap is not expecting B2_CXXFLAGS content so we zero it out for the bootstrap only 57 | SET B2_CXXFLAGS= 58 | cmd /c bootstrap 59 | IF NOT %ERRORLEVEL% == 0 ( 60 | type bootstrap.log 61 | EXIT /B 1 62 | ) 63 | 64 | b2 -d0 headers 65 | ENDLOCAL 66 | 67 | if DEFINED B2_CI_VERSION ( 68 | REM Go back to lib folder to allow ci\build.bat to work 69 | cd libs\%SELF% 70 | ) 71 | 72 | EXIT /B %ERRORLEVEL% 73 | 74 | :GetPath 75 | for %%i in (%~1) do set %~2=%%~$PATH:i 76 | EXIT /B 0 77 | 78 | :GetVersion 79 | for /F "delims=" %%i in ('%~1 --version ^2^>^&^1') do set %~2=%%i & goto :done 80 | :done 81 | EXIT /B 0 82 | -------------------------------------------------------------------------------- /ci/common_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Copyright 2019 Mateusz Loskot 5 | # Copyright 2020-2024 Alexander Grund 6 | # Distributed under the Boost Software License, Version 1.0. 7 | # (See accompanying file LICENSE_1_0.txt or copy at 8 | # http://www.boost.org/LICENSE_1_0.txt) 9 | # 10 | # Executes the install phase 11 | # 12 | # If your repository has additional directories beyond 13 | # "example", "examples", "tools", and "test" then you 14 | # can add them in the environment variable DEPINST. 15 | # i.e. - DEPINST="--include dirname1 --include dirname2" 16 | # 17 | # CI specific environment variables need to be set: 18 | # - BOOST_CI_TARGET_BRANCH 19 | # - BOOST_CI_SRC_FOLDER 20 | # - GIT_FETCH_JOBS to fetch in parallel 21 | # 22 | # Will set: 23 | # - BOOST_BRANCH 24 | # - BOOST_ROOT 25 | # - SELF 26 | 27 | set -ex 28 | 29 | CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" 30 | 31 | function print_on_gha { 32 | { set +x; } &> /dev/null 33 | [[ "${GITHUB_ACTIONS:-false}" != "true" ]] || echo "$@" 34 | set -x 35 | } 36 | 37 | # Setup ccache 38 | if [ "${B2_USE_CCACHE:-}" == "1" ]; then 39 | if ! "$CI_DIR"/setup_ccache.sh 2>&1; then 40 | { set +x; } &> /dev/null 41 | echo 42 | printf '=%.0s' {1..120} 43 | echo 44 | echo "Failed to install & setup ccache!" 45 | echo "Will NOT use CCache for building." 46 | printf '=%.0s' {1..120} 47 | echo 48 | echo 49 | B2_USE_CCACHE=0 50 | print_on_gha "::error title=CCache::CCache disabled due to an error!" 51 | set -x 52 | fi 53 | fi 54 | 55 | print_on_gha "::group::Setup B2 variables" 56 | . "$CI_DIR"/enforce.sh 2>&1 57 | print_on_gha "::endgroup::" 58 | 59 | print_on_gha "::group::Checkout and setup Boost build tree" 60 | pythonexecutable=$(get_python_executable) 61 | 62 | if [ -z "${SELF:-}" ]; then 63 | export SELF=$($pythonexecutable "$CI_DIR/get_libname.py") 64 | fi 65 | 66 | # Handle also /refs/head/master 67 | if [ "$BOOST_CI_TARGET_BRANCH" == "master" ] || [[ "$BOOST_CI_TARGET_BRANCH" == */master ]]; then 68 | export BOOST_BRANCH="master" 69 | else 70 | export BOOST_BRANCH="develop" 71 | fi 72 | 73 | cd .. 74 | 75 | if [ ! -d boost-root ]; then 76 | git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root 77 | cd boost-root 78 | else 79 | cd boost-root 80 | git checkout $BOOST_BRANCH 81 | git pull --no-recurse-submodules 82 | git submodule update 83 | fi 84 | 85 | git submodule update -q --init tools/boostdep 86 | if [ -d "libs/$SELF" ]; then 87 | rm -rf "libs/$SELF" 88 | fi 89 | mkdir -p "libs/$SELF" 90 | cp -r "$BOOST_CI_SRC_FOLDER"/* "libs/$SELF" 91 | 92 | export BOOST_ROOT="$(pwd)" 93 | export PATH="$(pwd):$PATH" 94 | 95 | git --version 96 | DEPINST_ARGS=() 97 | if [[ -n "$GIT_FETCH_JOBS" ]]; then 98 | DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") 99 | fi 100 | 101 | # shellcheck disable=SC2086 102 | $pythonexecutable tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools "${DEPINST_ARGS[@]}" $DEPINST "$SELF" 103 | print_on_gha "::endgroup::" 104 | 105 | print_on_gha "::group::Setup B2" 106 | # Deduce B2_TOOLSET if unset from B2_COMPILER 107 | if [ -z "${B2_TOOLSET:-}" ] && [ -n "${B2_COMPILER:-}" ]; then 108 | if [[ "$B2_COMPILER" =~ clang ]]; then 109 | export B2_TOOLSET=clang 110 | elif [[ "$B2_COMPILER" =~ gcc|g\+\+ ]]; then 111 | export B2_TOOLSET=gcc 112 | else 113 | echo "Unknown compiler: '$B2_COMPILER'. Need either clang or gcc/g++" >&2 114 | false 115 | fi 116 | fi 117 | 118 | if [[ "${B2_TOOLSET:-}" == clang* ]]; then 119 | # If clang was installed from LLVM APT it will not have a /usr/bin/clang++ 120 | # so we need to add the correctly versioned llvm bin path to the PATH 121 | if [ -f "/etc/debian_version" ]; then 122 | ver="" 123 | if [[ "$B2_TOOLSET" == clang-* ]]; then 124 | ver="${B2_TOOLSET#*-}" 125 | elif [[ "$B2_COMPILER" == clang-* ]] || [[ "$B2_COMPILER" == clang++-* ]]; then 126 | # Don't change path if we do find the versioned compiler 127 | if ! command -v "$B2_COMPILER"; then 128 | ver="${B2_COMPILER#*-}" 129 | fi 130 | else 131 | echo "Can't get clang version from B2_TOOLSET or B2_COMPILER. Skipping PATH setting." >&2 132 | fi 133 | if [[ -n "$ver" ]]; then 134 | export PATH="/usr/lib/llvm-${ver}/bin:$PATH" 135 | ls -ls "/usr/lib/llvm-${ver}/bin" || true 136 | hash -r || true 137 | fi 138 | elif [ -n "${XCODE_APP:-}" ]; then 139 | sudo xcode-select -switch "${XCODE_APP}" 140 | fi 141 | command -v clang || true 142 | command -v clang++ || true 143 | 144 | # Additionally, if B2_TOOLSET is clang variant but CXX is set to g++ 145 | # (it is on Linux images) then boost build silently ignores B2_TOOLSET and 146 | # uses CXX instead 147 | if [[ -n "$CXX" ]] && [[ "$CXX" != clang* ]]; then 148 | echo "CXX is set to $CXX in this environment which would override" 149 | echo "the setting of B2_TOOLSET=clang, therefore we clear CXX here." 150 | export CXX= 151 | fi 152 | fi 153 | 154 | # Set up user-config to actually use B2_COMPILER if set 155 | userConfigPath=$HOME/user-config.jam 156 | if [ -n "${B2_COMPILER:-}" ]; then 157 | echo '$B2_COMPILER set. Configuring user-config' 158 | 159 | # Get C++ compiler 160 | if [[ "$B2_COMPILER" == clang* ]] && [[ "$B2_COMPILER" != clang++* ]]; then 161 | CXX="${B2_COMPILER/clang/clang++}" 162 | else 163 | CXX="${B2_COMPILER/gcc/g++}" 164 | fi 165 | 166 | 167 | if ! command -v "$CXX"; then 168 | echo "Error: Compiler $CXX was not installed properly" 169 | exit 1 170 | fi 171 | 172 | { set +x; } &> /dev/null 173 | echo "Compiler location: $(command -v "$CXX")" 174 | if [[ "$CXX" == *"clang++"* ]] && [ -z "$GCC_TOOLCHAIN_ROOT" ]; then 175 | # Show also information on selected GCC lib 176 | version=$($CXX -v 2>&1 || $CXX --version) 177 | else 178 | version=$($CXX --version) 179 | fi 180 | echo "Compiler version: $version" 181 | 182 | if [ "$B2_USE_CCACHE" == "1" ]; then 183 | CXX="ccache $CXX" 184 | fi 185 | export CXX 186 | 187 | echo -n "using $B2_TOOLSET : : $CXX" > "$userConfigPath" 188 | # On MSYS/Cygwin B2 needs the .exe suffix to find the compiler 189 | if [[ $OSTYPE == "msys" || $OSTYPE == "cygwin" ]]; then 190 | echo -n ".exe" >> "$userConfigPath" 191 | fi 192 | if [ -n "$GCC_TOOLCHAIN_ROOT" ]; then 193 | echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> "$userConfigPath" 194 | fi 195 | echo " ;" >> "$userConfigPath" 196 | 197 | echo "Final user-config ($userConfigPath):" 198 | cat "$userConfigPath" 199 | 200 | set -x 201 | elif [ -f "$userConfigPath" ]; then 202 | { set +x; } &> /dev/null 203 | echo "Existing user-config ($userConfigPath):" 204 | cat "$userConfigPath" 205 | set -x 206 | else 207 | echo "$userConfigPath does not exist. Will use defaults" 208 | fi 209 | 210 | function show_bootstrap_log 211 | { 212 | cat bootstrap.log 213 | } 214 | print_on_gha "::endgroup::" 215 | 216 | if [[ "${B2_DONT_BOOTSTRAP:0}" != "1" ]]; then 217 | print_on_gha "::group::Bootstrap B2" 218 | trap show_bootstrap_log ERR 219 | # Check if b2 already exists. This would (only) happen in a caching scenario. The purpose of caching is to save time by not recompiling everything. 220 | # The user may clear cache or delete b2 beforehand if they wish to rebuild. 221 | if [ ! -f b2 ] || ! b2_version_output=$(./b2 --version); then 222 | ${B2_WRAPPER:-} ./bootstrap.sh 223 | else 224 | # b2 expects versions to match 225 | engineversion=$(echo "$b2_version_output" | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1) 226 | enginemajorversion=$(echo "${engineversion}" | cut -d'.' -f1) 227 | engineminorversion=$(echo "${engineversion}" | cut -d'.' -f2) 228 | coremajorversion=$(grep VERSION_MAJOR tools/build/src/engine/patchlevel.h | tr -s ' ' | cut -d' ' -f 3) 229 | coreminorversion=$(grep VERSION_MINOR tools/build/src/engine/patchlevel.h | tr -s ' ' | cut -d' ' -f 3) 230 | if [[ "${enginemajorversion}" == "${coremajorversion}" ]] && [[ "${engineminorversion}" == "${coreminorversion}" ]]; then 231 | echo "b2 already exists and has the same version number" 232 | else 233 | ${B2_WRAPPER:-} ./bootstrap.sh 234 | fi 235 | fi 236 | trap - ERR 237 | ${B2_WRAPPER:-} ./b2 -d0 headers 238 | print_on_gha "::endgroup::" 239 | fi 240 | -------------------------------------------------------------------------------- /ci/coverity.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Copyright 2022 - 2024 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Bash script to run in travis to perform a Coverity Scan build 10 | # To skip the coverity integration download (which is huge) if 11 | # you already have it from a previous run, add --skipdownload 12 | # 13 | 14 | # 15 | # Environment Variables 16 | # 17 | # COVERITY_SCAN_NOTIFICATION_EMAIL - email address to notify 18 | # COVERITY_SCAN_TOKEN - the Coverity Scan token (should be secure) 19 | # BOOST_REPO - repo this is run on, e.g. boostorg/foo 20 | # BOOST_BRANCH - target branch of PR or current branch 21 | # SELF - the boost libs directory name 22 | 23 | set -eux 24 | 25 | CI_DIR="$(dirname "${BASH_SOURCE[0]}")" 26 | 27 | pushd /tmp 28 | if [[ "${1:-}" != "--skipdownload" ]]; then 29 | rm -rf coverity_tool.tgz cov-analysis* 30 | curl -L -d "token=$COVERITY_SCAN_TOKEN&project=$BOOST_REPO" -X POST https://scan.coverity.com/download/cxx/linux64 -o coverity_tool.tgz 31 | tar xzf coverity_tool.tgz 32 | fi 33 | COVBIN=$(echo "$(pwd)"/cov-analysis*/bin) 34 | export PATH=$COVBIN:$PATH 35 | popd 36 | 37 | "$CI_DIR"/build.sh clean 38 | rm -rf cov-int/ 39 | cov-build --dir cov-int "$CI_DIR"/build.sh 40 | tail -50 cov-int/build-log.txt 41 | tar cJf cov-int.tar.xz cov-int/ 42 | curl --form token="$COVERITY_SCAN_TOKEN" \ 43 | --form email="$COVERITY_SCAN_NOTIFICATION_EMAIL" \ 44 | --form file=@cov-int.tar.xz \ 45 | --form version="$BOOST_BRANCH" \ 46 | --form description="$BOOST_REPO" \ 47 | https://scan.coverity.com/builds?project="$BOOST_REPO" 48 | -------------------------------------------------------------------------------- /ci/drone/freebsd-cxx-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Running on FreeBSD" 4 | -------------------------------------------------------------------------------- /ci/drone/functions.star: -------------------------------------------------------------------------------- 1 | # Use, modification, and distribution are 2 | # subject to the Boost Software License, Version 1.0. (See accompanying 3 | # file LICENSE.txt) 4 | # 5 | # Copyright Rene Rivera 2020. 6 | 7 | # For Drone CI we use the Starlark scripting language to reduce duplication. 8 | # As the yaml syntax for Drone CI is rather limited. 9 | 10 | # Downloads the script inside the directory @boostCI_dir from the master branch of BoostCI into @boostCI_dir 11 | # Does NOT download if the file already exists, e.g. when testing BoostCI or when there is a customized file 12 | # Then makes the script executable 13 | def download_script_from_boostCI(filename, boostCI_dir): 14 | url = '$BOOST_CI_URL/%s/%s' % (boostCI_dir, filename) 15 | target_path = '%s/%s' % (boostCI_dir, filename) 16 | # Note that this always runs the `chmod` even when not downloading 17 | return '[ -e "{1}" ] || curl -s -S --retry 10 --create-dirs -L "{0}" -o "{1}" && chmod 755 {1}'.format(url, target_path) 18 | 19 | # Same as above but using powershell 20 | def download_script_from_boostCI_pwsh(filename, boostCI_dir): 21 | url = '$env:BOOST_CI_URL/%s/%s' % (boostCI_dir, filename) 22 | target_path = '%s/%s' % (boostCI_dir, filename) 23 | return ' '.join([ 24 | 'if(![System.IO.File]::Exists("{1}")){{', 25 | '$null = md "%s" -ea 0;' % boostCI_dir, 26 | 'try{{', 27 | # Use pwsh.exe to invoke a potentially newer PowerShell 28 | 'pwsh.exe -Command Invoke-WebRequest "{0}" -Outfile "{1}" -MaximumRetryCount 10 -RetryIntervalSec 15', 29 | '}}catch{{', 30 | 'Invoke-WebRequest "{0}" -Outfile "{1}";', 31 | '}}', 32 | '}}', 33 | ]).format(url, target_path) 34 | 35 | # Common steps for unix systems 36 | # Takes the install script (inside the Boost.CI "ci/drone" folder) and the build script (relative to the root .drone folder) 37 | def unix_common(install_script, buildscript_to_run): 38 | if not buildscript_to_run.endswith('.sh'): 39 | buildscript_to_run += '.sh' 40 | return [ 41 | "echo '============> SETUP'", 42 | "uname -a", 43 | "echo $DRONE_STAGE_MACHINE", 44 | "export PATH=/usr/local/bin:$PATH", 45 | # Install script 46 | download_script_from_boostCI(install_script, 'ci/drone'), 47 | # Chosen build script inside .drone 48 | download_script_from_boostCI(buildscript_to_run, '.drone'), 49 | "echo '============> PACKAGES'", 50 | "ci/drone/" + install_script, 51 | "echo '============> INSTALL AND TEST'", 52 | ".drone/" + buildscript_to_run, 53 | ] 54 | 55 | # Add the value into the env[key] if it is not None 56 | def add_if_set(env, key, value): 57 | if value != None: 58 | env[key] = value 59 | 60 | # Generate pipeline for Linux platform compilers. 61 | def linux_cxx( 62 | # Unique name for this job 63 | name, 64 | # If set: Values for corresponding env variables, $CXX, $CXXFLAGS, ... 65 | cxx=None, cxxflags=None, packages=None, sources=None, llvm_os=None, llvm_ver=None, 66 | # Worker image and arch 67 | arch="amd64", image="cppalliance/ubuntu16.04:1", 68 | # Script to call for the build step and value of $DRONE_JOB_BUILDTYPE 69 | buildtype="boost", buildscript="", 70 | # Additional env variables, environment overwrites values in globalenv 71 | environment={}, globalenv={}, 72 | triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, node={}, 73 | # Run with additional privileges (e.g for ASAN) 74 | privileged=False): 75 | 76 | job_env = { 77 | "TRAVIS_BUILD_DIR": "/drone/src", 78 | "TRAVIS_OS_NAME": "linux", 79 | "DRONE_JOB_BUILDTYPE": buildtype, 80 | "BOOST_CI_URL": "https://github.com/boostorg/boost-ci/raw/master", 81 | } 82 | 83 | add_if_set(job_env, "CXX", cxx) 84 | add_if_set(job_env, "CXXFLAGS", cxxflags) 85 | add_if_set(job_env, "PACKAGES", packages) 86 | add_if_set(job_env, "SOURCES", sources) 87 | add_if_set(job_env, "LLVM_OS", llvm_os) 88 | add_if_set(job_env, "LLVM_VER", llvm_ver) 89 | job_env.update(globalenv) 90 | job_env.update(environment) 91 | 92 | if not buildscript: 93 | buildscript = buildtype 94 | 95 | steps=[ 96 | { 97 | "name": "Everything", 98 | "image": image, 99 | "pull": "if-not-exists", 100 | "privileged" : privileged, 101 | "environment": job_env, 102 | # Installed in Docker: 103 | # - ppa:git-core/ppa 104 | # - tzdata sudo software-properties-common wget curl apt-transport-https git make cmake apt-file sudo unzip libssl-dev build-essential autotools-dev autoconf libc++-helpers automake g++ git 105 | "commands": unix_common("linux-cxx-install.sh", buildscript) 106 | } 107 | ] 108 | 109 | imagecachename=image.replace('/', '-').replace(':','-') 110 | if "drone_cache_mount" in job_env: 111 | mountpoints=[x.strip() for x in job_env["drone_cache_mount"].split(',')] 112 | pre_step={ 113 | "name": "restore-cache", 114 | "image": "meltwater/drone-cache", 115 | "environment": { 116 | "AWS_ACCESS_KEY_ID": 117 | { "from_secret": "drone_cache_aws_access_key_id"}, 118 | "AWS_SECRET_ACCESS_KEY": 119 | { "from_secret": "drone_cache_aws_secret_access_key"} 120 | }, 121 | "pull": "if-not-exists", 122 | "settings": { 123 | "restore": "true", 124 | "cache_key": "{{ .Repo.Namespace }}-{{ .Repo.Name }}-{{ .Commit.Branch }}-{{ arch }}-" + imagecachename, 125 | "bucket": "cppalliance-drone-cache", 126 | "region": "us-east-2", 127 | "mount": mountpoints 128 | } 129 | } 130 | steps=[ pre_step ] + steps 131 | 132 | if ("drone_cache_mount" in job_env) and ("drone_cache_rebuild" in job_env and job_env['drone_cache_rebuild'] != "false" and job_env['drone_cache_rebuild'] != False): 133 | mountpoints=[x.strip() for x in job_env["drone_cache_mount"].split(',')] 134 | post_step={ 135 | "name": "rebuild-cache", 136 | "image": "meltwater/drone-cache", 137 | "environment": { 138 | "AWS_ACCESS_KEY_ID": 139 | { "from_secret": "drone_cache_aws_access_key_id"}, 140 | "AWS_SECRET_ACCESS_KEY": 141 | { "from_secret": "drone_cache_aws_secret_access_key"} 142 | }, 143 | "pull": "if-not-exists", 144 | "settings": { 145 | "rebuild": "true", 146 | "cache_key": "{{ .Repo.Namespace }}-{{ .Repo.Name }}-{{ .Commit.Branch }}-{{ arch }}-" + imagecachename, 147 | "bucket": "cppalliance-drone-cache", 148 | "region": "us-east-2", 149 | "mount": mountpoints 150 | } 151 | } 152 | steps=steps + [ post_step ] 153 | 154 | return { 155 | "name": "Linux %s" % name, 156 | "kind": "pipeline", 157 | "type": "docker", 158 | "trigger": triggers, 159 | "platform": { 160 | "os": "linux", 161 | "arch": arch 162 | }, 163 | "clone": { 164 | "retries": 5 165 | }, 166 | "node": node, 167 | "steps": steps 168 | } 169 | 170 | def windows_cxx( 171 | name, 172 | cxx="g++", cxxflags=None, packages=None, sources=None, llvm_os=None, llvm_ver=None, 173 | arch="amd64", image="cppalliance/dronevs2019", 174 | buildtype="boost", buildscript="", 175 | environment={}, globalenv={}, 176 | triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, node={}, 177 | privileged=False): 178 | 179 | job_env = { 180 | "TRAVIS_OS_NAME": "windows", 181 | "CXX": cxx, 182 | "DRONE_JOB_BUILDTYPE": buildtype, 183 | "BOOST_CI_URL": "https://github.com/boostorg/boost-ci/raw/master", 184 | } 185 | 186 | add_if_set(job_env, "CXXFLAGS", cxxflags) 187 | add_if_set(job_env, "PACKAGES", packages) 188 | add_if_set(job_env, "SOURCES", sources) 189 | add_if_set(job_env, "LLVM_OS", llvm_os) 190 | add_if_set(job_env, "LLVM_VER", llvm_ver) 191 | job_env.update(globalenv) 192 | job_env.update(environment) 193 | 194 | if not buildscript: 195 | buildscript = buildtype 196 | buildscript_to_run = buildscript + '.bat' 197 | 198 | return { 199 | "name": "Windows %s" % name, 200 | "kind": "pipeline", 201 | "type": "docker", 202 | "trigger": triggers, 203 | "platform": { 204 | "os": "windows", 205 | "arch": arch 206 | }, 207 | "node": node, 208 | "steps": [ 209 | { 210 | "name": "Everything", 211 | "image": image, 212 | "pull": "if-not-exists", 213 | "privileged": privileged, 214 | "environment": job_env, 215 | "commands": [ 216 | "echo '============> SETUP'", 217 | "echo $env:DRONE_STAGE_MACHINE", 218 | # Install script 219 | download_script_from_boostCI_pwsh('windows-cxx-install.bat', 'ci/drone'), 220 | # Chosen build script inside .drone 221 | download_script_from_boostCI_pwsh(buildscript_to_run, '.drone'), 222 | "echo '============> PACKAGES'", 223 | "ci/drone/windows-cxx-install.bat", 224 | "echo '============> INSTALL AND COMPILE'", 225 | "cmd /c .drone\\\\%s `& exit" % buildscript_to_run, 226 | ] 227 | } 228 | ] 229 | } 230 | 231 | def osx_cxx( 232 | name, 233 | cxx=None, cxxflags=None, packages=None, sources=None, llvm_os=None, llvm_ver=None, 234 | arch="amd64", osx_version=None, xcode_version=None, 235 | buildtype="boost", buildscript="", 236 | environment={}, globalenv={}, 237 | triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, node={}, 238 | privileged=False): 239 | 240 | job_env = { 241 | "TRAVIS_OS_NAME": "osx", 242 | "CXX": cxx, 243 | "DRONE_JOB_BUILDTYPE": buildtype, 244 | "BOOST_CI_URL": "https://github.com/boostorg/boost-ci/raw/master", 245 | } 246 | 247 | add_if_set(job_env, "CXX", cxx) 248 | add_if_set(job_env, "CXXFLAGS", cxxflags) 249 | add_if_set(job_env, "PACKAGES", packages) 250 | add_if_set(job_env, "SOURCES", sources) 251 | add_if_set(job_env, "LLVM_OS", llvm_os) 252 | add_if_set(job_env, "LLVM_VER", llvm_ver) 253 | job_env.update(globalenv) 254 | job_env.update(environment) 255 | 256 | if not buildscript: 257 | buildscript = buildtype 258 | 259 | if xcode_version: 260 | job_env["DEVELOPER_DIR"] = "/Applications/Xcode-" + xcode_version + ".app/Contents/Developer" 261 | if not osx_version: 262 | if xcode_version[0:2] in [ "16", "15"]: 263 | osx_version="sonoma" 264 | arch="arm64" 265 | elif xcode_version[0:4] in [ "14.2", "14.3"]: 266 | osx_version="sonoma" 267 | arch="arm64" 268 | elif xcode_version[0:2] in [ "14", "13"]: 269 | osx_version="monterey" 270 | arch="arm64" 271 | elif xcode_version[0:4] in [ "12.5"]: 272 | osx_version="monterey" 273 | arch="arm64" 274 | elif xcode_version[0:2] in [ "12","11","10"]: 275 | osx_version="catalina" 276 | elif xcode_version[0:1] in [ "9","8","7","6"]: 277 | osx_version="highsierra" 278 | elif not osx_version: 279 | osx_version="catalina" 280 | 281 | nodetmp={} 282 | nodetmp.update(node) 283 | nodetmp.update({"os": osx_version}) 284 | 285 | return { 286 | "name": "OSX %s" % name, 287 | "kind": "pipeline", 288 | "type": "exec", 289 | "trigger": triggers, 290 | "platform": { 291 | "os": "darwin", 292 | "arch": arch 293 | }, 294 | "node": nodetmp, 295 | "steps": [ 296 | { 297 | "name": "Everything", 298 | "privileged" : privileged, 299 | "environment": job_env, 300 | "commands": unix_common("osx-cxx-install.sh", buildscript) 301 | } 302 | ] 303 | } 304 | 305 | def freebsd_cxx( 306 | name, 307 | cxx=None, cxxflags=None, packages=None, sources=None, llvm_os=None, llvm_ver=None, 308 | arch="amd64", freebsd_version="13.1", 309 | buildtype="boost", buildscript="", 310 | environment={}, globalenv={}, 311 | triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, node={}, 312 | privileged=False): 313 | 314 | job_env = { 315 | "TRAVIS_OS_NAME": "freebsd", 316 | "DRONE_JOB_BUILDTYPE": buildtype, 317 | "BOOST_CI_URL": "https://github.com/boostorg/boost-ci/raw/master", 318 | } 319 | 320 | add_if_set(job_env, "CXX", cxx) 321 | add_if_set(job_env, "CXXFLAGS", cxxflags) 322 | add_if_set(job_env, "PACKAGES", packages) 323 | add_if_set(job_env, "SOURCES", sources) 324 | add_if_set(job_env, "LLVM_OS", llvm_os) 325 | add_if_set(job_env, "LLVM_VER", llvm_ver) 326 | job_env.update(globalenv) 327 | job_env.update(environment) 328 | 329 | if not buildscript: 330 | buildscript = buildtype 331 | 332 | nodetmp={} 333 | nodetmp.update(node) 334 | nodetmp.update({"os": "freebsd" + freebsd_version}) 335 | 336 | return { 337 | "name": "FreeBSD %s" % name, 338 | "kind": "pipeline", 339 | "type": "exec", 340 | "trigger": triggers, 341 | "platform": { 342 | "os": "freebsd", 343 | "arch": arch 344 | }, 345 | "node": nodetmp, 346 | "steps": [ 347 | { 348 | "name": "Everything", 349 | "privileged" : privileged, 350 | "environment": job_env, 351 | "commands": unix_common("freebsd-cxx-install.sh", buildscript) 352 | } 353 | ] 354 | } 355 | 356 | # The functions job and job_impl were added in 2023-01 to provide a simplified job syntax. 357 | # Instead of calling linux_cxx() directly, run job() instead. 358 | # 359 | # Define a job, i.e. a single entry in the build matrix 360 | # It takes values for OS, compiler and C++-standard and optional arguments. 361 | # A value of `None` means "unset" as opposed to an empty string which for environment variables will set them to empty. 362 | def job_impl( 363 | # Required: 364 | os, compiler, cxxstd, 365 | # Name of the job, a reasonable default will be generated based on the other arguments 366 | name=None, 367 | # `image` will be deduced from `os`, `arch` and `compiler` when not set 368 | arch='amd64', image=None, 369 | # Those correspond to the B2_* variables and hence arguments to b2 (with the default build.sh) 370 | variant=None, address_model=None, stdlib=None, defines=None, cxxflags=None, linkflags=None, testflags=None, 371 | # Sanitizers. Using any will set the variant to 'debug' and default `defines` to 'BOOST_NO_STRESS_TEST=1' 372 | valgrind=False, asan=False, ubsan=False, tsan=False, 373 | # Packages to install, will default to the compiler and the value of `install` (for additional packages) 374 | packages=None, install='', 375 | # If True then the LLVM repo corresponding to the Ubuntu image will be added 376 | add_llvm=False, 377 | # .drone/*.sh script to run 378 | buildscript='drone', 379 | # build type env variable (defaults to 'boost' or 'valgrind', sets the token when set to 'codecov') 380 | buildtype=None, 381 | # job specific environment 382 | env={}, 383 | # Any other keyword arguments are passed directly to the *_cxx-function 384 | **kwargs): 385 | 386 | if not name: 387 | deduced_name = True 388 | name = compiler.replace('-', ' ') 389 | if address_model: 390 | name += ' x' + address_model 391 | if stdlib: 392 | name += ' ' + stdlib 393 | if cxxstd: 394 | name += ' C++' + cxxstd 395 | if arch != 'amd64': 396 | name = '%s: %s' % (arch.upper(), name) 397 | else: 398 | deduced_name = False 399 | 400 | cxx = compiler.replace('gcc-', 'g++-') 401 | if packages == None: 402 | packages = cxx 403 | if install: 404 | packages += ' ' + install 405 | 406 | env['B2_TOOLSET' if os == 'windows' else 'B2_COMPILER'] = compiler 407 | if cxxstd != None: 408 | env['B2_CXXSTD'] = cxxstd 409 | 410 | if valgrind: 411 | if buildtype == None: 412 | buildtype = 'valgrind' 413 | if testflags == None: 414 | testflags = 'testing.launcher=valgrind' 415 | env.setdefault('VALGRIND_OPTS', '--error-exitcode=1') 416 | 417 | if asan or tsan: 418 | kwargs['privileged'] = True 419 | # Set env var if privileged is set by any means 420 | if kwargs.get('privileged'): 421 | env['DRONE_EXTRA_PRIVILEGED'] = 'True' 422 | 423 | if asan: 424 | env['B2_ASAN'] = '1' 425 | if ubsan: 426 | env['B2_UBSAN'] = '1' 427 | if tsan: 428 | env['B2_TSAN'] = '1' 429 | 430 | # Set defaults for all sanitizers 431 | if valgrind or asan or ubsan: 432 | if variant == None: 433 | variant = 'debug' 434 | if defines == None: 435 | defines = 'BOOST_NO_STRESS_TEST=1' 436 | 437 | if variant != None: 438 | env['B2_VARIANT'] = variant 439 | if address_model != None: 440 | env['B2_ADDRESS_MODEL'] = address_model 441 | if stdlib != None: 442 | env['B2_STDLIB'] = stdlib 443 | if defines != None: 444 | env['B2_DEFINES'] = defines 445 | if cxxflags != None: 446 | env['B2_CXXFLAGS'] = cxxflags 447 | if linkflags != None: 448 | env['B2_LINKFLAGS'] = linkflags 449 | if testflags != None: 450 | env['B2_TESTFLAGS'] = testflags 451 | 452 | if buildtype == None: 453 | buildtype = 'boost' 454 | elif buildtype == 'codecov': 455 | env.setdefault('CODECOV_TOKEN', {'from_secret': 'codecov_token'}) 456 | elif buildtype == 'coverity': 457 | env.setdefault('COVERITY_SCAN_NOTIFICATION_EMAIL', {'from_secret': 'coverity_scan_email'}) 458 | env.setdefault('COVERITY_SCAN_TOKEN', {'from_secret': 'coverity_scan_token'}) 459 | 460 | # Put common args of all *_cxx calls not modified below into kwargs to avoid duplicating them 461 | kwargs['arch'] = arch 462 | kwargs['buildtype'] = buildtype 463 | kwargs['buildscript'] = buildscript 464 | kwargs['environment'] = env 465 | 466 | if os.startswith('ubuntu'): 467 | if not image: 468 | image = 'cppalliance/droneubuntu%s:1' % os.split('-')[1].replace('.', '') 469 | if arch != 'amd64': 470 | image = image[0:-1] + 'multiarch' 471 | if add_llvm: 472 | names = { 473 | '1604': 'xenial', 474 | '1804': 'bionic', 475 | '2004': 'focal', 476 | '2204': 'jammy', 477 | } 478 | kwargs['llvm_os'] = names[image.split('ubuntu')[-1].split(':')[0]] # get part between 'ubuntu' and ':' 479 | kwargs['llvm_ver'] = compiler.split('-')[1] 480 | 481 | return linux_cxx(name, cxx, packages=packages, image=image, **kwargs) 482 | elif os.startswith('freebsd'): 483 | # Deduce version if os is `freebsd-` 484 | parts = os.split('freebsd-') 485 | if len(parts) == 2: 486 | version = kwargs.setdefault('freebsd_version', parts[1]) 487 | if deduced_name: 488 | name = '%s %s' % (kwargs['freebsd_version'], name) 489 | return freebsd_cxx(name, cxx, **kwargs) 490 | elif os.startswith('osx'): 491 | # If format is `osx-xcode-` deduce xcode_version, else assume it is passed directly 492 | parts = os.split('osx-xcode-') 493 | if len(parts) == 2: 494 | version = kwargs.setdefault('xcode_version', parts[1]) 495 | if deduced_name: 496 | name = 'XCode %s: %s' % (version, name) 497 | return osx_cxx(name, cxx, **kwargs) 498 | elif os == 'windows': 499 | if not image: 500 | names = { 501 | 'msvc-14.0': 'dronevs2015', 502 | 'msvc-14.1': 'dronevs2017', 503 | 'msvc-14.2': 'dronevs2019:2', 504 | 'msvc-14.3': 'dronevs2022:1', 505 | } 506 | image = 'cppalliance/' + names[compiler] 507 | kwargs.setdefault('cxx', '') 508 | return windows_cxx(name, image=image, **kwargs) 509 | else: 510 | fail('Unknown OS:', os) 511 | -------------------------------------------------------------------------------- /ci/drone/linux-cxx-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2020-2022 Sam Darwin 4 | # Copyright 2021-2024 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | set -e 10 | 11 | function add_repository { 12 | name="$1" 13 | echo -e "\tAdding repository $name" 14 | for _i in {1..3}; do 15 | if sudo -E apt-add-repository -y "$name"; then 16 | return 0; 17 | fi 18 | sleep 10 19 | done 20 | return 1 # Failed 21 | } 22 | 23 | function add_repository_toolchain { 24 | name="$1" 25 | echo -e "\tAdding repository $name" 26 | # an alternative method, if apt-add-repository seems to be unresponsive 27 | VERSION_CODENAME=$(grep -ioP '^VERSION_CODENAME=\K.+' /etc/os-release || true) 28 | if [[ -z $VERSION_CODENAME ]]; then 29 | if grep -i trusty /etc/os-release; then 30 | VERSION_CODENAME=trusty 31 | elif grep -i precise /etc/os-release; then 32 | VERSION_CODENAME=precise 33 | fi 34 | fi 35 | echo "VERSION_CODENAME is ${VERSION_CODENAME}" 36 | { 37 | echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${VERSION_CODENAME} main" 38 | echo "# deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${VERSION_CODENAME} main" 39 | } > "/etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-${VERSION_CODENAME}.list" 40 | curl -sSL --retry "${NET_RETRY_COUNT:-5}" 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/toolchain-r.gpg 41 | } 42 | 43 | echo ">>>>> APT: REPOSITORIES..." 44 | 45 | if [ "$UBUNTU_TOOLCHAIN_DISABLE" != "true" ]; then 46 | # add_repository "ppa:ubuntu-toolchain-r/test" 47 | add_repository_toolchain "ppa:ubuntu-toolchain-r/test" 48 | else 49 | echo "UBUNTU_TOOLCHAIN_DISABLE is 'true'. Not installing ppa:ubuntu-toolchain-r/test" 50 | fi 51 | 52 | if [ -n "${LLVM_OS}" ]; then 53 | echo ">>>>> APT: INSTALL LLVM repo" 54 | curl -sSL --retry 5 https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg 55 | if [ -n "${LLVM_VER}" ]; then 56 | llvm_toolchain="llvm-toolchain-${LLVM_OS}-${LLVM_VER}" 57 | else 58 | # Snapshot (i.e. trunk) build 59 | llvm_toolchain="llvm-toolchain-${LLVM_OS}" 60 | fi 61 | add_repository "deb https://apt.llvm.org/${LLVM_OS}/ ${llvm_toolchain} main" 62 | fi 63 | 64 | if [ -n "${SOURCES}" ]; then 65 | echo ">>>>> APT: INSTALL PPAs from \$SOURCES..." 66 | for SOURCE in $SOURCES; do 67 | add_repository "ppa:$SOURCE" 68 | done 69 | fi 70 | 71 | echo ">>>>> APT: UPDATE..." 72 | sudo -E apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" update 73 | 74 | echo ">>>>> APT: INSTALL ${PACKAGES}..." 75 | # shellcheck disable=SC2086 76 | sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ${PACKAGES} 77 | -------------------------------------------------------------------------------- /ci/drone/osx-cxx-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "sw_vers" 4 | sw_vers 5 | -------------------------------------------------------------------------------- /ci/drone/windows-cxx-install.bat: -------------------------------------------------------------------------------- 1 | 2 | REM windows script 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /ci/drone/windows-cxx-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | -------------------------------------------------------------------------------- /ci/enforce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Copyright 2020 - 2025 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Set & check B2 build variables understood by boost-ci scripts. 10 | 11 | set -e 12 | 13 | function get_python_executable { 14 | if command -v python &> /dev/null; then 15 | echo "python" 16 | elif command -v python3 &> /dev/null; then 17 | echo "python3" 18 | elif command -v python2 &> /dev/null; then 19 | echo "python2" 20 | else 21 | echo "Please install Python!" >&2 22 | false 23 | fi 24 | } 25 | 26 | function enforce_b2 { 27 | local old_varname=$1 28 | local new_varname=B2_${old_varname} 29 | 30 | if [ -z "${!new_varname:-}" ]; then 31 | if [ -n "${!old_varname:-}" ]; then 32 | if [ "$TRAVIS" = "true" ]; then 33 | local ci_script=".travis.yml" 34 | elif [ -n "${GITHUB_WORKFLOW:-}" ]; then 35 | local ci_script="${GITHUB_WORKFLOW} workflow" 36 | elif [ -n "${AGENT_OS:-}" ]; then 37 | local ci_script=".azure-pipelines.yml or azure-pipelines.yml" 38 | fi 39 | echo 40 | echo "WARNING: Your ${ci_script:-CI} file needs to be updated:" 41 | echo " use ${new_varname} instead of ${old_varname}" 42 | echo 43 | export "${new_varname}"="${!old_varname}" 44 | unset "${old_varname}" 45 | fi 46 | fi 47 | } 48 | 49 | enforce_b2 "CXXFLAGS" 50 | enforce_b2 "CXXSTD" 51 | enforce_b2 "DEFINES" 52 | enforce_b2 "LINKFLAGS" 53 | enforce_b2 "TESTFLAGS" 54 | enforce_b2 "TOOLSET" 55 | 56 | # default language level: C++11 57 | if [ -z "${B2_CXXSTD:-}" ]; then 58 | export B2_CXXSTD=11 59 | fi 60 | 61 | # default parallel build jobs: number of CPUs available + 1 62 | if [ -z "${B2_JOBS:-}" ]; then 63 | pythonexecutable=$(get_python_executable) 64 | cpus=$(grep -c 'processor' /proc/cpuinfo || $pythonexecutable -c 'import multiprocessing as mp; print(mp.cpu_count())' || echo "2") 65 | export B2_JOBS=$((cpus + 1)) 66 | fi 67 | 68 | # Build cmdline arguments for B2 in the array B2_ARGS to preserve quotes 69 | 70 | if [ -n "${B2_CI_VERSION:-}" ]; then # Set B2_CI_VERSION to opt in to new features 71 | function append_b2_args { 72 | # Generate multiple "option=value" entries from the value of an environment variable 73 | # Handles correct splitting and quoting 74 | local var_name="$1" 75 | local option_name="$2" 76 | if [ -n "${!var_name:-}" ]; then 77 | while IFS= read -r -d '' value; do 78 | # If the value has an assignment and a space we need to quote it 79 | if [[ $value == *"="*" "* ]]; then 80 | B2_ARGS+=("${option_name}=${value%%=*}=\"${value#*=}\"") 81 | else 82 | B2_ARGS+=("${option_name}=${value}") 83 | fi 84 | done < <(echo "${!var_name}" | xargs -n 1 printf '%s\0') 85 | fi 86 | } 87 | 88 | B2_ARGS=( 89 | ${B2_TOOLSET:+"toolset=$B2_TOOLSET"} 90 | "cxxstd=$B2_CXXSTD" 91 | ${B2_CXXFLAGS:+"cxxflags=$B2_CXXFLAGS"} 92 | ) 93 | append_b2_args B2_DEFINES define 94 | append_b2_args B2_INCLUDE include 95 | # shellcheck disable=SC2206 96 | B2_ARGS=( 97 | "${B2_ARGS[@]}" 98 | ${B2_LINKFLAGS:+"linkflags=$B2_LINKFLAGS"} 99 | ${B2_TESTFLAGS:-} 100 | ${B2_ADDRESS_MODEL:+address-model=$B2_ADDRESS_MODEL} 101 | ${B2_LINK:+link=$B2_LINK} 102 | ${B2_VISIBILITY:+visibility=$B2_VISIBILITY} 103 | ${B2_STDLIB:+"stdlib=$B2_STDLIB"} 104 | ${B2_THREADING:-} 105 | ${B2_VARIANT:+variant=$B2_VARIANT} 106 | ${B2_ASAN:+address-sanitizer=norecover} 107 | ${B2_TSAN:+thread-sanitizer=norecover} 108 | ${B2_UBSAN:+undefined-sanitizer=norecover} 109 | -j"${B2_JOBS}" 110 | ${B2_FLAGS:-} 111 | ) 112 | else 113 | # Legacy codepath for compatibility for for old versions of the .github/*.yml files: 114 | # In (most) variables the prefix (such as "cxxflags=" for B2_CXXFLAGS) was included in the value, so it isn't added (again) here 115 | # shellcheck disable=SC2206 116 | B2_ARGS=( 117 | toolset="$B2_TOOLSET" 118 | cxxstd="$B2_CXXSTD" 119 | ${B2_CXXFLAGS:-} 120 | ${B2_DEFINES:-} 121 | ${B2_INCLUDE:-} 122 | ${B2_LINKFLAGS:-} 123 | ${B2_TESTFLAGS:-} 124 | ${B2_ADDRESS_MODEL:-} 125 | ${B2_LINK:-} 126 | ${B2_THREADING:-} 127 | ${B2_VARIANT:-} 128 | -j"${B2_JOBS}" 129 | ) 130 | fi 131 | -------------------------------------------------------------------------------- /ci/get_libname.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright Alexander Grund 2021-2023 4 | # 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # https://www.boost.org/LICENSE_1_0.txt 7 | 8 | import json 9 | import os 10 | import sys 11 | 12 | with open(os.path.join(os.environ['BOOST_CI_SRC_FOLDER'], 'meta', 'libraries.json')) as jsonFile: 13 | lib_data = json.load(jsonFile) 14 | if isinstance(lib_data, (list, tuple)): 15 | if len(lib_data) > 1: 16 | sys.stderr.write('Found multiple libraries in meta/libraries.json. Assuming first entry is the main one.\n') 17 | else: 18 | sys.stderr.write('Unwrapping list with single entry in meta/libraries.json.\n') 19 | lib_data = lib_data[0] 20 | # Special cases where the full library key and name/folder do not match 21 | name_fixups = { 'logic/tribool': 'logic' } 22 | 23 | key = lib_data['key'] 24 | print(name_fixups.get(key, key)) 25 | -------------------------------------------------------------------------------- /ci/github/codecov.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2021 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Bash script to run on Github to perform codecov.io integration 9 | # 10 | 11 | set -ex 12 | 13 | source "$(dirname "${BASH_SOURCE[0]}")"/../codecov.sh "$1" 14 | 15 | if [[ "$1" == "setup" ]]; then 16 | { 17 | echo "B2_VARIANT=$B2_VARIANT" 18 | echo "B2_CXXFLAGS=$B2_CXXFLAGS" 19 | echo "B2_LINKFLAGS=$B2_LINKFLAGS" 20 | } >> "$GITHUB_ENV" 21 | fi 22 | -------------------------------------------------------------------------------- /ci/github/coverity.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2022 James E. King III 4 | # Copyright 2022 - 2024 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Bash script to run in GHA to perform a Coverity Scan build 10 | # Environment Variables you must define (as secrets in GHA): 11 | # 12 | # COVERITY_SCAN_NOTIFICATION_EMAIL - email address to notify 13 | # COVERITY_SCAN_TOKEN - the Coverity Scan token (should be secure) 14 | # 15 | 16 | set -ex 17 | 18 | # install.sh will call common_install.sh in a previous CI step and write CXX 19 | # out to a file but it isn't available in subsequent CI steps, so pick it up 20 | CXX=$(grep -F using ~/user-config.jam | head -1 | cut -d' ' -f5) 21 | 22 | if [[ "${CXX}" != "clang"* ]]; then 23 | echo "GHA CI Coverity jobs only support clang toolsets right now." 24 | exit 1 25 | fi 26 | 27 | if [[ -z "${COVERITY_SCAN_TOKEN}" || -z "${COVERITY_SCAN_NOTIFICATION_EMAIL}" ]]; then 28 | echo "GHA CI Coverity jobs require COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL secrets." 29 | exit 1 30 | fi 31 | 32 | pushd /tmp 33 | rm -rf coverity_tool.tgz cov-analysis* 34 | curl -L -d "token=${COVERITY_SCAN_TOKEN}&project=${GITHUB_REPOSITORY}" -X POST https://scan.coverity.com/download/cxx/linux64 -o coverity_tool.tgz 35 | tar xzf coverity_tool.tgz 36 | COVBIN=$(echo "$(pwd)"/cov-analysis*/bin) 37 | export PATH=${COVBIN}:${PATH} 38 | popd 39 | 40 | RESULTS_DIR="$(pwd)/cov-int" 41 | mkdir "${RESULTS_DIR}" 42 | cov-configure --template --compiler "${CXX}" --comptype "clangcxx" 43 | unset CXX 44 | 45 | cov-build --dir "${RESULTS_DIR}" ci/build.sh 46 | 47 | ls -ls "${RESULTS_DIR}" 48 | tail -50 "${RESULTS_DIR}/build-log.txt" 49 | tar czf cov-int.tgz cov-int 50 | curl --form token="${COVERITY_SCAN_TOKEN}" \ 51 | --form email="${COVERITY_SCAN_NOTIFICATION_EMAIL}" \ 52 | --form file=@cov-int.tgz \ 53 | --form version="${GITHUB_REF_NAME}" \ 54 | --form description="${GITHUB_REPOSITORY}:${GITHUB_REF}:${GITHUB_SHA}:${GITHUB_RUN_NUMBER}" \ 55 | https://scan.coverity.com/builds?project="${GITHUB_REPOSITORY}" 56 | -------------------------------------------------------------------------------- /ci/github/install.bat: -------------------------------------------------------------------------------- 1 | @ECHO ON 2 | 3 | echo GITHUB_BASE_REF: %GITHUB_BASE_REF% 4 | echo GITHUB_REF: %GITHUB_REF% 5 | 6 | if not defined GITHUB_BASE_REF ( 7 | set BOOST_CI_TARGET_BRANCH=%GITHUB_REF% 8 | ) else ( 9 | set BOOST_CI_TARGET_BRANCH=%GITHUB_BASE_REF% 10 | ) 11 | for /f %%i in ("%BOOST_CI_TARGET_BRANCH%") do set BOOST_CI_TARGET_BRANCH=%%~nxi 12 | echo BOOST_CI_TARGET_BRANCH: %BOOST_CI_TARGET_BRANCH% 13 | 14 | set BOOST_CI_SRC_FOLDER=%GITHUB_WORKSPACE% 15 | 16 | call %~dp0\..\common_install.bat 17 | 18 | echo SELF=%SELF%>> %GITHUB_ENV% 19 | echo BOOST_CI_TARGET_BRANCH=%BOOST_CI_TARGET_BRANCH%>> %GITHUB_ENV% 20 | echo BOOST_CI_SRC_FOLDER=%BOOST_CI_SRC_FOLDER%>> %GITHUB_ENV% 21 | echo BOOST_ROOT=%BOOST_ROOT%>> %GITHUB_ENV% 22 | -------------------------------------------------------------------------------- /ci/github/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2021-2025 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Executes the install phase for GHA 9 | # Needs env variables: 10 | # - B2_COMPILER 11 | # - B2_CXXSTD 12 | # - B2_SANITIZE 13 | 14 | set -ex 15 | 16 | # Required because inside a container the owner is root so git commands would fail. 17 | # Note that $GITHUB_WORKSPACE != ${{github.workspace}} (in the CI yml) inside containers. 18 | git config --global --add safe.directory "$GITHUB_WORKSPACE" || echo "Failed to set Git safe.directory" # Don't fail, just warn 19 | 20 | BOOST_CI_TARGET_BRANCH="${GITHUB_BASE_REF:-$GITHUB_REF}" 21 | export BOOST_CI_TARGET_BRANCH="${BOOST_CI_TARGET_BRANCH##*/}" # Extract branch name 22 | export BOOST_CI_SRC_FOLDER="${GITHUB_WORKSPACE//\\//}" 23 | 24 | { 25 | echo "BOOST_CI_TARGET_BRANCH=$BOOST_CI_TARGET_BRANCH" 26 | echo "BOOST_CI_SRC_FOLDER=$BOOST_CI_SRC_FOLDER" 27 | } >> "$GITHUB_ENV" 28 | 29 | if [[ "$B2_SANITIZE" == "yes" ]]; then 30 | B2_ASAN=1 31 | B2_UBSAN=1 32 | if [[ -f $BOOST_CI_SRC_FOLDER/ubsan-blacklist ]]; then 33 | B2_CXXFLAGS="${B2_CXXFLAGS:+$B2_CXXFLAGS }-fsanitize-blacklist=libs/$SELF/ubsan-blacklist" 34 | fi 35 | if [[ -f $BOOST_CI_SRC_FOLDER/.ubsan-ignorelist ]]; then 36 | export UBSAN_OPTIONS="suppressions=${BOOST_CI_SRC_FOLDER}/.ubsan-ignorelist,${UBSAN_OPTIONS}" 37 | fi 38 | fi 39 | 40 | . "$(dirname "${BASH_SOURCE[0]}")"/../common_install.sh 41 | 42 | # Persist the environment for all future steps 43 | 44 | # Set by common_install.sh 45 | { 46 | echo "SELF=$SELF" 47 | echo "BOOST_ROOT=$BOOST_ROOT" 48 | echo "B2_TOOLSET=$B2_TOOLSET" 49 | echo "B2_COMPILER=$B2_COMPILER" 50 | # Usually set by the env-key of the "Setup Boost" step 51 | [ -z "$B2_CXXSTD" ] || echo "B2_CXXSTD=$B2_CXXSTD" 52 | [ -z "$B2_JOBS" ] || echo "B2_JOBS=$B2_JOBS" 53 | [ -z "$B2_CXXFLAGS" ] || echo "B2_CXXFLAGS=$B2_CXXFLAGS" 54 | [ -z "$B2_DEFINES" ] || echo "B2_DEFINES=$B2_DEFINES" 55 | [ -z "$B2_INCLUDE" ] || echo "B2_INCLUDE=$B2_INCLUDE" 56 | [ -z "$B2_LINKFLAGS" ] || echo "B2_LINKFLAGS=$B2_LINKFLAGS" 57 | [ -z "$B2_TESTFLAGS" ] || echo "B2_TESTFLAGS=$B2_TESTFLAGS" 58 | [ -z "$B2_ADDRESS_MODEL" ] || echo "B2_ADDRESS_MODEL=$B2_ADDRESS_MODEL" 59 | [ -z "$B2_LINK" ] || echo "B2_LINK=$B2_LINK" 60 | [ -z "$B2_VISIBILITY" ] || echo "B2_VISIBILITY=$B2_VISIBILITY" 61 | [ -z "$B2_STDLIB" ] || echo "B2_STDLIB=$B2_STDLIB" 62 | [ -z "$B2_THREADING" ] || echo "B2_THREADING=$B2_THREADING" 63 | [ -z "$B2_VARIANT" ] || echo "B2_VARIANT=$B2_VARIANT" 64 | [ -z "$B2_ASAN" ] || echo "B2_ASAN=$B2_ASAN" 65 | [ -z "$B2_TSAN" ] || echo "B2_TSAN=$B2_TSAN" 66 | [ -z "$B2_UBSAN" ] || echo "B2_UBSAN=$B2_UBSAN" 67 | [ -z "$B2_FLAGS" ] || echo "B2_FLAGS=$B2_FLAGS" 68 | [ -z "$B2_TARGETS" ] || echo "B2_TARGETS=$B2_TARGETS" 69 | # Filter out (only) the conditions from set -x 70 | # Write the stdout to the GitHub env file 71 | } 2> >(grep -vF ' -z ' >&2) >> "$GITHUB_ENV" 72 | -------------------------------------------------------------------------------- /ci/github/setup_bdde.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2024 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Setup the Boost Docker Development Environment (BDDE) 9 | # Requires a Linux environment with root/sudo privileges 10 | 11 | set -ex 12 | 13 | $(dirname "${BASH_SOURCE[0]}")/../setup_bdde.sh 14 | 15 | echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH} 16 | 17 | for var in "${!BDDE_@}"; do 18 | echo "$var=${!var}" >> ${GITHUB_ENV} 19 | done 20 | 21 | echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV} 22 | 23 | if [[ "${BDDE_FIX_MANIFEST:-yes}" == "yes" ]]; then 24 | # Avoid: /usr/bin/windres: Can't detect architecture. 25 | echo "B2_DONT_EMBED_MANIFEST=1" >> ${GITHUB_ENV} 26 | fi 27 | -------------------------------------------------------------------------------- /ci/opencppcoverage.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2019 - 2021 Alexander Grund 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | $scriptPath = split-path $MyInvocation.MyCommand.Path 6 | 7 | # Install coverage collector (Similar to LCov) 8 | choco install opencppcoverage 9 | $env:Path += ";C:\Program Files\OpenCppCoverage" 10 | 11 | # Run build with coverage collection 12 | $env:B2_VARIANT = "debug" 13 | 14 | # Use a temporary folder to avoid codecov picking up wrong files 15 | mkdir __out 16 | 17 | # Build command to collect coverage 18 | $cmd = 'OpenCppCoverage.exe --export_type cobertura:__out/cobertura.xml --modules "{0}" ' -f ${env:BOOST_ROOT} 19 | # Include own headers (relocated to boost\*) 20 | $cmd += (Get-ChildItem -Name "${env:BOOST_CI_SRC_FOLDER}\include\boost").ForEach({'--sources "boost\{0}"' -f $_}) -join " " 21 | # Include own cpp files 22 | $cmd += " --sources ${env:BOOST_ROOT}\libs\${env:SELF} " 23 | $exclusions = @( 24 | # Lines marked with LCov or coverity exclusion comments 25 | '.*// LCOV_EXCL_LINE' 26 | '.*// coverity\[dead_error_line\]' 27 | # Lines containing only braces 28 | '\s*[}{]*\s*' 29 | # Lines containing only else (and opt. braces) 30 | '\s*(\} )?else( \{)?\s*' 31 | ) 32 | $cmd += $exclusions.ForEach({"--excluded_line_regex '{0}'" -f $_}) -join " " 33 | # Cover all subprocess of the build script (-> b2 -> test binary) 34 | $cmd += "--cover_children -- cmd.exe /c $scriptPath\build.bat" 35 | 36 | # Print generated command and run 37 | $cmd 38 | Invoke-Expression $cmd 39 | -------------------------------------------------------------------------------- /ci/setup_bdde.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2024 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Setup the Boost Docker Development Environment (BDDE) 9 | # 10 | # The BDDE project at https://github.com/jeking3/bdde includes 11 | # build containers for different operating systems and architectures 12 | # using multiarch containers. 13 | # This allows e.g. building in a big-endian environment on CI 14 | # Simply set $BDDE_DISTRO, $BDDE_EDITION & $BDDE_ARCH 15 | # and run your commands with the prefix `bdde`, e.g. `bdde true` 16 | # 17 | # Requires a Linux environment with root/sudo privileges 18 | 19 | set -ex 20 | 21 | if [ -f "/etc/debian_version" ]; then 22 | sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install binfmt-support qemu-user-static 23 | fi 24 | 25 | git clone --depth=1 https://github.com/jeking3/bdde.git 26 | 27 | BDDE_SCRIPTS=$(pwd)/bdde/bin/linux 28 | 29 | # this prepares the VM for multiarch docker 30 | sudo ${BDDE_SCRIPTS}/bdde-multiarch 31 | sudo ${BDDE_SCRIPTS}/bdde-multiarch --version 32 | 33 | export PATH="${BDDE_SCRIPTS}:${PATH}" 34 | -------------------------------------------------------------------------------- /ci/setup_ccache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2021-2024 Alexander Grund 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Installs and sets up ccache 9 | 10 | { set +x; } &> /dev/null 11 | set -eu 12 | 13 | function print_on_gha { 14 | [[ "${GITHUB_ACTIONS:-false}" != "true" ]] || echo "$@" 15 | } 16 | 17 | if ! command -v ccache &> /dev/null; then 18 | print_on_gha "::group::Installing CCache" 19 | if [ -f "/etc/debian_version" ]; then 20 | sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ccache 21 | elif command -v brew &> /dev/null; then 22 | brew update > /dev/null 23 | if ! brew install ccache 2>&1; then 24 | echo "Installing CCache via Homebrew failed." 25 | echo "Cleaning up Python binaries and trying again" 26 | # Workaround issue with unexpected symlinks: https://github.com/actions/runner-images/issues/6817 27 | for f in 2to3 idle3 pydoc3 python3 python3-config; do 28 | rm /usr/local/bin/$f || true 29 | done 30 | # Try again 31 | brew install ccache 2>&1 32 | fi 33 | fi 34 | print_on_gha "::endgroup::" 35 | fi 36 | 37 | print_on_gha "::group::Configuring CCache" 38 | ccache --version 39 | 40 | # This also sets the default values 41 | echo "Using cache directory of size ${B2_CCACHE_SIZE:=500M} at '${B2_CCACHE_DIR:=$HOME/.ccache}'" 42 | 43 | ccache --set-config=cache_dir="$B2_CCACHE_DIR" 44 | ccache --set-config=max_size="$B2_CCACHE_SIZE" 45 | 46 | ccache -z 47 | echo "CCache config: $(ccache -p)" 48 | print_on_gha "::endgroup::" 49 | -------------------------------------------------------------------------------- /ci/travis/bdde.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | # Build using a Boost Docker Development Environment container. 9 | # The BDDE project at https://github.com/jeking3/bdde includes 10 | # build containers for different operating systems and architectures 11 | # using multiarch containers. This allows for better continuous 12 | # integration, for example you can build in a big-endian environment 13 | # on Travis CI. 14 | # 15 | # In your .travis.yml file, set $BDDE_DISTRO, $BDDE_EDITION, $BDDE_ARCH 16 | # according to the instructions in the BDDE README. 17 | 18 | set -ex 19 | 20 | . $(dirname "${BASH_SOURCE[0]}")/../setup_bdde.sh 21 | 22 | . $(dirname "${BASH_SOURCE[0]}")/../enforce.sh 23 | 24 | bdde "echo this just pulls the image" 25 | 26 | # now we can bootstrap and build just like normal, but it is in the container 27 | BOOST_STEM=boost bdde "./bootstrap.sh" 28 | BOOST_STEM=boost bdde ./b2 "libs/$SELF/test" "${B2_ARGS[@]}" "$@" 29 | -------------------------------------------------------------------------------- /ci/travis/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Bash script to run in travis to perform a bjam build 9 | # cwd should be $BOOST_ROOT/libs/$SELF before running 10 | # 11 | 12 | . $(dirname "${BASH_SOURCE[0]}")/../build.sh 13 | -------------------------------------------------------------------------------- /ci/travis/codecov.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Copyright 2021 Alexander Grund 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | # 9 | # Bash script to run in travis to perform codecov.io integration 10 | # 11 | 12 | set -eux 13 | 14 | CI_DIR="$(dirname "${BASH_SOURCE[0]}")/.." 15 | 16 | source "$CI_DIR"/codecov.sh "setup" 17 | "$CI_DIR"/build.sh 18 | "$CI_DIR"/codecov.sh "upload" 19 | -------------------------------------------------------------------------------- /ci/travis/coverity.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Bash script to run in travis to perform a Coverity Scan build 9 | # To skip the coverity integration download (which is huge) if 10 | # you already have it from a previous run, add --skipdownload 11 | # 12 | 13 | # 14 | # Environment Variables 15 | # 16 | # COVERITY_SCAN_NOTIFICATION_EMAIL - email address to notify 17 | # COVERITY_SCAN_TOKEN - the Coverity Scan token (should be secure) 18 | # SELF - the boost libs directory name 19 | 20 | export BOOST_REPO="$TRAVIS_REPO_SLUG" 21 | export BOOST_BRANCH="${BOOST_BRANCH:-$TRAVIS_BRANCH}" 22 | 23 | "$(dirname "${BASH_SOURCE[0]}")/../coverity.sh" 24 | -------------------------------------------------------------------------------- /ci/travis/cppcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2018 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | 9 | echo "WARNING: boost-ci no longer supports cppcheck" 10 | echo " remove the cppcheck job from your .travis.yml" 11 | -------------------------------------------------------------------------------- /ci/travis/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Executes the install phase for travis 9 | # 10 | # If your repository has additional directories beyond 11 | # "example", "examples", "tools", and "test" then you 12 | # can add them in the environment variable DEPINST. 13 | # i.e. - DEPINST="--include dirname1 --include dirname2" 14 | # 15 | 16 | set -ex 17 | 18 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 19 | unset -f cd 20 | fi 21 | 22 | export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" 23 | export BOOST_CI_SRC_FOLDER="$TRAVIS_BUILD_DIR" 24 | 25 | # Translate the `compiler: xxx` setting from travis into a toolset when B2_TOOLSET isn't set 26 | export B2_COMPILER=$TRAVIS_COMPILER 27 | if [ "${B2_TOOLSET:-}" == "" ]; then 28 | if [[ "$TRAVIS_COMPILER" =~ clang ]]; then 29 | export B2_TOOLSET=clang 30 | elif [[ "$TRAVIS_COMPILER" =~ g\+\+ ]]; then 31 | export B2_TOOLSET=gcc 32 | else 33 | echo "Unknown TRAVIS_COMPILER=$TRAVIS_COMPILER. Set B2_TOOLSET instead!" >&2 34 | false 35 | fi 36 | echo "using $B2_TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam 37 | fi 38 | 39 | . $(dirname "${BASH_SOURCE[0]}")/../common_install.sh 40 | -------------------------------------------------------------------------------- /ci/travis/intelicc.cfg: -------------------------------------------------------------------------------- 1 | ACCEPT_EULA=accept 2 | CONTINUE_WITH_OPTIONAL_ERROR=yes 3 | PSET_INSTALL_DIR=/opt/intel 4 | CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes 5 | PSET_MODE=install 6 | ACTIVATION_SERIAL_NUMBER= 7 | ACTIVATION_TYPE=serial_number 8 | AMPLIFIER_SAMPLING_DRIVER_INSTALL_TYPE=kit 9 | AMPLIFIER_DRIVER_ACCESS_GROUP=vtune 10 | AMPLIFIER_DRIVER_PERMISSIONS=666 11 | AMPLIFIER_LOAD_DRIVER=no 12 | AMPLIFIER_C_COMPILER=/usr/bin/gcc 13 | AMPLIFIER_KERNEL_SRC_DIR=none 14 | AMPLIFIER_MAKE_COMMAND=/usr/bin/make 15 | AMPLIFIER_INSTALL_BOOT_SCRIPT=no 16 | AMPLIFIER_DRIVER_PER_USER_MODE=no 17 | INTEL_SW_IMPROVEMENT_PROGRAM_CONSENT=no 18 | ARCH_SELECTED=ALL 19 | COMPONENTS=;intel-conda-index-tool__x86_64;intel-comp__x86_64;intel-comp-32bit__x86_64;intel-comp-doc__noarch;intel-comp-l-all-common__noarch;intel-comp-l-all-vars__noarch;intel-comp-nomcu-vars__noarch;intel-comp-ps-32bit__x86_64;intel-comp-ps__x86_64;intel-comp-ps-ss__x86_64;intel-comp-ps-ss-bec__x86_64;intel-comp-ps-ss-bec-32bit__x86_64;intel-openmp__x86_64;intel-openmp-32bit__x86_64;intel-openmp-common__noarch;intel-openmp-common-icc__noarch;intel-tbb-libs-32bit__x86_64;intel-tbb-libs__x86_64;intel-idesupport-icc-common-ps__noarch;intel-conda-intel-openmp-linux-64-shadow-package__x86_64;intel-conda-intel-openmp-linux-32-shadow-package__x86_64;intel-conda-icc_rt-linux-64-shadow-package__x86_64;intel-icc__x86_64;intel-icc-32bit__x86_64;intel-c-comp-common__noarch;intel-icc-common__noarch;intel-icc-common-ps__noarch;intel-icc-common-ps-ss-bec__noarch;intel-icc-doc__noarch;intel-icc-doc-ps__noarch;intel-icc-ps__x86_64;intel-icc-ps-ss-bec__x86_64;intel-icc-ps-ss-bec-32bit__x86_64;intel-mkl-common__noarch;intel-mkl-core-32bit__x86_64;intel-mkl-core__x86_64;intel-mkl-core-rt-32bit__x86_64;intel-mkl-core-rt__x86_64;intel-mkl-doc__noarch;intel-mkl-doc-ps__noarch;intel-mkl-gnu-32bit__x86_64;intel-mkl-gnu__x86_64;intel-mkl-gnu-rt-32bit__x86_64;intel-mkl-gnu-rt__x86_64;intel-mkl-common-ps__noarch;intel-mkl-core-ps-32bit__x86_64;intel-mkl-core-ps__x86_64;intel-conda-mkl-linux-64-shadow-package__x86_64;intel-conda-mkl-linux-32-shadow-package__x86_64;intel-conda-mkl-static-linux-64-shadow-package__x86_64;intel-conda-mkl-static-linux-32-shadow-package__x86_64;intel-conda-mkl-devel-linux-64-shadow-package__x86_64;intel-conda-mkl-devel-linux-32-shadow-package__x86_64;intel-conda-mkl-include-linux-64-shadow-package__x86_64;intel-conda-mkl-include-linux-32-shadow-package__x86_64;intel-mkl-common-c__noarch;intel-mkl-core-c-32bit__x86_64;intel-mkl-core-c__x86_64;intel-mkl-common-c-ps__noarch;intel-mkl-tbb-32bit__x86_64;intel-mkl-tbb__x86_64;intel-mkl-tbb-rt-32bit__x86_64;intel-mkl-tbb-rt__x86_64;intel-mkl-gnu-c-32bit__x86_64;intel-mkl-gnu-c__x86_64;intel-ipp-common__noarch;intel-ipp-common-ps__noarch;intel-ipp-st-devel-32bit__x86_64;intel-ipp-st-devel-ps-32bit__x86_64;intel-ipp-st-32bit__x86_64;intel-ipp-st__x86_64;intel-ipp-mt-32bit__x86_64;intel-ipp-mt__x86_64;intel-ipp-st-devel__x86_64;intel-ipp-st-devel-ps__x86_64;intel-ipp-mt-devel-32bit__x86_64;intel-ipp-mt-devel__x86_64;intel-ipp-doc__noarch;intel-conda-ipp-linux-64-shadow-package__x86_64;intel-conda-ipp-linux-32-shadow-package__x86_64;intel-conda-ipp-static-linux-64-shadow-package__x86_64;intel-conda-ipp-static-linux-32-shadow-package__x86_64;intel-conda-ipp-include-linux-64-shadow-package__x86_64;intel-conda-ipp-include-linux-32-shadow-package__x86_64;intel-conda-ipp-devel-linux-64-shadow-package__x86_64;intel-conda-ipp-devel-linux-32-shadow-package__x86_64;intel-tbb-devel-32bit__x86_64;intel-tbb-devel__x86_64;intel-tbb-common__noarch;intel-tbb-doc__noarch;intel-conda-tbb-linux-64-shadow-package__x86_64;intel-conda-tbb-linux-32-shadow-package__x86_64;intel-conda-tbb-devel-linux-64-shadow-package__x86_64;intel-conda-tbb-devel-linux-32-shadow-package__x86_64;intel-daal-core-32bit__x86_64;intel-daal-core__x86_64;intel-daal-common__noarch;intel-daal-doc__noarch;intel-conda-daal-linux-64-shadow-package__x86_64;intel-conda-daal-linux-32-shadow-package__x86_64;intel-conda-daal-static-linux-64-shadow-package__x86_64;intel-conda-daal-static-linux-32-shadow-package__x86_64;intel-conda-daal-include-linux-64-shadow-package__x86_64;intel-conda-daal-include-linux-32-shadow-package__x86_64;intel-conda-daal-devel-linux-64-shadow-package__x86_64;intel-conda-daal-devel-linux-32-shadow-package__x86_64;intel-daal-doc-ps__noarch;intel-ipsc__noarch;intel-psxe-common__noarch;intel-psxe-doc__noarch;intel-psxe-common-doc__noarch;intel-ips-doc__noarch;intel-psxe-licensing__noarch;intel-psxe-licensing-doc__noarch;intel-icsxe-pset 20 | -------------------------------------------------------------------------------- /ci/travis/intelicc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2018 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Bash script to install Intel ICC. 9 | # 10 | 11 | # 12 | # Environment Variables 13 | # 14 | # INTEL_ICC_SERIAL_NUMBER - the Intel ICC serial number to use 15 | # SELF - the boost libs directory name 16 | # B2_TOOLSET - the toolset to use (intel-linux) 17 | 18 | set -ex 19 | 20 | CI_DIR="$(dirname "${BASH_SOURCE[0]}")/.." 21 | 22 | . "$CI_DIR"/enforce.sh 23 | 24 | if [ -z "$INTEL_ICC_SERIAL_NUMBER" ]; then 25 | echo "ERROR: you did not set the INTEL_ICC_SERIAL_NUMBER environment variable" 26 | exit 1 27 | fi 28 | 29 | function finish { 30 | rm -rf /tmp/parallel_studio_xe_2019_update3_professional_edition_for_cpp_online/silent.cfg 31 | } 32 | 33 | pushd /tmp 34 | wget --quiet http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15270/parallel_studio_xe_2019_update3_professional_edition_for_cpp_online.tgz 35 | tar xzf parallel_studio_xe_2019_update3_professional_edition_for_cpp_online.tgz 36 | cd parallel_studio_xe_2019_update3_professional_edition_for_cpp_online/ 37 | cp "$CI_DIR"/travis/intelicc.cfg silent.cfg 38 | trap finish EXIT 39 | sed -i "s/ACTIVATION_SERIAL_NUMBER=.*/ACTIVATION_SERIAL_NUMBER=$INTEL_ICC_SERIAL_NUMBER/g" silent.cfg 40 | sudo ./install.sh -s silent.cfg 41 | rm -f silent.cfg 42 | export PATH=/opt/intel/bin:$PATH 43 | popd 44 | cd ../.. 45 | ./bootstrap.sh --with-toolset=$B2_TOOLSET 46 | "$CI_DIR"/build.sh 47 | -------------------------------------------------------------------------------- /ci/travis/valgrind.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2018 - 2019 James E. King III 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | # Bash script to run in travis to perform a cppcheck 9 | # cwd should be $BOOST_ROOT before running 10 | # 11 | 12 | set -ex 13 | 14 | # valgrind on travis (xenial) is 3.11 which is old 15 | # using valgrind 3.14 but we have to build it 16 | 17 | pushd /tmp 18 | valgrindversion=3.20.0 19 | curl -sSL --retry ${NET_RETRY_COUNT:-5} https://sourceware.org/pub/valgrind/valgrind-${valgrindversion}.tar.bz2 --output valgrind-${valgrindversion}.tar.bz2 20 | tar -xvf valgrind-${valgrindversion}.tar.bz2 21 | cd valgrind-${valgrindversion} 22 | 23 | ./autogen.sh 24 | ./configure --prefix=/tmp/vg 25 | make -j3 26 | make -j3 install 27 | popd 28 | 29 | export PATH=/tmp/vg/bin:$PATH 30 | export B2_INCLUDE=/tmp/vg/include 31 | 32 | . $(dirname "${BASH_SOURCE[0]}")/../build.sh 33 | -------------------------------------------------------------------------------- /images/boost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/boost-ci/85a74e9c1c8be547216c52f5fca6302a491c0fab/images/boost.png -------------------------------------------------------------------------------- /include/boost/boost-ci/boost_ci.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2020-2021 Alexander Grund 3 | // 4 | // Use, modification and distribution is subject to the Boost Software License, 5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // Just something so we can test dependencies on other Boost libs 9 | #include 10 | #include 11 | #ifndef BOOST_NO_CXX11_SMART_PTR 12 | #include 13 | #endif 14 | 15 | #ifdef BOOST_MSVC 16 | #define MSVC_VALUE 1 17 | #else 18 | #define MSVC_VALUE 0 19 | #endif 20 | 21 | namespace boost 22 | { 23 | namespace boost_ci 24 | { 25 | class BOOST_SYMBOL_VISIBLE example_error : public std::runtime_error { 26 | public: 27 | example_error() : std::runtime_error("Example error for demonstration") {} 28 | }; 29 | 30 | // Some function to test 31 | BOOST_NOINLINE int get_answer(const int isMsvc = MSVC_VALUE) 32 | { 33 | int answer; 34 | // Specifically crafted condition to check for coverage from MSVC and non MSVC builds 35 | if(isMsvc == 0) 36 | answer = 42; 37 | else if(isMsvc == 1) 38 | answer = 21; 39 | else 40 | throw example_error(); 41 | 42 | #ifdef BOOST_NO_CXX11_SMART_PTR 43 | return answer; 44 | #else 45 | // Just use some stdlib feature combined with a Boost.Config feature as demonstration 46 | auto ptr = std::unique_ptr(new int(answer)); 47 | return *ptr; 48 | #endif 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /meta/libraries.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": "boost-ci", 3 | "name": "CI", 4 | "authors": [ 5 | "James E. King III", 6 | "Rene Rivera", 7 | "Sam Darwin", 8 | "Mateusz Loskot", 9 | "Alexander Grund" 10 | ], 11 | "description": "CI templates for Boost libs", 12 | "category": [ 13 | "CI" 14 | ], 15 | "cxxstd": "11" 16 | } 17 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Alexander Grund 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt 4 | 5 | include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) 6 | 7 | if(NOT HAVE_BOOST_TEST) 8 | return() 9 | endif() 10 | 11 | set(BOOST_TEST_LINK_LIBRARIES Boost::boost_ci Boost::core) 12 | 13 | boost_test(SOURCES test.cpp) 14 | -------------------------------------------------------------------------------- /test/Jamfile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Mateusz Loskot 3 | # 4 | # Use, modification and distribution is subject to the Boost Software License, 5 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | # http://www.boost.org/LICENSE_1_0.txt) 7 | # 8 | import os ; 9 | import testing ; 10 | 11 | project boost/ci/test 12 | : requirements 13 | . 14 | ; 15 | 16 | local B2_ADDRESS_MODEL = [ os.environ B2_ADDRESS_MODEL ] ; 17 | local B2_CXXFLAGS = [ os.environ B2_CXXFLAGS ] ; 18 | local B2_CXXSTD = [ os.environ B2_CXXSTD ] ; 19 | local B2_DEFINES = [ os.environ B2_DEFINES ] ; 20 | local B2_INCLUDE = [ os.environ B2_INCLUDE ] ; 21 | local B2_JOBS = [ os.environ B2_JOBS ] ; 22 | local B2_LINK = [ os.environ B2_LINK ] ; 23 | local B2_LINKFLAGS = [ os.environ B2_LINKFLAGS ] ; 24 | local B2_TESTFLAGS = [ os.environ B2_TESTFLAGS ] ; 25 | local B2_THREADING = [ os.environ B2_THREADING ] ; 26 | local B2_TOOLSET = [ os.environ B2_TOOLSET ] ; 27 | local B2_VARIANT = [ os.environ B2_VARIANT ] ; 28 | local BOOST_ROOT = [ os.environ BOOST_ROOT ] ; 29 | 30 | ECHO "Running boostorg/boost-ci environment checks:" ; 31 | ECHO " B2_ADDRESS_MODEL:" $(B2_ADDRESS_MODEL) ; 32 | ECHO " B2_CXXFLAGS:" $(B2_CXXFLAGS) ; 33 | ECHO " B2_CXXSTD:" $(B2_CXXSTD) ; 34 | ECHO " B2_DEFINES:" $(B2_DEFINES) ; 35 | ECHO " B2_INCLUDE:" $(B2_INCLUDE) ; 36 | ECHO " B2_JOBS:" $(B2_JOBS) ; 37 | ECHO " B2_LINK:" $(B2_LINK) ; 38 | ECHO " B2_LINKFLAGS:" $(B2_LINKFLAGS) ; 39 | ECHO " B2_TESTFLAGS:" $(B2_TESTFLAGS) ; 40 | ECHO " B2_THREADING:" $(B2_THREADING) ; 41 | ECHO " B2_TOOLSET:" $(B2_TOOLSET) ; 42 | ECHO " B2_VARIANT:" $(B2_VARIANT) ; 43 | ECHO " BOOST_ROOT:" $(BOOST_ROOT) ; 44 | ECHO ; 45 | 46 | unit-test test : test.cpp ; -------------------------------------------------------------------------------- /test/cmake_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Alexander Grund 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt 4 | 5 | cmake_minimum_required(VERSION 3.5...3.16) 6 | 7 | project(cmake_subdir_test LANGUAGES CXX) 8 | 9 | # Those 2 should work the same 10 | # while using find_package for the installed Boost avoids the need to manually specify dependencies 11 | if(BOOST_CI_INSTALL_TEST) 12 | find_package(boost_boost_ci REQUIRED) 13 | else() 14 | add_subdirectory(../.. boostorg/ci) 15 | add_subdirectory(../../../config boostorg/config) 16 | endif() 17 | 18 | add_executable(main main.cpp) 19 | target_link_libraries(main Boost::boost_ci) 20 | 21 | enable_testing() 22 | add_test(NAME main COMMAND main) 23 | 24 | add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $) -------------------------------------------------------------------------------- /test/cmake_test/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | const int expectedValue = (MSVC_VALUE) ? 21 : 42; 6 | return (boost::boost_ci::get_answer() == expectedValue) ? 0 : 1; 7 | } 8 | -------------------------------------------------------------------------------- /test/test.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2020 Mateusz Loskot 3 | // 4 | // Use, modification and distribution is subject to the Boost Software License, 5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Use some STL components just to quick check compilers 10 | #include 11 | #include 12 | #include 13 | // Use our dummy lib 14 | #include 15 | // And the usual test framwork 16 | #include 17 | // Check that including a file from the same directory works 18 | #include "test2.hpp" 19 | 20 | // Test of the CI scripts passing the correct defines 21 | #ifdef BOOST_CI_TEST_DEFINES 22 | #ifndef BOOST_NO_STRESS_TEST 23 | #error "Missing define BOOST_NO_STRESS_TEST" 24 | #endif 25 | #ifndef BOOST_IMPORTANT 26 | #error "Missing define BOOST_IMPORTANT" 27 | #endif 28 | #ifndef BOOST_ALSO_IMPORTANT 29 | #error "Missing define BOOST_ALSO_IMPORTANT" 30 | #endif 31 | #define BOOST_CI_STRINGIZE_2(x) #x 32 | #define BOOST_CI_STRINGIZE(x) BOOST_CI_STRINGIZE_2(x) 33 | #endif 34 | 35 | int main() 36 | { 37 | #ifdef BOOST_CI_TEST_DEFINES 38 | const std::string macro_value = BOOST_CI_STRINGIZE(BOOST_ALSO_IMPORTANT); 39 | BOOST_TEST_EQ(macro_value, "with space"); 40 | #endif 41 | const bool isMSVC = MSVC_VALUE; 42 | std::map > map; 43 | map["result"].push_back(boost::boost_ci::get_answer()); 44 | // Specifically crafted condition to check for coverage from MSVC and non MSVC builds 45 | if(isMSVC) 46 | { 47 | BOOST_TEST_EQ(boost::boost_ci::get_answer(), 21); 48 | } else 49 | { 50 | BOOST_TEST_EQ(boost::boost_ci::get_answer(), 42); 51 | } 52 | BOOST_TEST_EQ(map["result"].size(), 1u); 53 | BOOST_TEST_THROWS(boost::boost_ci::get_answer(-1), boost::boost_ci::example_error); 54 | return boost::report_errors(); 55 | } 56 | -------------------------------------------------------------------------------- /test/test2.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2020 Mateusz Loskot 3 | // 4 | // Use, modification and distribution is subject to the Boost Software License, 5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // test 10 | --------------------------------------------------------------------------------