Skip to content

Commit 89395e7

Browse files
Add Apache Avro wrap
1 parent 9740035 commit 89395e7

File tree

5 files changed

+143
-0
lines changed

5 files changed

+143
-0
lines changed

releases.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,17 @@
232232
"0.4.1-1"
233233
]
234234
},
235+
"avro-cpp": {
236+
"dependency_names": [
237+
"avro-cpp"
238+
],
239+
"program_names": [
240+
"avrogencpp"
241+
],
242+
"versions": [
243+
"557891c38c6c90eeaa43f1cb78ae8c3ae088009f-1"
244+
]
245+
},
235246
"backward-cpp": {
236247
"dependency_names": [
237248
"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-557891c38c6c90eeaa43f1cb78ae8c3ae088009f
3+
source_url = https://github.com/apache/avro/archive/557891c38c6c90eeaa43f1cb78ae8c3ae088009f.tar.gz
4+
source_filename = avro-557891c38c6c90eeaa43f1cb78ae8c3ae088009f.tar.gz
5+
source_hash = c75198e925c95719cdb8346445fc4571f0101ed31f6a422ccf831dc52ffc4987
6+
patch_directory = avro-cpp
7+
8+
[provide]
9+
dependency_names = avro-cpp
10+
program_names = avrogencpp
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
if get_option('build_executable')
98+
avrogencpp_exe = executable(
99+
'avrogencpp',
100+
sources: ['impl/avrogencpp.cc'],
101+
cpp_args: ['-DAVRO_VERSION="@0@"'.format(meson.project_version())],
102+
dependencies: avro_dep,
103+
install: true,
104+
install_tag: 'devel',
105+
)
106+
meson.override_find_program('avrogencpp', avrogencpp_exe)
107+
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: 'undefined',
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)