Skip to content

Commit

Permalink
[#3730] Update meson.build
Browse files Browse the repository at this point in the history
  • Loading branch information
fxdupont authored and andrei-pavel committed Feb 21, 2025
1 parent a4f48dc commit 8057117
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 80 deletions.
2 changes: 1 addition & 1 deletion doc/devel/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ configure_file(
configuration: make_devel_conf_data,
)
make_devel = f'@current_build_dir@/make-devel.sh'
MAKE_DEVEL = run_target('make-devel', command: [CD_AND_RUN, current_source_dir, make_devel])
run_target('devel', command: [CD_AND_RUN, current_source_dir, make_devel])
2 changes: 1 addition & 1 deletion doc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ make_grammar = configure_file(
output: 'make-grammar.sh',
configuration: {'TOP_SOURCE_DIR': TOP_SOURCE_DIR},
)
MAKE_GRAMMAR = run_target('make-grammar', command: [make_grammar])
run_target('grammar', command: [make_grammar])
12 changes: 7 additions & 5 deletions doc/sphinx/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,13 @@ mandir = get_option('mandir')
mandir8 = f'@PREFIX@/@mandir@/man8/'
make_conf_data.set('mandir8', mandir8)

MAKE_DOC = disabler()
if sphinx_exe.found()
make_doc = configure_file(
input: 'make-doc.sh.in',
output: 'make-doc.sh',
configuration: make_conf_data,
)
MAKE_DOC = run_target('make-doc', command: [make_doc])
run_target('doc', command: [make_doc])
endif
make_install = configure_file(
input: 'make-install.sh.in',
Expand All @@ -149,7 +148,10 @@ make_update_python_dependencies = configure_file(
output: 'make-update-python-dependencies.sh',
configuration: make_conf_data,
)
run_target('mes-doc', command: [make_mes_doc])
run_target('uml', command: [make_uml])
run_target(
'update-python-dependencies',
command: [make_update_python_dependencies],
)
meson.add_install_script(make_install)
MAKE_MES_DOC = run_target('make-mes-doc', command: [make_mes_doc])
MAKE_UML = run_target('make-uml', command: [make_uml])
MAKE_UPDATE_PYTHON_DEPENDENCIES = run_target('make-update-python-dependencies', command: [make_update_python_dependencies])
151 changes: 78 additions & 73 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ xmllint_exe = find_program('xmllint', required: false)
pip_compile_exe = find_program('pip-compile', required: false)
install_exe = find_program('install', required: true)
valgrind_exe = find_program('valgrind', required: false)
cppcheck_exe = find_program('cppcheck', required: false)
cppcheck_htmlreport_exe = find_program('cppcheck-htmlreport', required: false)

if python_exe.found()
PYTHON = python_exe.full_path()
Expand Down Expand Up @@ -648,6 +650,69 @@ else
report_conf_data.set('GTEST_LIBDIR', 'unknown')
endif

#### Custom Targets

run_target(
'add-changelog-entry',
command: [f'@TOP_SOURCE_DIR@/changelog_unreleased/.add-entry.sh'],
)

# todo: remove redirections
if cppcheck_exe.found()
run_target(
'cppcheck',
command: [
cppcheck_exe,
'-I.',
'-I./src/lib',
'-I./src/bin',
'--error-exitcode=1',
'--inline-suppr',
'--quiet',
'--max-configs=256',
f'--suppressions-list=@TOP_SOURCE_DIR@/src/cppcheck-suppress.lst',
'--template={file}:{line}: check_fail: {message} ({severity},{id})',
'--xml',
'--xml-version=2',
'.',
'>',
'cppcheck-result.xml',
'2>&1',
],
)
endif

if cppcheck_htmlreport_exe.found()
run_target(
'cppcheck-report',
command: [
cppcheck_htmlreport_exe,
'--file',
'./cppcheck-result.xml',
'--report-dir',
'./report',
'--title',
'"cppcheck report"',
],
)
endif

if valgrind_exe.found()
add_test_setup(
'valgrind',
exe_wrapper: [
valgrind_exe,
'--child-silent-after-fork=yes',
'--fullpath-after=',
'--leak-check=full',
'--num-callers=64',
'--quiet',
'--show-leak-kinds=all',
'--suppressions=src/valgrind.supp',
],
)
endif

#### Configuration Files

config_report_sh = configure_file(
Expand All @@ -656,6 +721,12 @@ config_report_sh = configure_file(
configuration: report_conf_data,
)

CONFIG_REPORT = custom_target(
output: 'config.report',
depend_files: [config_report_sh],
command: [f'@TOP_BUILD_DIR@/config-report.sh'],
)

# TODO: Change to config.h.in when autotools are removed.
configure_file(
input: 'meson-config.h.in',
Expand All @@ -674,68 +745,6 @@ configure_file(
install_dir: 'include/kea',
)

#### Custom Targets

run_target(
'add-changelog-entry',
command: ['changelog_unreleased/.add-entry.sh'],
)

CONFIG_REPORT = custom_target(
output: 'config.report',
depend_files: [config_report_sh],
command: [f'@TOP_BUILD_DIR@/config-report.sh'],
)

run_target(
'cppcheck',
command: [
'cppcheck',
'-I.',
'-I./src/lib',
'-I./src/bin',
'--error-exitcode=1',
'--inline-suppr',
'--quiet',
'--max-configs=256',
f'--suppressions-list=@TOP_SOURCE_DIR@/src/cppcheck-suppress.lst',
'--template={file}:{line}: check_fail: {message} ({severity},{id})',
'--xml',
'--xml-version=2',
'.',
'>',
'cppcheck-result.xml',
'2>&1',
],
)

run_target(
'cppcheck-report',
command: [
'cppcheck-htmlreport',
'--file',
'./cppcheck-result.xml',
'--report-dir',
'./report',
'--title',
'"cppcheck report"',
],
)

add_test_setup(
'valgrind',
exe_wrapper: [
valgrind_exe,
'--child-silent-after-fork=yes',
'--fullpath-after=',
'--leak-check=full',
'--num-callers=64',
'--quiet',
'--show-leak-kinds=all',
'--suppressions=src/valgrind.supp',
],
)

#### Build Starts Here

LIBS_BUILT_SO_FAR = []
Expand All @@ -749,6 +758,13 @@ if have_premium
subdir('premium')
endif

#### More Custom Targets

alias_target('messages', TARGETS_GEN_MESSAGES)
alias_target('parser', TARGETS_GEN_PARSER)

#### Installation

top_docs = [
'AUTHORS',
'CONTRIBUTING.md',
Expand All @@ -761,14 +777,3 @@ top_docs = [
]
install_data(top_docs, install_dir: 'share/doc/kea')
install_emptydir('var/run/kea')

#### More Custom Targets

alias_target('doc', MAKE_DOC)
alias_target('devel', MAKE_DEVEL)
alias_target('grammar', MAKE_GRAMMAR)
alias_target('messages', TARGETS_GEN_MESSAGES)
alias_target('mes-doc', MAKE_MES_DOC)
alias_target('parser', TARGETS_GEN_PARSER)
alias_target('uml', MAKE_UML)
alias_target('update-python-dependencies', MAKE_UPDATE_PYTHON_DEPENDENCIES)

0 comments on commit 8057117

Please sign in to comment.