Skip to content

Commit

Permalink
fmt: add header-only option to make it truly header-only
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored and jpakkane committed Jan 4, 2025
1 parent a960bb0 commit 56ccc01
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@
"fmt"
],
"versions": [
"11.1.1-2",
"11.1.1-1",
"11.0.2-1",
"11.0.1-1",
Expand Down
27 changes: 17 additions & 10 deletions subprojects/packagefiles/fmt/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,24 @@ if get_option('default_library') == 'shared'
fmt_interface_cpp_args += ['-DFMT_SHARED']
endif

header_only = get_option('header-only')

fmt_lib = library(
'fmt',
'src/format.cc',
'src/os.cc',
cpp_args: fmt_private_cpp_args,
include_directories: 'include',
install: true,
build_by_default: not header_only,
install: not header_only,
)

install_subdir('include',
strip_directory: true,
install_dir: get_option('includedir'),
)
if not header_only
install_subdir('include',
strip_directory: true,
install_dir: get_option('includedir'),
)
endif

fmt_dep = declare_dependency(
include_directories: 'include',
Expand All @@ -36,8 +41,10 @@ fmt_header_only_dep = declare_dependency(
compile_args: '-DFMT_HEADER_ONLY',
)

pkg_mod = import('pkgconfig')
pkg_mod.generate(fmt_lib,
name: 'fmt',
filebase: 'fmt',
)
if not header_only
pkg_mod = import('pkgconfig')
pkg_mod.generate(fmt_lib,
name: 'fmt',
filebase: 'fmt',
)
endif
6 changes: 6 additions & 0 deletions subprojects/packagefiles/fmt/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
option(
'header-only',
type: 'boolean',
value: false,
description: 'enable header only mode and disable build for libfmt',
)

0 comments on commit 56ccc01

Please sign in to comment.