aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--.github/workflows/test.yml89
-rw-r--r--LICENSE.txt21
-rw-r--r--action.yml118
4 files changed, 229 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..720eb38
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,89 @@
+name: Test
+
+on:
+ push:
+ pull_request:
+ schedule:
+ # Weekly, at 5:45 AM on Friday (somewhat randomly chosen).
+ - cron: '45 5 * * 5'
+ workflow_dispatch:
+
+jobs:
+ test:
+ strategy:
+ matrix:
+ version: [1.58.0, 1.74.0]
+ os: [ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019]
+ toolset: [auto, clang, gcc, mingw, msvc]
+
+ exclude:
+ # No Visual Studio on Linux.
+ - {os: ubuntu-18.04, toolset: msvc}
+ - {os: ubuntu-20.04, toolset: msvc}
+ # GCC == MinGW-w64 on Windows.
+ - {os: windows-2016, toolset: gcc}
+ - {os: windows-2019, toolset: gcc}
+
+ runs-on: '${{ matrix.os }}'
+
+ name: '${{ matrix.version }} / ${{ matrix.os }} / ${{ matrix.toolset }}'
+
+ defaults:
+ run:
+ shell: pwsh
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Cache Boost
+ uses: actions/cache@v2.1.4
+ with:
+ path: '${{ runner.workspace }}/boost_*.tar.gz'
+ key: 'boost-${{ matrix.version }}'
+
+ - name: Clean up PATH
+ uses: egor-tensin/cleanup-path@v2
+ if: runner.os == 'Windows'
+
+ - name: Set up GCC
+ uses: egor-tensin/setup-gcc@v1
+ if: matrix.toolset == 'gcc'
+
+ - name: Set up MinGW
+ uses: egor-tensin/setup-mingw@v2
+ if: matrix.toolset == 'mingw' || (matrix.toolset == 'clang' && runner.os == 'Windows')
+
+ - name: Set up Clang
+ uses: egor-tensin/setup-clang@v1
+ if: matrix.toolset == 'clang'
+
+ - id: build
+ name: Build Boost
+ uses: ./
+ with:
+ version: '${{ matrix.version }}'
+ toolset: '${{ matrix.toolset }}'
+ configuration: Release
+ libraries: filesystem program_options system
+
+ - name: Check libraries
+ run: |
+ New-Variable os -Value '${{ runner.os }}' -Option Constant
+ New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant
+
+ New-Variable toolset -Value '${{ matrix.toolset }}' -Option Constant
+ New-Variable librarydir -Value '${{ steps.build.outputs.librarydir }}' -Option Constant
+
+ $prefix = 'libboost_'
+ $ext = '.a'
+ if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) {
+ $ext = '.lib'
+ }
+
+ $expected = @('filesystem', 'program_options', 'system')
+ $expected = $expected | %{"$prefix$_$ext"}
+ foreach ($lib in $expected) {
+ $path = Join-Path $librarydir $lib
+ $(Test-Path $path -Type Leaf) -or $(throw "Couldn't find Boost library at: $path")
+ }
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..e758552
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/action.yml b/action.yml
new file mode 100644
index 0000000..9f3dcd7
--- /dev/null
+++ b/action.yml
@@ -0,0 +1,118 @@
+name: Build Boost
+description: Download & build Boost
+
+inputs:
+ version:
+ description: Version to build
+ required: true
+ libraries:
+ description: Space-separated list of libraries
+ required: true
+ toolset:
+ description: Toolset to use
+ required: false
+ default: auto
+ platform:
+ description: Target platform
+ required: false
+ default: auto
+ configuration:
+ description: Configuration to build
+ required: false
+ default: Release
+ directory:
+ description: Destination directory
+ required: false
+
+outputs:
+ root:
+ description: Root Boost directory
+ value: '${{ steps.build.outputs.root }}'
+ librarydir:
+ description: Directory with built Boost libraries
+ value: '${{ steps.build.outputs.librarydir }}'
+
+runs:
+ using: composite
+ steps:
+ - id: install
+ run: |
+ New-Variable os -Value '${{ runner.os }}' -Option Constant
+ New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant
+
+ if (Get-Command python3 -ErrorAction SilentlyContinue) {
+ $python = @('python3')
+ } elseif (Get-Command py -ErrorAction SilentlyContinue) {
+ $python = @('py', '-3')
+ } elseif (Get-Command python -ErrorAction SilentlyContinue) {
+ $python = @('python')
+ } else {
+ echo @'
+ ::error ::
+ egor-tensin/build-boost depends on a PyPI package, which requires Python 3.6 or later.
+ We couldn't find a Python installation in this environment.
+ '@
+ exit 1
+ }
+
+ $exe, $args = $python
+ & $exe $args -m pip install --user --upgrade cmake-common~=1.0
+
+ if ($windows_host) {
+ $bin_dir = & $exe $args -c "import sysconfig; print(sysconfig.get_path('scripts', 'nt_user'))"
+ } else {
+ $bin_dir = & $exe $args -c "import sysconfig; print(sysconfig.get_path('scripts', 'posix_user'))"
+ }
+
+ echo "::set-output name=bin_dir::$bin_dir"
+ shell: pwsh
+
+ - id: build
+ run: |
+ New-Variable os -Value '${{ runner.os }}' -Option Constant
+ New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant
+
+ New-Variable base_dir -Value '${{ runner.workspace }}' -Option Constant
+ New-Variable version -Value '${{ inputs.version }}' -Option Constant
+ New-Variable toolset -Value '${{ inputs.toolset }}' -Option Constant
+ New-Variable platform -Value '${{ inputs.platform }}' -Option Constant
+ New-Variable configuration -Value '${{ inputs.configuration }}' -Option Constant
+
+ $boost_dir = '${{ inputs.directory }}'
+ if (-not $boost_dir) {
+ $boost_dir = Join-Path $base_dir boost
+ }
+
+ $libraries = '${{ inputs.libraries }}'
+ $libraries = $libraries.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)
+
+ if (-not $libraries) {
+ echo @'
+ ::warning ::
+ No Boost libraries were explicitly selected for building, going to try to build them all.
+ This is likely to fail.
+ '@
+ }
+
+ $libraries = $libraries | %{"--with-$_"}
+
+ $bin_dir = '${{ steps.install.outputs.bin_dir }}'
+ $path_sep = [IO.Path]::PathSeparator
+ $env:Path = "$bin_dir$path_sep$env:PATH"
+
+ boost-download --cache $base_dir -- $version $boost_dir
+ boost-build --toolset $toolset --platform $platform --configuration $configuration -- $boost_dir $libraries
+
+ $platformdir = $platform
+ if ($platformdir -eq 'auto' -and $windows_host) {
+ $platformdir = 'x64'
+ }
+ $librarydir = Join-Path $boost_dir 'stage' $platformdir $configuration 'lib'
+
+ echo "::set-output name=root::$boost_dir"
+ echo "::set-output name=librarydir::$librarydir"
+ shell: pwsh
+
+branding:
+ icon: star
+ color: green