Skip to content

Commit

Permalink
Fix meson.build for header only install and add *.pc gen.
Browse files Browse the repository at this point in the history
    This project compiled by meson used to produce an empty .a file.
    This should not happen since lyra is pure header library.
    Now meson can correctly install these header files.
    Now lyra.pc file is automatically created by meson.

Co-authored-by: René Ferdinand Rivera Morell <[email protected]>
  • Loading branch information
wrvsrx and grafikrobot authored Feb 28, 2025
1 parent 3f48678 commit 286cc26
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
28 changes: 19 additions & 9 deletions data/build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,25 @@ $(lyra_headers_relative:J=$(meson_build_header_join_str))
"
]

inc_dir = [include_directories('include')]

lyra_lib = shared_library('lyra',
sources : src,
include_directories: inc_dir,
install: true,
install_dir : '/usr/lib')

lyra_dep = declare_dependency(include_directories: inc_dir, link_with: lyra_lib)
fs = import('fs')
foreach header : src
# use substring to drop `include/` prefix
install_headers(header, subdir : fs.parent(header.substring(8)))
endforeach

inc_dir = include_directories('include')

lyra_dep = declare_dependency(include_directories: inc_dir)

pkg = import('pkgconfig')
pkg.generate(
subdirs : 'lyra',
filebase : 'lyra',
version : meson.project_version(),
name : meson.project_name(),
description : 'A simple to use, composing, header only, command line arguments parser for C++ 11 and beyond.',
url: 'https://github.com/bfgroup/Lyra',
)
" ;

.meson_build_file = $(.meson_build_file:J=) ;
Expand Down
24 changes: 17 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,22 @@ src = [
'include/lyra/version.hpp'
]

inc_dir = [include_directories('include')]
fs = import('fs')
foreach header : src
# use substring to drop `include/` prefix
install_headers(header, subdir : fs.parent(header.substring(8)))
endforeach

lyra_lib = shared_library('lyra',
sources : src,
include_directories: inc_dir,
install: true,
install_dir : '/usr/lib')
inc_dir = include_directories('include')

lyra_dep = declare_dependency(include_directories: inc_dir, link_with: lyra_lib)
lyra_dep = declare_dependency(include_directories: inc_dir)

pkg = import('pkgconfig')
pkg.generate(
subdirs : 'lyra',
filebase : 'lyra',
version : meson.project_version(),
name : meson.project_name(),
description : 'A simple to use, composing, header only, command line arguments parser for C++ 11 and beyond.',
url: 'https://github.com/bfgroup/Lyra',
)

0 comments on commit 286cc26

Please sign in to comment.