Skip to content

Commit

Permalink
Add support for mingw (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusJx committed Dec 21, 2021
1 parent 2bf304a commit ade4124
Show file tree
Hide file tree
Showing 16 changed files with 1,458 additions and 456 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/test-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,46 @@ jobs:

strategy:
matrix:
os: [ubuntu-18.04, windows-2016]
include:
- os: ubuntu-20.04
COMPILER: gcc
PLATFORM: 20.04
- os: windows-2019
COMPILER: msvc
PLATFORM: 2019
- os: windows-2019
COMPILER: mingw
PLATFORM: 2019

steps:
- uses: actions/checkout@v2
- name: Install boost
uses: ./
id: install-boost
with:
boost_version: 1.73.0
boost_version: 1.78.0
platform_version: ${{matrix.PLATFORM}}
toolset: ${{matrix.COMPILER}}

- name: Setup MinGW
uses: egor-tensin/setup-mingw@v2
if: ${{runner.os == 'Windows' && matrix.COMPILER == 'mingw'}}

- name: Configure CMake mingw
shell: bash
working-directory: test
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBoost_LIBRARY_DIRS="${{steps.install-boost.outputs.BOOST_ROOT}}/lib" -G "MinGW Makefiles" -B build
if: ${{matrix.COMPILER == 'mingw'}}
env:
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}}

- name: Configure CMake
shell: bash
working-directory: test
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBoost_LIBRARY_DIRS="${{steps.install-boost.outputs.BOOST_ROOT}}/lib" -B build
if: ${{matrix.COMPILER != 'mingw'}}
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}}
- name: Build
working-directory: test/build
shell: bash
Expand Down
94 changes: 86 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ Install Boost in GitHub actions using prebuilt binaries.

