Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@
"0.4.1-1"
]
},
"avro-cpp": {
"dependency_names": [
"avro-cpp"
],
"program_names": [
"avrogencpp"
],
"versions": [
"c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7-1"
]
},
"backward-cpp": {
"dependency_names": [
"backward-cpp",
Expand Down
10 changes: 10 additions & 0 deletions subprojects/avro-cpp.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[wrap-file]
directory = avro-c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7
source_url = https://github.com/apache/avro/archive/c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7.tar.gz
source_filename = avro-c53857b8c9694c2f9b8cb071dd2ef617d5cda8b7.tar.gz
source_hash = 1b378724b56ef7c7269f3de300c9e5832579c7e0c857eb1de74453c07b88b401
patch_directory = avro-cpp

[provide]
dependency_names = avro-cpp
program_names = avrogencpp
119 changes: 119 additions & 0 deletions subprojects/packagefiles/avro-cpp/lang/c++/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
avro_flags = []
avro_deps = []
avro_public_deps = []

fmt_dep = dependency(
'fmt',
required: true,
)
avro_deps += fmt_dep
avro_public_deps += fmt_dep

zlib_dep = dependency(
'zlib',
required: true,
)
avro_deps += zlib_dep

snappy_dep = dependency(
'snappy',
required: false,
)
if snappy_dep.found()
avro_flags += '-DSNAPPY_CODEC_AVAILABLE'
avro_deps += snappy_dep
endif

zstd_dep = dependency(
'libzstd',
required: false,
)
if zstd_dep.found()
avro_flags += '-DZSTD_CODEC_AVAILABLE'
avro_deps += zstd_dep
endif

# Set static and shared flags manually since Meson 1.3.0 is still too new
avro_flags += '-DAVRO_SOURCE'
if get_option('default_library') == 'shared'
avro_flags += '-DAVRO_DYN_LINK'
elif get_option('default_library') == 'both'
error('Building both static and shared libraries is not possible')
endif

avro_inc = include_directories('include/avro')

avro_src = files(
'impl/BinaryDecoder.cc',
'impl/BinaryEncoder.cc',
'impl/Compiler.cc',
'impl/CustomAttributes.cc',
'impl/DataFile.cc',
'impl/FileStream.cc',
'impl/Generic.cc',
'impl/GenericDatum.cc',
'impl/LogicalType.cc',
'impl/Node.cc',
'impl/NodeImpl.cc',
'impl/Resolver.cc',
'impl/ResolverSchema.cc',
'impl/Schema.cc',
'impl/Stream.cc',
'impl/Types.cc',
'impl/ValidSchema.cc',
'impl/Validator.cc',
'impl/Zigzag.cc',
'impl/json/JsonDom.cc',
'impl/json/JsonIO.cc',
'impl/parsing/JsonCodec.cc',
'impl/parsing/ResolvingDecoder.cc',
'impl/parsing/Symbol.cc',
'impl/parsing/ValidatingCodec.cc',
)

avro_lib = library(
'avrocpp',
sources: avro_src,
include_directories: avro_inc,
cpp_args: avro_flags,
dependencies: avro_deps,
version: meson.project_version(),
install: true,
)

install_subdir(
'include/avro',
install_dir: get_option('includedir'),
install_tag: 'devel',
)

avro_dep = declare_dependency(
include_directories: avro_inc,
link_with: avro_lib,
dependencies: avro_public_deps,
)
meson.override_dependency('avro-cpp', avro_dep)

avro_requires = []
foreach dep : avro_public_deps
avro_requires += dep.name()
endforeach
import('pkgconfig').generate(
avro_lib,
name: meson.project_name(),
description: 'C++ library for parsing Avro data',
url: 'https://avro.apache.org/',
requires: avro_requires,
)

if get_option('build_executable')
avrogencpp_exe = executable(
'avrogencpp',
sources: ['impl/avrogencpp.cc'],
cpp_args: ['-DAVRO_VERSION="@0@"'.format(meson.project_version())],
dependencies: avro_dep,
install: true,
install_tag: 'devel',
)
meson.override_find_program('avrogencpp', avrogencpp_exe)
endif
9 changes: 9 additions & 0 deletions subprojects/packagefiles/avro-cpp/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project(
'avro-cpp',
'cpp',
version: '1.12.99',
license: 'Apache-2.0',
default_options: ['cpp_std=c++17'],
)

subdir('lang/c++')
6 changes: 6 additions & 0 deletions subprojects/packagefiles/avro-cpp/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
option(
'build_executable',
type: 'boolean',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI on other Apache projects we have been using feature options instead of boolean. I don't think its a huge deal, but probably nice to stick with that pattern for consistency in the ecosystem

value: true,
description: 'Build avrogencpp exectuable',
)
Loading