1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
install_header_subdir = join_paths(json_api_name, 'json-glib')
install_header_dir = join_paths(json_includedir, install_header_subdir)
configure_file(output: 'config.h', configuration: cdata)
source_h = [
'json-builder.h',
'json-generator.h',
'json-gobject.h',
'json-gvariant.h',
'json-parser.h',
'json-path.h',
'json-reader.h',
'json-types.h',
'json-utils.h',
'json-version-macros.h'
]
json_glib_enums = gnome.mkenums(
'json-enum-types',
sources: source_h,
h_template: 'json-enum-types.h.in',
c_template: 'json-enum-types.c.in',
install_header: true,
install_dir: install_header_dir,
)
# Keep a reference to the generated header, for internal dependencies
json_enum_types_h = json_glib_enums.get(1)
source_c = [
'json-array.c',
'json-builder.c',
'json-debug.c',
'json-gboxed.c',
'json-generator.c',
'json-gobject.c',
'json-gvariant.c',
'json-node.c',
'json-object.c',
'json-parser.c',
'json-path.c',
'json-reader.c',
'json-scanner.c',
'json-serializable.c',
'json-utils.c',
'json-value.c',
]
version_data = configuration_data()
version_data.set('JSON_MAJOR_VERSION', json_version_major)
version_data.set('JSON_MINOR_VERSION', json_version_minor)
version_data.set('JSON_MICRO_VERSION', json_version_micro)
version_data.set('JSON_VERSION', meson.project_version())
json_version_h = configure_file(
input: 'json-version.h.in',
output: 'json-version.h',
configuration: version_data,
install_dir: install_header_dir,
)
install_headers(source_h + [ 'json-glib.h', ], subdir: install_header_subdir)
json_c_args = [
'-DG_LOG_DOMAIN="Json"',
'-DG_LOG_USE_STRUCTURED=1',
'-DJSON_COMPILATION',
'-DJSON_LOCALEDIR="@0@"'.format(json_localedir)
]
json_lib = library(
json_api_name,
source_c + json_glib_enums,
version: libversion,
soversion: soversion,
include_directories: root_dir,
dependencies: [gio_dep],
c_args: json_c_args + common_cflags,
link_args: common_ldflags,
darwin_versions: darwin_versions,
install: true,
)
pkgg = import('pkgconfig')
pkgg.generate(
libraries: json_lib,
subdirs: json_api_name,
version: json_version,
name: 'JSON-GLib',
filebase: json_api_name,
description: 'JSON Parser for GLib.',
requires: 'gio-2.0',
)
gir = find_program('g-ir-scanner', required : get_option('introspection'))
if gir.found()
gir_args = [
'--quiet',
'--warn-all',
'-DJSON_COMPILATION',
]
json_glib_gir = gnome.generate_gir(
json_lib,
sources: source_c + source_h + json_glib_enums + [ json_version_h ],
namespace: 'Json',
nsversion: json_api_version,
identifier_prefix: 'Json',
symbol_prefix: 'json',
export_packages: json_api_name,
includes: [ 'GObject-2.0', 'Gio-2.0', ],
header: 'json-glib/json-glib.h',
install: true,
extra_args: gir_args,
fatal_warnings: true,
)
else
json_glib_gir = []
endif
json_glib_dep = declare_dependency(
link_with: json_lib,
include_directories: root_dir,
dependencies: [gio_dep],
sources: [ json_enum_types_h, json_glib_gir ],
)
tools = [
[ 'json-glib-validate', [ 'json-glib-validate.c', ] ],
[ 'json-glib-format', [ 'json-glib-format.c', ] ],
]
foreach t: tools
bin_name = t[0]
bin_sources = t[1]
executable(bin_name, bin_sources,
c_args: json_c_args,
dependencies: json_glib_dep,
install: true)
endforeach
if get_option('tests')
subdir('tests')
endif
|