Skip to content

Commit

Permalink
Cleanup Meson a bit (#602)
Browse files Browse the repository at this point in the history
Makes a few pieces more consistent, removes some oddities, uses some
better patterns.

Signed-off-by: Tristan Partin <tpartin@micron.com>
  • Loading branch information
tristan957 authored Feb 8, 2023
1 parent e7e3225 commit 152aa8e
Show file tree
Hide file tree
Showing 47 changed files with 167 additions and 265 deletions.
51 changes: 1 addition & 50 deletions cli/lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,11 @@
#
# SPDX-FileCopyrightText: Copyright 2021 Micron Technology, Inc.

if not get_option('cli') and get_option('tools').disabled() and not get_option('tests')
libhse_cli_dep = disabler()
subdir_done()
endif

libcurl_dep = dependency(
'libcurl',
version: '>=7.58.0',
fallback: 'curl',
default_options: [
'default_library=static',
'warning_level=0',
'werror=false',
],
required: get_option('cli') or get_option('tools').enabled() or get_option('tests'),
disabler: true
)

libhse_cli_sources = files(
cli_sources = files(
'param.c',
'program.c',
'rest/api.c',
'rest/buffer.c',
'rest/client.c',
'tprint.c'
)

libhse_cli = static_library(
'hse-cli',
libhse_cli_sources,
c_args: cc_supported_arguments,
include_directories: [
cli_includes,
component_root_includes,
rest_includes,
# Remove util_includes when compiler.h moves around
util_includes,
],
dependencies: [
cjson_dep,
hse_error_dep,
libcurl_dep,
rbtree_dep,
],
gnu_symbol_visibility: 'hidden'
)

libhse_cli_dep = declare_dependency(
link_with: libhse_cli,
include_directories: [
cli_includes,
],
dependencies: [
hse_error_dep,
libcurl_dep,
]
)
90 changes: 63 additions & 27 deletions cli/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,102 @@
#
# SPDX-FileCopyrightText: Copyright 2020 Micron Technology, Inc.

if not get_option('cli') and get_option('tools').disabled() and not get_option('tests')
hse_cli_dep = disabler()
hse_exe = disabler()
hse_exe_symlink = disabler()
subdir_done()
endif

subdir('include')
subdir('lib')

hse_cli = static_library(
'@0@-cli'.format(meson.project_name()),
cli_sources,
c_args: cc_supported_arguments,
include_directories: [
cli_includes,
rest_includes,
# Remove util_includes when compiler.h moves around
util_includes,
],
dependencies: [
cjson_dep,
hse_error_dep,
libcurl_dep,
rbtree_dep,
],
gnu_symbol_visibility: 'hidden'
)

hse_cli_dep = declare_dependency(
link_with: hse_cli,
include_directories: [
cli_includes,
],
dependencies: [
hse_error_dep,
libcurl_dep,
]
)

if not get_option('cli')
hse_cli = disabler()
hse_cli_symlink = disabler()
hse_exe = disabler()
hse_exe_symlink = disabler()
subdir_done()
endif

cli_name = meson.project_name() + hse_major_version
exe_name = meson.project_name() + hse_major_version

hse_cli_sources = files(
exe_sources = files(
'cli_util.c',
'hse_cli.c',
'storage_info.c',
'storage_profile.c',
'storage_profile.c'
)

hse_cli_dependencies = [
hse_dep,
libhse_cli_dep,
hse_dependencies,
]

hse_cli_include_directories = [
component_root_includes,
util_includes,
]

hse_cli = executable(
cli_name,
hse_cli_sources,
hse_exe = executable(
exe_name,
exe_sources,
c_args: cc_supported_arguments,
include_directories: hse_cli_include_directories,
dependencies: hse_cli_dependencies,
include_directories: [
util_includes,
],
dependencies: [
cjson_dep,
hse_dep,
hse_cli_dep,
hse_pidfile_dep,
hse_logging_dep,
libbsd_dep,
threads_dep,
],
install: true,
install_rpath: rpath,
gnu_symbol_visibility: 'hidden',
)

hse_cli_symlink = custom_target(
'cli-symlink',
hse_exe_symlink = custom_target(
'hse',
build_by_default: true,
input: hse_cli,
input: hse_exe,
command: [
'ln',
'--force',
'--symbolic',
fs.name(hse_cli.full_path()),
fs.name(hse_exe.full_path()),
'@OUTPUT@',
],
output: meson.project_name(),
)

install_symlink(
meson.project_name(),
pointing_to: cli_name,
pointing_to: exe_name,
install_dir: get_option('bindir')
)

meson.override_find_program(cli_name, hse_cli)
meson.override_find_program(exe_name, hse_exe)

executable_paths += meson.current_build_dir()
6 changes: 3 additions & 3 deletions include/hse/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version_data = configuration_data({
version_h = configure_file(
input: 'version.h.in',
output: 'version.h',
configuration: version_data,
configuration: version_data
)

install_headers(
Expand All @@ -21,12 +21,12 @@ install_headers(
'hse.h',
'limits.h',
'types.h',
subdir: include_subdir,
subdir: include_subdir
)

if get_option('experimental')
install_headers(
'experimental.h',
subdir: include_subdir,
subdir: include_subdir
)
endif
2 changes: 1 addition & 1 deletion lib/binding/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ binding_sources = files(
'diag_kvdb_interface.c',
'hse_gparams.c',
'kvdb_interface.c',
'kvdb_perfc.c',
'kvdb_perfc.c'
)
4 changes: 1 addition & 3 deletions lib/c0/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ c0_sources = files(
'c0_kvset_iterator.c',
'c0sk.c',
'c0sk_internal.c',
'c0sk_perfc.c',
'c0sk_perfc.c'
)

c0_includes = include_directories('.')
2 changes: 0 additions & 2 deletions lib/cn/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ cn_sources = files(
'wbt_builder.c',
'wbt_reader.c'
)

cn_includes = include_directories('.')
4 changes: 1 addition & 3 deletions lib/cndb/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
cndb_sources = files(
'cndb.c',
'omf.c',
'txn.c',
'txn.c'
)

cndb_includes = include_directories('.')
1 change: 0 additions & 1 deletion lib/config/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ hse_config = static_library(
config_sources,
c_args: cc_supported_arguments,
include_directories: [
component_root_includes,
config_includes,
util_includes,
],
Expand Down
3 changes: 0 additions & 3 deletions lib/error/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ hse_error = static_library(
'@0@-error'.format(meson.project_name()),
error_sources,
include_directories: [
component_root_includes,
error_includes,
public_includes,
util_includes,
Expand All @@ -23,8 +22,6 @@ hse_error = static_library(
hse_error_dep = declare_dependency(
link_with: hse_error,
include_directories: [
# Exposes merr_t in a public header
component_root_includes,
error_includes,
public_includes,
# TODO: Remove when compiler.h moves around
Expand Down
4 changes: 1 addition & 3 deletions lib/kvdb/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ kvdb_sources = files(
'mclass_policy.c',
'sched_sts.c',
'throttle.c',
'viewset.c',
'viewset.c'
)

kvdb_includes = include_directories('.')
4 changes: 1 addition & 3 deletions lib/kvs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ kvs_sources = files(
'kvs_cursor.c',
'kvs_cparams.c',
'kvs_rparams.c',
'query_ctx.c',
'query_ctx.c'
)

kvs_includes = include_directories('.')
4 changes: 1 addition & 3 deletions lib/lc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@

lc_sources = files(
'lc.c',
'bonsai_iter.c',
'bonsai_iter.c'
)

lc_includes = include_directories('.')
Loading

0 comments on commit 152aa8e

Please sign in to comment.