Skip to content

Commit 0c00687

Browse files
Add Apache Avro wrap
1 parent 01d26cc commit 0c00687

File tree

5 files changed

+155
-0
lines changed

5 files changed

+155
-0
lines changed

releases.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,17 @@
233233
"0.4.1-1"
234234
]
235235
},
236+
"avro-cpp": {
237+
"dependency_names": [
238+
"avro-cpp"
239+
],
240+
"program_names": [
241+
"avrogencpp"
242+
],
243+
"versions": [
244+
"c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7-1"
245+
]
246+
},
236247
"backward-cpp": {
237248
"dependency_names": [
238249
"backward-cpp",

subprojects/avro-cpp.wrap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[wrap-file]
2+
directory = avro-c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7
3+
source_url = https://github.com/apache/avro/archive/c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7.tar.gz
4+
source_filename = avro-c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7.tar.gz
5+
source_hash = 1b378724b56ef7c7269f3de300c9e5832579c7e0c857eb1de74453c07b88b401
6+
patch_directory = avro-cpp
7+
8+
[provide]
9+
dependency_names = avro-cpp
10+
program_names = avrogencpp
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
avro_flags = []
2+
avro_deps = []
3+
avro_public_deps = []
4+
5+
fmt_dep = dependency(
6+
'fmt',
7+
required: true,
8+
)
9+
avro_deps += fmt_dep
10+
avro_public_deps += fmt_dep
11+
12+
zlib_dep = dependency(
13+
'zlib',
14+
required: true,
15+
)
16+
avro_deps += zlib_dep
17+
18+
snappy_dep = dependency(
19+
'snappy',
20+
required: false,
21+
)
22+
if snappy_dep.found()
23+
avro_flags += '-DSNAPPY_CODEC_AVAILABLE'
24+
avro_deps += snappy_dep
25+
endif
26+
27+
zstd_dep = dependency(
28+
'libzstd',
29+
required: false,
30+
)
31+
if zstd_dep.found()
32+
avro_flags += '-DZSTD_CODEC_AVAILABLE'
33+
avro_deps += zstd_dep
34+
endif
35+
36+
# Set static and shared flags manually since Meson 1.3.0 is still too new
37+
avro_flags += '-DAVRO_SOURCE'
38+
if get_option('default_library') == 'shared'
39+
avro_flags += '-DAVRO_DYN_LINK'
40+
elif get_option('default_library') == 'both'
41+
error('Building both static and shared libraries is not possible')
42+
endif
43+
44+
avro_inc = include_directories('include/avro')
45+
46+
avro_src = files(
47+
'impl/BinaryDecoder.cc',
48+
'impl/BinaryEncoder.cc',
49+
'impl/Compiler.cc',
50+
'impl/CustomAttributes.cc',
51+
'impl/DataFile.cc',
52+
'impl/FileStream.cc',
53+
'impl/Generic.cc',
54+
'impl/GenericDatum.cc',
55+
'impl/LogicalType.cc',
56+
'impl/Node.cc',
57+
'impl/NodeImpl.cc',
58+
'impl/Resolver.cc',
59+
'impl/ResolverSchema.cc',
60+
'impl/Schema.cc',
61+
'impl/Stream.cc',
62+
'impl/Types.cc',
63+
'impl/ValidSchema.cc',
64+
'impl/Validator.cc',
65+
'impl/Zigzag.cc',
66+
'impl/json/JsonDom.cc',
67+
'impl/json/JsonIO.cc',
68+
'impl/parsing/JsonCodec.cc',
69+
'impl/parsing/ResolvingDecoder.cc',
70+
'impl/parsing/Symbol.cc',
71+
'impl/parsing/ValidatingCodec.cc',
72+
)
73+
74+
avro_lib = library(
75+
'avrocpp',
76+
sources: avro_src,
77+
include_directories: avro_inc,
78+
cpp_args: avro_flags,
79+
dependencies: avro_deps,
80+
version: meson.project_version(),
81+
install: true,
82+
)
83+
84+
install_subdir(
85+
'include/avro',
86+
install_dir: get_option('includedir'),
87+
install_tag: 'devel',
88+
)
89+
90+
avro_dep = declare_dependency(
91+
include_directories: avro_inc,
92+
link_with: avro_lib,
93+
dependencies: avro_public_deps,
94+
)
95+
meson.override_dependency('avro-cpp', avro_dep)
96+
97+
avro_requires = []
98+
foreach dep : avro_public_deps
99+
avro_requires += dep.name()
100+
endforeach
101+
import('pkgconfig').generate(
102+
avro_lib,
103+
name: meson.project_name(),
104+
description: 'C++ library for parsing Avro data',
105+
url: 'https://avro.apache.org/',
106+
requires: avro_requires,
107+
)
108+
109+
if get_option('build_executable')
110+
avrogencpp_exe = executable(
111+
'avrogencpp',
112+
sources: ['impl/avrogencpp.cc'],
113+
cpp_args: ['-DAVRO_VERSION="@0@"'.format(meson.project_version())],
114+
dependencies: avro_dep,
115+
install: true,
116+
install_tag: 'devel',
117+
)
118+
meson.override_find_program('avrogencpp', avrogencpp_exe)
119+
endif
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
project(
2+
'avro-cpp',
3+
'cpp',
4+
version: '1.12.99',
5+
license: 'Apache-2.0',
6+
default_options: ['cpp_std=c++17'],
7+
)
8+
9+
subdir('lang/c++')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
option(
2+
'build_executable',
3+
type: 'boolean',
4+
value: true,
5+
description: 'Build avrogencpp exectuable',
6+
)

0 commit comments

Comments
 (0)