aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/README.md
blob: f672661938032b7dfba114d54c16b337376e9fa3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Build Boost
===========

[![Test](https://github.com/egor-tensin/build-boost/actions/workflows/test.yml/badge.svg)](https://github.com/egor-tensin/build-boost/actions/workflows/test.yml)

This GitHub action downloads & builds Boost libraries in your workflow run.

* Downloads a distribution of the specified Boost version and unpacks it.
* Builds the required libraries using the specified toolset.

Use it in your workflow like this:

    - name: Build Boost
      uses: egor-tensin/build-boost@v1
      with:
        version: 1.71.0
        libraries: filesystem program_options system
        platform: x64
        configuration: Release

* GCC is used by default on Linux; on Windows, it's MSVC.
Specify the `toolset` parameter to use a different toolset.
* `x64` is the default value for the `platform` parameter and can be omitted.
Use `x86` if you want to build 32-bit binaries.
* `Release` is the default value for the `configuration` parameter and can be
omitted.
Use `Debug` if you want to build debug binaries.
* Set `static` to `1` if you want to build static libraries.
* Set `static-runtime` to `1` if you want to link to the static runtime.

[cmake-common]: https://github.com/egor-tensin/cmake-common

API
---

| Input          | Value        | Default | Description
| -------------- | ------------ | ------- | -----------
| version        | **required** |         | Boost version to build, e.g. `1.71.0`.
| libraries      | **required** |         | Space-separated list of libraries to build, e.g. `filesystem program_options system`.
| toolset        | auto         | ✓       | Use GCC on Linux and MSVC on Windows.
|                | msvc         |         | Use MSVC.
|                | gcc          |         | Use GCC.
|                | mingw        |         | Use MinGW-w64.
|                | clang        |         | Use Clang.
| platform       | x64          | ✓       | Build 64-bit binaries.
|                | x86          |         | Build 32-bit binaries.
| configuration  | Release      | ✓       | Build Release binaries.
|                | Debug        |         | Build Debug binaries.
| static         | *other*      | ✓       | Shared libraries.
|                | 1            |         | Static libraries.
| static-runtime | *other*      | ✓       | Link to the shared runtime.
|                | 1            |         | Link to the static runtime.
| directory      | *empty*      | ✓       | Build in `${{ runner.workspace }}/boost`.
|                | *other*      |         | Build in a custom directory.

| Output     | Example                                | CMake name       | Description
| ---------- | -------------------------------------- | ---------------- | -----------
| root       | D:\a\project\boost                     | BOOST_ROOT       | Root Boost directory.
| librarydir | D:\a\project\boost\stage\x64\Debug\lib | BOOST_LIBRARYDIR | Directory that contains the built libraries.

Use the `librarydir` output to locate the built libraries.
You can pass it to CMake using the `BOOST_LIBRARYDIR` parameter:

    > cmake \
        -D "BOOST_ROOT=${{ steps.boost.outputs.root }}" \
        -D "BOOST_LIBRARYDIR=${{ steps.boost.outputs.librarydir }}" \
        ...

Notes
-----

* This action uses my other project [cmake-common] to actually download and
build Boost.
* [cmake-common] sees *a lot* more testing than this action, while this action
delegates almost everything to it.
* You can use my other actions [setup-gcc], [setup-mingw], [setup-clang] to set
up different toolsets targetting both x86 and x64.

[setup-gcc]: https://github.com/egor-tensin/setup-gcc
[setup-mingw]: https://github.com/egor-tensin/setup-mingw
[setup-clang]: https://github.com/egor-tensin/setup-clang

License
-------

Distributed under the MIT License.
See [LICENSE.txt] for details.

[LICENSE.txt]: LICENSE.txt