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
7 changes: 5 additions & 2 deletions libnvme/internal/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ config_dep = declare_dependency(
include_directories : internal_incdir,
sources: config_h)

config_h_path = meson.current_build_dir() / 'config.h'
config_h_arg = [ '-include', config_h_path ]
if meson.version().version_compare('>=1.4.0')
config_h_path = config_h.full_path()
else
config_h_path = meson.current_build_dir() / 'config.h'
endif
3 changes: 3 additions & 0 deletions libnvme/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ conf.set(
description: 'Is network address and service translation available'
)

conf.set('NVME_HAVE_SENDFILE', cc.has_function('sendfile'))

threads_dep = dependency('threads', required: true)
dl_dep = dependency('dl', required: false)
conf.set(
Expand Down Expand Up @@ -293,6 +295,7 @@ incdir = include_directories(['.', 'ccan', 'src'])
################################################################################
subdir('internal')
subdir('ccan')
#subdir('tools')
subdir('src')
subdir('libnvme')
if get_option('tests')
Expand Down
58 changes: 58 additions & 0 deletions libnvme/src/generated/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of libnvme.
# Copyright (c) 2025, Dell Technologies Inc. or its subsidiaries.
#
# Authors: Martin Belanger <[email protected]>
#
# Run generate-accessors to generate the setter/getter functions.

# List of header files to parse for structs
headers_to_scan = [
'../nvme/private.h',
]

# Append full path to each member of headers_to_scan
headers_to_scan_full_path = []
foreach hdr : headers_to_scan
headers_to_scan_full_path += join_paths(meson.current_source_dir(), hdr)
endforeach

# Generate accessors.c and accessors.h
accessors_ch_custom_tgt = custom_target(
'accessors.[ch]',
input: headers_to_scan_full_path,
output: [
'accessors.h',
'accessors.c',
],
command: [
generate_accessors,
'--h-out', '@OUTPUT0@',
'--c-out', '@OUTPUT1@',
'--incl', join_paths(meson.current_source_dir(), 'structs-to-include.txt'),
'@INPUT@',
],
build_by_default: true,
install: true,
install_dir: [
'nvme', # Install @OUTPUT0@=='accessors.h' in this directory.
false, # Do not install @OUTPUT1@=='accessors.c'
],
install_mode: ['rw-r--r--', 0, 0],
)

generated_accessors_h = accessors_ch_custom_tgt[0]
generated_accessors_c = accessors_ch_custom_tgt[1]

if meson.version().version_compare('>=1.4.0')
generated_accessors_h_path = generated_accessors_h.full_path()
else
generated_accessors_h_path = meson.current_build_dir() / 'accessor.h'
endif

generated_accessors_dep = declare_dependency(
sources: [
accessors_ch_custom_tgt,
]
)
6 changes: 6 additions & 0 deletions libnvme/src/generated/structs-to-include.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nvme_path
nvme_ns
nvme_ctrl
nvme_subsystem
nvme_host
nvme_fabric_options
13 changes: 9 additions & 4 deletions libnvme/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ deps = [
libdbus_dep,
liburing_dep,
openssl_dep,
config_dep,
]

source_dir = meson.current_source_dir()
Expand All @@ -46,8 +47,10 @@ libnvme = library(
link_args: ['-Wl,--version-script=' + version_script_arg],
dependencies: deps,
link_depends: mapfile,
c_args: config_h_arg,
include_directories: [incdir, internal_incdir],
c_args: [
'-include', config_h_path,
],
include_directories: [incdir, ],
install: true,
link_with: libccan,
)
Expand Down Expand Up @@ -75,8 +78,10 @@ libnvme_test = library(
'nvme-test', # produces libnvme-test.so
sources,
dependencies: deps,
c_args: config_h_arg,
include_directories: [incdir, internal_incdir],
c_args: [
'-include', config_h_path,
],
include_directories: [incdir, ],
install: false,
link_with: libccan,
)
Expand Down
Loading