Files
json-c/apps/meson.build
Tyler Erickson e3a33ae8ae make: Adding support for building json-c with meson
Adding meson build files for json-c that work similarly to the cmake build files.
Where it made sense, I reused existing cmake .h.in files or generated entirely from meson.
All tests were done with GCC and Clang in ubuntu 24.04, Windows using MSVC 2022 and Clang-cl from llvm's repo using version 21.1.3

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
2025-10-20 12:08:01 -06:00

28 lines
1000 B
Meson

appconf_data = configuration_data()
# Check for json_tokener_get_parse_end symbol
appconf_data.set('HAVE_JSON_TOKENER_GET_PARSE_END',
cc.has_function('json_tokener_get_parse_end', prefix: '#include <json_tokener.h>') ? 1 : 0
)
# Check for getrusage if sys/resource.h is available
appconf_data.set('HAVE_SYS_RESOURCE_H', cc.has_header('sys/resource.h') ? 1 : 0, description: 'Define to 1 if you have the <sys/resource.h> header file.')
if appconf_data.get('HAVE_SYS_RESOURCE_H') == 1
appconf_data.set('HAVE_GETRUSAGE',
cc.has_function('getrusage', prefix: '#include <sys/resource.h>') ? 1 : 0, description: 'Define if you have the `getrusage` function. ')
else
appconf_data.set('HAVE_GETRUSAGE', 0, description: 'Define if you have the `getrusage` function. ')
endif
# Generate apps_config.h
configure_file(
output: 'apps_config.h',
configuration: appconf_data
)
# Build json_parse executable
executable('json_parse', 'json_parse.c',
dependencies: [jsonc_dep],
install: false
)