From b8d256fc50554e8258e5d6670f7cc65bfaf09bd0 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Fri, 12 Jan 2024 21:08:14 -0500 Subject: [PATCH] fix: build dynamic `fmt` lib on macOS only (in addition to the static lib) --- .github/workflows/ci.yml | 19 ++++++++++++++----- doc/setup.md | 7 ++++++- examples/meson.build | 2 +- meson.build | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c10299d8..0cca7554 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -82,7 +85,7 @@ jobs: - build_fmt runs-on: ${{ inputs.runner }} strategy: - fail-fast: true + fail-fast: false matrix: binding: [ cpp, python ] include: @@ -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 @@ -180,7 +185,7 @@ jobs: - build_iguana runs-on: ${{ inputs.runner }} strategy: - fail-fast: true + fail-fast: false matrix: binding: [ cpp, python ] include: @@ -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: @@ -236,7 +243,7 @@ jobs: - build_iguana runs-on: ${{ inputs.runner }} strategy: - fail-fast: true + fail-fast: false matrix: tool: [ cmake, make, meson ] steps: @@ -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: diff --git a/doc/setup.md b/doc/setup.md index fd8f2789..5d51af01 100644 --- a/doc/setup.md +++ b/doc/setup.md @@ -26,7 +26,12 @@ python -m pip install meson ninja ### :large_orange_diamond: `fmt`: C++ output formatting library -- 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 diff --git a/examples/meson.build b/examples/meson.build index 2cf35e98..730361a6 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -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'), ] diff --git a/meson.build b/meson.build index abb86d77..d6b61c9a 100644 --- a/meson.build +++ b/meson.build @@ -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