Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ tests/nvmetests
tests/*.pyc

.build
.build-ci
.cache
10 changes: 7 additions & 3 deletions ccan/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ sources = [
]

if get_option('buildtype') == 'debug'
add_project_arguments('-DCCAN_LIST_DEBUG=1', language : ['c'])
add_project_arguments('-DCCAN_STR_DEBUG=1', language : ['c'])
add_project_arguments('-DCCAN_LIST_DEBUG=1', language: ['c'])
add_project_arguments('-DCCAN_STR_DEBUG=1', language: ['c'])
endif

libccan = static_library(
'ccan',
sources,
install: false,
include_directories: [incdir, ],
dependencies: [config_dep, ],
)

ccan_dep = declare_dependency(
include_directories: '.',
link_with: libccan,
)
58 changes: 42 additions & 16 deletions libnvme/examples/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,83 @@
executable(
'telemetry-listen',
['telemetry-listen.c'],
dependencies: [libnvme_dep, config_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'display-columnar',
['display-columnar.c'],
dependencies: [libnvme_dep, config_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'display-tree',
['display-tree.c'],
dependencies: [libnvme_dep, config_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'discover-loop',
['discover-loop.c'],
dependencies: [libnvme_dep, config_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'mi-mctp',
['mi-mctp.c'],
dependencies: [libnvme_dep, config_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'mi-mctp-csi-test',
['mi-mctp-csi-test.c'],
dependencies: [libnvme_dep, config_dep, threads_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
threads_dep,
],
)

executable(
'mi-mctp-ae',
['mi-mctp-ae.c'],
dependencies: [libnvme_dep, config_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

if libdbus_dep.found()
executable(
'mi-conf',
['mi-conf.c'],
dependencies: [libnvme_dep, config_dep, libdbus_dep],
include_directories: [incdir, ]
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
libdbus_dep,
],
)
endif
15 changes: 6 additions & 9 deletions libnvme/libnvme/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,10 @@ if want_python
nvme_py = pymod_swig[0]
nvme_wrap_c = pymod_swig[1]

if meson.version().version_compare('>=1.4.0')
nvme_py_path = nvme_py.full_path()
else
nvme_py_path = meson.current_build_dir() / 'nvme.py'
endif

pynvme_clib = python3.extension_module(
'_nvme',
nvme_wrap_c,
dependencies : [libnvme_dep, py3_dep, config_dep],
include_directories: [incdir, ],
link_with: [libccan],
dependencies: [config_dep, ccan_dep, libnvme_dep, py3_dep],
install: true,
subdir: 'libnvme',
)
Expand All @@ -47,6 +39,11 @@ if want_python
# python nvme.py module using this dependency. This basically sets the
# variable "nvme_py_path" to the full path of the nvme.py file that
# was built by SWIG above.
if meson.version().version_compare('>=1.4.0')
nvme_py_path = nvme_py.full_path()
else
nvme_py_path = meson.current_build_dir() / 'nvme.py'
endif
python3_libnvme_dep = declare_dependency(
sources: nvme_py,
variables: {
Expand Down
25 changes: 21 additions & 4 deletions libnvme/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Authors: Martin Belanger <[email protected]>
#
if want_libnvme
if openssl_dep.found() and meson.can_run_host_binaries()
if openssl_dep.found() and meson.can_run_host_binaries()
if openssl_dep.type_name() != 'internal'
# Check for a bug in the EVP_PKEY_CTX_add1_hkdf_info implementation
res = cc.run(
Expand All @@ -22,14 +22,14 @@ if openssl_dep.found() and meson.can_run_host_binaries()
endif
endif

################################################################################
############################################################################
configure_file(
input: 'libnvme.spec.in',
output: 'libnvme.spec',
configuration: substs,
)

################################################################################
############################################################################
subdir('src') # declares: libnvme_dep
subdir('libnvme')
if get_option('tests')
Expand All @@ -40,6 +40,23 @@ if openssl_dep.found() and meson.can_run_host_binaries()
endif
subdir('doc')
else
libnvme_dep = dependency('libnvme', required: want_nvme)
# Fallback to using a pre-installed libnvme (if available)
if std_prefix
# When prefix points to a standard location, meson can use
# standard methods (e.g. pkg-config) to find the library.
libnvme_dep = dependency(
'libnvme',
version: '>=@0@'.format(libnvme_so_version),
required: want_nvme,
)
else
# When prefix points to a non-standard location
# let's ask the C compiler to find the library for us.
libnvme_dep = cc.find_library(
'nvme',
dirs: prefixdir / get_option('libdir'),
required: want_nvme,
)
endif
endif

21 changes: 12 additions & 9 deletions libnvme/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,39 @@ else
sources += 'nvme/no-json.c'
endif

# Generate accessors (setter/getter functions)
subdir('nvme') # declares: accessors_dep, accessors_ld_full_path

deps = [
config_dep,
ccan_dep,
json_c_dep,
keyutils_dep,
libdbus_dep,
liburing_dep,
openssl_dep,
accessors_dep,
]

source_dir = meson.current_source_dir()
mapfile = 'libnvme.map'
version_script_arg = join_paths(source_dir, mapfile)

libnvme = library(
'nvme', # produces libnvme.so
sources,
version: libnvme_so_version,
link_args: ['-Wl,--version-script=' + version_script_arg],
link_args: [
'-Wl,--version-script=@0@'.format(meson.current_source_dir() / mapfile),
'-Wl,--version-script=@0@'.format(accessors_ld_full_path),
],
dependencies: deps,
link_depends: mapfile,
include_directories: [incdir, ],
install: true,
link_with: libccan,
)

pkg = import('pkgconfig')
pkg.generate(libnvme,
filebase: 'libnvme',
name: 'libnvme',
version: meson.project_version(),
version: libnvme_so_version,
description: 'Manage "libnvme" subsystem devices (Non-volatile Memory Express)',
url: 'https://github.com/linux-nvme/nvme-cli/',
)
Expand All @@ -66,6 +69,7 @@ libnvme_dep = declare_dependency(
json_c_dep.partial_dependency(compile_args: true, includes: true),
],
link_with: libnvme,
include_directories: '.',
)

# test library with all symbols visible, to use for MI unit tests. Should
Expand All @@ -74,13 +78,12 @@ libnvme_test = library(
'nvme-test', # produces libnvme-test.so
sources,
dependencies: deps,
include_directories: [incdir, ],
install: false,
link_with: libccan,
)

libnvme_test_dep = declare_dependency(
link_with: libnvme_test,
include_directories: '.',
)

mode = 'rw-r--r--'
Expand Down
Loading
Loading