### `boost_version`
**Required** The boost version to install, e.g. ``1.73.0``.
A list of supported versions can be found [here](https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json).
A list of supported versions can be found [here](https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json). If you need a specific (unlisted) version, open a new issue
[here](https://github.com/MarkusJx/prebuilt-boost), requesting the required version.

### `platform_version`
**Optional** The platform version of the system boost was compiled on, e.g. ``18.04`` for ``ubuntu-18.04``, ``2016`` for ``windows-2016`` or ``10.15`` for ``macos-10.15``.
Supported values are ``2016`` (windows, until boost v1.78.0), ``2019`` (windows), ``18.04`` (ubuntu),
``20.04`` (ubuntu), ``10.15`` (macOs), ``11`` (macOs). **You maybe want to set this as a version will**
**be selected at random if unset and [may cause issues](https://github.com/MarkusJx/install-boost/issues/7).**

### `boost_install_dir`
**Optional** The directory to install boost into. If specified, boost will be installed into
Expand All @@ -22,8 +26,13 @@ If the ``legacy`` version is used, the binaries are downloaded from [actions/boo
The list of supported toolsets and versions can be found [here](https://github.com/actions/boost-versions/blob/main/versions-manifest.json).

### `toolset`
**DEPRECATED Optional** A toolset used to compile boost, e.g. ``msvc14.2``. May only be used on windows, as the value on ubuntu is always ``gcc``.
Can only be specified when the ``legacy`` version is used.
**Optional** A toolset used to compile boost, e.g. ``msvc``.
May be one of ``msvc`` (windows), ``mingw`` (windows), ``gcc`` (linux) or ``clang`` (macOs).
**You maybe want to set this on windows as either ``mingw`` or ``msvc`` will be selected at random**
**which may cause your build to fail.**
Selecting this is only supported for boost versions ``1.78.0`` and higher with the new version of
this action or any version with the legacy versions. Please refer to the provided version manifests
for further information.

## Outputs
### `BOOST_ROOT`
Expand All @@ -42,7 +51,7 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
### Windows
```yml
- name: Install boost
uses: MarkusJx/install-boost@v2.0.0
uses: MarkusJx/install-boost@v2.1.0
id: install-boost
with:
# REQUIRED: Specify the required boost version
Expand All @@ -52,7 +61,9 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
# OPTIONAL: Specify a custon install location
boost_install_dir: C:\some_directory
# OPTIONAL: Specify a platform version
platform_version: 2016
platform_version: 2019
# OPTIONAL: Specify a toolset
toolset: msvc
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
Expand All @@ -61,7 +72,7 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
### Ubuntu
```yml
- name: Install boost
uses: MarkusJx/install-boost@v2.0.0
uses: MarkusJx/install-boost@v2.1.0
id: install-boost
with:
# REQUIRED: Specify the required boost version
Expand All @@ -72,6 +83,8 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
platform_version: 18.04
# OPTIONAL: Specify a custom install location
boost_install_dir: /home/runner/some_directory
# OPTIONAL: Specify a toolset
toolset: gcc
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
Expand All @@ -80,7 +93,7 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
### MacOs
```yml
- name: Install boost
uses: MarkusJx/install-boost@v2.0.0
uses: MarkusJx/install-boost@v2.1.0
id: install-boost
with:
# REQUIRED: Specify the required boost version
Expand All @@ -91,6 +104,8 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
platform_version: 10.15
# OPTIONAL: Specify a custom install location
boost_install_dir: /home/runner/some_directory
# OPTIONAL: Specify a toolset
toolset: clang
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
Expand Down Expand Up @@ -119,7 +134,7 @@ The version of boost installed, e.g. ``boost-1.73.0-linux-16.04``.
or
```yml
- name: Install boost
uses: MarkusJx/install-boost@v2.0.0
uses: MarkusJx/install-boost@v2.1.0
id: install-boost
with:
# REQUIRED: Specify the required boost version
Expand Down Expand Up @@ -155,3 +170,66 @@ or
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
```
## Caching
If you want to cache the boost versions to further accelerate your builds, you could use
``actions/cache`` to do that ([as seen here](https://github.com/MarkusJx/install-boost/issues/6)):
```yml
# Retrieve the cache, uses cache@v2
- name: Cache boost
uses: actions/cache@v2
id: cache-boost
with:
# Set the default path as the path to cache
path: ${{env.GITHUB_WORKSPACE}}/boost/boost
# Use the version as the key to only cache the correct version
key: boost-${{BOOST_VERSION}}
# Actual install step (only runs if the cache is empty)
- name: Install boost
if: steps.cache-boost.outputs.cache-hit != 'true'
uses: MarkusJx/install-boost@v2.1.0
with:
# Set the boost version (required)
boost_version: ${{BOOST_VERSION}}
```

or if you want to use custom paths for boost:
```yml
jobs:
build:
runs-on: windows-2019
env:
# Set your boost version
BOOST_VERSION: 1.78.0
# Set you boost path to the default one (I don't know if you can use variables here)
BOOST_PATH: ${{env.GITHUB_WORKSPACE}}/boost/boost
steps:
- uses: actions/checkout@v2
# Additional steps...
# Retrieve the cache, uses cache@v2
- name: Cache boost
uses: actions/cache@v2
id: cache-boost
with:
# Set the path to cache
path: ${{env.BOOST_PATH}}
# Use the version as the key to only cache the correct version
key: boost-${{env.BOOST_VERSION}}
# Actual install step (only runs if the cache is empty)
- name: Install boost
if: steps.cache-boost.outputs.cache-hit != 'true'
uses: MarkusJx/install-boost@v2.1.0
with:
# Set the boost version (required)
boost_version: ${{env.BOOST_VERSION}}
# Set the install directory
boost_install_dir: ${{env.BOOST_PATH}}
# Set your platform version
platform_version: 2019
# Set the toolset
toolset: msvc
```
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ inputs:
description: 'The boost version to install, e.g. "1.73.0"'
required: true
toolset:
description: 'The toolset used to compile boost, e.g. "msvc14.2". May only be used on windows'
description: 'The toolset used to compile boost, e.g. "msvc"'
required: false
default: ''
platform_version:
description: 'The platform version boost was compiled on, e.g. "18.04". May only be used on linux'
description: 'The platform version boost was compiled on, e.g. "18.04"'
required: false
default: ''
boost_install_dir:
Expand Down
Loading

0 comments on commit ade4124

Please sign in to comment.