mirror of
https://gitlab.freedesktop.org/emersion/libdisplay-info.git
synced 2025-01-13 20:01:23 +01:00
f0e5199b50
For now it only prints the JSON representation of the information exposed by libdisplay-info. A JSON schema [1] and libjsonschema [2] are used to encode JSON. [1]: https://json-schema.org/ [2]: https://sr.ht/~emersion/libjsonschema/ Signed-off-by: Simon Ser <contact@emersion.fr>
40 lines
933 B
Meson
40 lines
933 B
Meson
libjsonschema = dependency('libjsonschema')
|
|
libjsonschema_native = dependency('libjsonschema', native: true)
|
|
libjsonschema_tool_path = libjsonschema_native.get_variable(pkgconfig: 'tool', internal: 'tool')
|
|
libjsonschema_tool = find_program(libjsonschema_tool_path, native: true)
|
|
|
|
schema = files('schema.json')
|
|
|
|
schema_header = custom_target(
|
|
'schema.h',
|
|
command: [libjsonschema_tool, 'gen-header', '@INPUT@'],
|
|
input: schema,
|
|
output: 'schema.h',
|
|
capture: true,
|
|
)
|
|
|
|
schema_code = custom_target(
|
|
'schema.c',
|
|
command: [libjsonschema_tool, 'gen-code', '@INPUT@'],
|
|
input: schema,
|
|
output: 'schema.c',
|
|
capture: true,
|
|
)
|
|
|
|
schema_lib = static_library(
|
|
'schema',
|
|
schema_code,
|
|
c_args: cc.get_supported_arguments(['-Wno-declaration-after-statement']),
|
|
dependencies: libjsonschema,
|
|
)
|
|
|
|
executable(
|
|
'libdisplay-info',
|
|
[
|
|
'main.c',
|
|
schema_header,
|
|
],
|
|
dependencies: [di_dep, libjsonschema],
|
|
link_with: schema_lib,
|
|
install: true,
|
|
)
|