From e27925779b447955cfe93792a854da0d5ae28327 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 18 Apr 2021 09:26:07 +0300 Subject: add parameters static & static-runtime --- .github/actions/check-libraries/action.yml | 28 +++++++++++++++++++++++----- .github/workflows/test.yml | 2 ++ action.yml | 23 ++++++++++++++++++++++- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/.github/actions/check-libraries/action.yml b/.github/actions/check-libraries/action.yml index 8ef7c77..0e1812f 100644 --- a/.github/actions/check-libraries/action.yml +++ b/.github/actions/check-libraries/action.yml @@ -11,6 +11,10 @@ inputs: description: Toolset used required: false default: auto + static: + description: Look for static libraries + required: false + default: 0 runs: using: composite steps: @@ -20,16 +24,30 @@ runs: New-Variable librarydir -Value '${{ inputs.librarydir }}' -Option Constant New-Variable toolset -Value '${{ inputs.toolset }}' -Option Constant + New-Variable static -Value ('${{ inputs.static }}' -eq '1') -Option Constant + + dir $librarydir - $prefix = 'libboost_' - $ext = '.a' - if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) { - $ext = '.lib' + if ($static) { + $prefix = 'lib' + $ext = '.a' + if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) { + $ext = '.lib' + } + } else { + $prefix = 'lib' + if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) { + $prefix = '' + } + $ext = '.so' + if ($windows_host) { + $ext = '.dll' + } } $expected = '${{ inputs.libraries }}' $expected = $expected.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries) - $expected = $expected | %{"$prefix$_$ext"} + $expected = $expected | %{"${prefix}boost_$_$ext"} foreach ($lib in $expected) { $path = Join-Path $librarydir $lib diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2799e87..43d9c92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,6 +65,7 @@ jobs: version: '${{ matrix.version }}' toolset: '${{ matrix.toolset }}' configuration: Release + static: 1 libraries: filesystem program_options system - name: Check Boost @@ -80,6 +81,7 @@ jobs: toolset: '${{ matrix.toolset }}' librarydir: '${{ steps.build.outputs.librarydir }}' libraries: filesystem program_options system + static: 1 different_configurations: strategy: diff --git a/action.yml b/action.yml index 4c5739d..0e7f690 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,14 @@ inputs: description: Configuration to build required: false default: Release + static: + description: Build static libraries + required: false + default: 0 + static-runtime: + description: Link to the static runtime + required: false + default: 0 directory: description: Destination directory required: false @@ -77,6 +85,8 @@ runs: New-Variable toolset -Value '${{ inputs.toolset }}' -Option Constant New-Variable platform -Value '${{ inputs.platform }}' -Option Constant New-Variable configuration -Value '${{ inputs.configuration }}' -Option Constant + New-Variable static -Value ('${{ inputs.static }}' -eq '1') -Option Constant + New-Variable static_runtime -Value ('${{ inputs.static-runtime }}' -eq '1') -Option Constant $boost_dir = '${{ inputs.directory }}' if (-not $boost_dir) { @@ -100,8 +110,19 @@ runs: $path_sep = [IO.Path]::PathSeparator $env:Path = "$bin_dir$path_sep$env:PATH" + $link = if ($static) {'static'} else {'shared'} + $runtime_link = if ($static_runtime) {'static'} else {'shared'} + boost-download --cache $base_dir -- $version $boost_dir - boost-build --toolset $toolset --platform $platform --configuration $configuration -- $boost_dir $libraries + boost-build ` + --toolset $toolset ` + --platform $platform ` + --configuration $configuration ` + --link $link ` + --runtime-link $runtime_link ` + -- ` + $boost_dir ` + $libraries $platformdir = $platform if ($platformdir -eq 'auto' -and $windows_host) { -- cgit v1.2.3