Skip to content

yaml-cpp: New wrap v0.8.0 #2255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025
Merged
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
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -4409,6 +4409,14 @@
"2.1.0-1"
]
},
"yaml-cpp": {
"dependency_names": [
"yaml-cpp"
],
"versions": [
"0.8.0-1"
]
},
"zlib": {
"dependency_names": [
"zlib"
Expand Down
73 changes: 73 additions & 0 deletions subprojects/packagefiles/yaml-cpp/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
project(
'yaml-cpp',
'cpp',
version: '0.8.0',
meson_version: '>=0.63.0',

Check notice on line 5 in subprojects/packagefiles/yaml-cpp/meson.build

View workflow job for this annotation

GitHub Actions / Ubuntu (x86_64)

Minimum Meson version is 0.63.0

0.36.0: pic arg in library 0.37.0: compiler.has_multi_arguments 0.54.0: meson.override_dependency 0.59.0: feature_option.allowed(), feature_option.disable_auto_if() 0.63.0: cpp_std in subproject default_options
default_options: ['cpp_std=c++11'],
license: 'MIT',
)

inc = include_directories('include')
subdir('src')
yaml_cpp_private_inc = include_directories('include', 'src')

project_version_split = meson.project_version().split('.')
lib_cpp_args = []
cc = meson.get_compiler('cpp')
if cc.has_multi_arguments('-include', 'cstdint')
lib_cpp_args += ['-include', 'cstdint']
endif
if not meson.is_subproject()
lib_cpp_args += cc.get_supported_arguments(
'-Wall',
'-Wextra',
'-Wshadow',
'-Weffc++',
'-Wno-long-long',
'-pedantic',
'-pedantic-errors',
)
endif

compile_args = []
if get_option('default_library') == 'static'
compile_args += ['-DYAML_CPP_STATIC_DEFINE']
else
lib_cpp_args += ['-Dyaml_cpp_EXPORTS']
endif
yaml_cpp_lib = library(
'yaml-cpp',
src,
include_directories: inc,
cpp_args: [lib_cpp_args, compile_args],
soversion: project_version_split[0] + '.' + project_version_split[1],
pic: true,
)
yaml_cpp_dep = declare_dependency(
include_directories: inc,
link_with: yaml_cpp_lib,
compile_args: compile_args,
)
meson.override_dependency('yaml-cpp', yaml_cpp_dep)

if get_option('tools')
subdir('util')
endif

tests_feature = get_option('tests').disable_auto_if(meson.is_subproject())
if tests_feature.allowed()
subdir('test')
endif

if not meson.is_subproject()
clang_format_prog = find_program(
'clang-format',
required: false,
)
if clang_format_prog.found()
run_target(
'format',
command: [clang_format_prog, '--style=file', '-i', src],
)
endif
endif
15 changes: 15 additions & 0 deletions subprojects/packagefiles/yaml-cpp/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
option(
'contrib',
type: 'boolean',
description: 'Enable yaml-cpp contrib in library',
)
option(
'tools',
type: 'boolean',
description: 'Enable parse tools',
)
option(
'tests',
type: 'feature',
description: 'build and run tests',
)
1 change: 1 addition & 0 deletions subprojects/packagefiles/yaml-cpp/src/contrib/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src += files('graphbuilder.cpp', 'graphbuilderadapter.cpp')
35 changes: 35 additions & 0 deletions subprojects/packagefiles/yaml-cpp/src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
src = files(
'binary.cpp',
'convert.cpp',
'depthguard.cpp',
'directives.cpp',
'emit.cpp',
'emitfromevents.cpp',
'emitter.cpp',
'emitterstate.cpp',
'emitterutils.cpp',
'exceptions.cpp',
'exp.cpp',
'memory.cpp',
'node.cpp',
'node_data.cpp',
'nodebuilder.cpp',
'nodeevents.cpp',
'null.cpp',
'ostream_wrapper.cpp',
'parse.cpp',
'parser.cpp',
'regex_yaml.cpp',
'scanner.cpp',
'scanscalar.cpp',
'scantag.cpp',
'scantoken.cpp',
'simplekey.cpp',
'singledocparser.cpp',
'stream.cpp',
'tag.cpp',
)

if get_option('contrib')
subdir('contrib')
endif
69 changes: 69 additions & 0 deletions subprojects/packagefiles/yaml-cpp/test/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Latest gmock version only works with c++17, but library default standard is c++11
# So use local copy of gmock
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
dllexp = '-DGTEST_CREATE_SHARED_LIBRARY=1'
dllimp = '-DGTEST_LINKED_AS_SHARED_LIBRARY=1'
else
dllexp = []
dllimp = []
endif
gtest_inc = include_directories(
'gtest-1.11.0/googletest/include',
'gtest-1.11.0/googletest',
)
gtest_lib = library(
'gtest-all',
sources: files('gtest-1.11.0/googletest/src/gtest-all.cc'),
gnu_symbol_visibility: 'hidden',
cpp_args: dllexp,
dependencies: dependency('threads'),
include_directories: gtest_inc,
)
gmock_inc = include_directories(
'gtest-1.11.0/googlemock/include',
'gtest-1.11.0/googlemock',
'gtest-1.11.0/googletest/include',
)
gmock_lib = library(
'gmock-all',
files('gtest-1.11.0/googlemock/src/gmock-all.cc'),
dependencies: dependency('threads'),
include_directories: gmock_inc,
link_with: gtest_lib,
)
gmock_dep = declare_dependency(
include_directories: gmock_inc,
link_with: [gmock_lib, gtest_lib],
)

# Library tests
tests_src = files(
'binary_test.cpp',
'integration/emitter_test.cpp',
'integration/encoding_test.cpp',
'integration/error_messages_test.cpp',
'integration/gen_emitter_test.cpp',
'integration/handler_spec_test.cpp',
'integration/handler_test.cpp',
'integration/load_node_test.cpp',
'integration/node_spec_test.cpp',
'main.cpp',
'node/node_test.cpp',
'ostream_wrapper_test.cpp',
'parser_test.cpp',
'regex_test.cpp',
)

test_exe = executable(
'yaml-cpp-tests',
tests_src,
cpp_args: cc.get_supported_arguments(
'-Wno-variadic-macros',
'-Wno-sign-compare',
'-Wno-c99-extensions',
),
link_with: yaml_cpp_lib,
include_directories: yaml_cpp_private_inc,
dependencies: [gmock_dep],
)
test('tests', test_exe)
15 changes: 15 additions & 0 deletions subprojects/packagefiles/yaml-cpp/util/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
executable(
'yaml-cpp-sandbox',
'sandbox.cpp',
dependencies: yaml_cpp_dep,
)
executable(
'yaml-cpp-parse',
'parse.cpp',
dependencies: yaml_cpp_dep,
)
executable(
'yaml-cpp-read',
'read.cpp',
dependencies: yaml_cpp_dep,
)
9 changes: 9 additions & 0 deletions subprojects/yaml-cpp.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[wrap-file]
directory = yaml-cpp-0.8.0
source_url = https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.zip
source_filename = yaml-cpp-0.8.0.zip
source_hash = 334e80ab7b52e14c23f94e041c74bab0742f2281aad55f66be2f19f4b7747071
patch_directory = yaml-cpp

[provide]
dependency_names = yaml-cpp