Skip to content

Commit

Permalink
fix: build dynamic fmt lib on macOS only (in addition to the static…
Browse files Browse the repository at this point in the history
… lib)
  • Loading branch information
c-dilks committed Jan 13, 2024
1 parent 651e110 commit b8d256f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,24 @@ jobs:
runs-on: ${{ inputs.runner }}
steps:
- name: checkout fmt
if: ${{ inputs.runner != 'macos-latest' }} # FIXME
uses: actions/checkout@v4
with:
repository: fmtlib/fmt
ref: ${{ env.fmt_version }}
- name: build
if: ${{ inputs.runner != 'macos-latest' }} # FIXME
run: |
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=fmt -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build build -j2
cmake --install build
- run: brew install tree
if: ${{ inputs.runner == 'macos-latest' }}
- run: tree fmt
if: ${{ inputs.runner != 'macos-latest' }} # FIXME
- name: tar
if: ${{ inputs.runner != 'macos-latest' }} # FIXME
run: tar czvf fmt{.tar.gz,}
- uses: actions/upload-artifact@v3
if: ${{ inputs.runner != 'macos-latest' }} # FIXME
with:
name: build_deps
retention-days: 1
Expand All @@ -82,7 +85,7 @@ jobs:
- build_fmt
runs-on: ${{ inputs.runner }}
strategy:
fail-fast: true
fail-fast: false
matrix:
binding: [ cpp, python ]
include:
Expand Down Expand Up @@ -110,6 +113,8 @@ jobs:
uses: actions/download-artifact@v3
with:
name: build_deps
- run: brew install fmt
if: ${{ inputs.runner == 'macos-latest' }}
- name: untar build
run: ls *.tar.gz | xargs -I{} tar xzvf {}
- run: brew install tree
Expand Down Expand Up @@ -180,7 +185,7 @@ jobs:
- build_iguana
runs-on: ${{ inputs.runner }}
strategy:
fail-fast: true
fail-fast: false
matrix:
binding: [ cpp, python ]
include:
Expand All @@ -201,6 +206,8 @@ jobs:
uses: actions/download-artifact@v3
with:
name: build_deps
- run: brew install fmt
if: ${{ inputs.runner == 'macos-latest' }}
- name: get iguana build artifacts
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -236,7 +243,7 @@ jobs:
- build_iguana
runs-on: ${{ inputs.runner }}
strategy:
fail-fast: true
fail-fast: false
matrix:
tool: [ cmake, make, meson ]
steps:
Expand All @@ -245,6 +252,8 @@ jobs:
uses: actions/download-artifact@v3
with:
name: build_deps
- run: brew install fmt
if: ${{ inputs.runner == 'macos-latest' }}
- name: get iguana build artifacts
uses: actions/download-artifact@v3
with:
Expand Down
7 changes: 6 additions & 1 deletion doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ python -m pip install meson ninja
### :large_orange_diamond: `fmt`: C++ output formatting library
<https://github.com/fmtlib/fmt>
- likely available in your package manager, possibly under `libfmt`
- likely available in your package manager, likely as `fmt` or `libfmt`
> [!IMPORTANT]
> macOS users are _strongly_ encouraged to install this from Homebrew:
> ```bash
> brew install fmt
> ```
- if you compile it yourself, include the `cmake` option `-DCMAKE_POSITION_INDEPENDENT_CODE=ON`
- example `cmake` commands:
```bash
Expand Down
2 changes: 1 addition & 1 deletion examples/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ example_sources = [
'iguana-example-01-bank-rows.cc',
]

# add iguana libraries to rpath
# add dependencies' libraries to rpath
example_rpaths = [
hipo_dep.get_variable(pkgconfig: 'libdir'),
]
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ project(
project_description = 'Implementation Guardian of Analysis Algorithms'

# resolve dependencies
fmt_dep = dependency('fmt', version: '>=9.1.0', method: 'pkg-config')
fmt_dep = dependency('fmt', version: '>=9.1.0', method: 'pkg-config', static: true)
hipo_dep = dependency('hipo4', version: '>=4.0.1', method: 'pkg-config')

# list of dependencies
Expand Down

0 comments on commit b8d256f

Please sign in to comment.