Skip to content

Commit 46f5516

Browse files
committed
yaml-cpp: New wrap v0.8.0
Signed-off-by: Alexander Voronov <[email protected]>
1 parent b022818 commit 46f5516

File tree

8 files changed

+232
-0
lines changed

8 files changed

+232
-0
lines changed

releases.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4409,6 +4409,14 @@
44094409
"2.1.0-1"
44104410
]
44114411
},
4412+
"yaml-cpp": {
4413+
"dependency_names": [
4414+
"yaml-cpp"
4415+
],
4416+
"versions": [
4417+
"0.8.0-1"
4418+
]
4419+
},
44124420
"zlib": {
44134421
"dependency_names": [
44144422
"zlib"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
project(
2+
'yaml-cpp',
3+
'cpp',
4+
version: '0.8.0',
5+
meson_version: '>=0.63.0',
6+
default_options: ['cpp_std=c++11'],
7+
license: 'MIT',
8+
)
9+
10+
inc = include_directories('include')
11+
subdir('src')
12+
yaml_cpp_private_inc = include_directories('include', 'src')
13+
14+
project_version_split = meson.project_version().split('.')
15+
lib_cpp_args = []
16+
cc = meson.get_compiler('cpp')
17+
if cc.get_argument_syntax() == 'gcc'
18+
if cc.has_multi_arguments('-include', 'cstdint')
19+
lib_cpp_args += ['-include', 'cstdint']
20+
endif
21+
if not meson.is_subproject()
22+
lib_cpp_args += [
23+
'-Wall',
24+
'-Wextra',
25+
'-Wshadow',
26+
'-Weffc++',
27+
'-Wno-long-long',
28+
'-pedantic',
29+
'-pedantic-errors',
30+
]
31+
endif
32+
endif
33+
34+
compile_args = []
35+
if get_option('default_library') == 'static'
36+
compile_args += ['-DYAML_CPP_STATIC_DEFINE']
37+
else
38+
lib_cpp_args += ['-Dyaml_cpp_EXPORTS']
39+
endif
40+
yaml_cpp_lib = library(
41+
'yaml-cpp',
42+
src,
43+
include_directories: inc,
44+
cpp_args: [lib_cpp_args, compile_args],
45+
soversion: project_version_split[0] + '.' + project_version_split[1],
46+
pic: true,
47+
)
48+
yaml_cpp_dep = declare_dependency(
49+
include_directories: inc,
50+
link_with: yaml_cpp_lib,
51+
compile_args: compile_args,
52+
)
53+
54+
if get_option('tools')
55+
subdir('util')
56+
endif
57+
58+
tests_feature = get_option('tests').disable_auto_if(meson.is_subproject())
59+
if tests_feature.allowed()
60+
subdir('test')
61+
endif
62+
63+
if not meson.is_subproject()
64+
clang_format_prog = find_program(
65+
'clang-format',
66+
required: false,
67+
)
68+
if clang_format_prog.found()
69+
run_target(
70+
'format',
71+
command: [clang_format_prog, '--style=file', '-i', src],
72+
)
73+
endif
74+
endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
option(
2+
'contrib',
3+
type: 'boolean',
4+
description: 'Enable yaml-cpp contrib in library',
5+
)
6+
option(
7+
'tools',
8+
type: 'boolean',
9+
description: 'Enable parse tools',
10+
)
11+
option(
12+
'tests',
13+
type: 'feature',
14+
description: 'build and run tests',
15+
value: 'auto',
16+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src += files('graphbuilder.cpp', 'graphbuilderadapter.cpp')
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
src = files(
2+
'binary.cpp',
3+
'convert.cpp',
4+
'depthguard.cpp',
5+
'directives.cpp',
6+
'emit.cpp',
7+
'emitfromevents.cpp',
8+
'emitter.cpp',
9+
'emitterstate.cpp',
10+
'emitterutils.cpp',
11+
'exceptions.cpp',
12+
'exp.cpp',
13+
'memory.cpp',
14+
'node.cpp',
15+
'node_data.cpp',
16+
'nodebuilder.cpp',
17+
'nodeevents.cpp',
18+
'null.cpp',
19+
'ostream_wrapper.cpp',
20+
'parse.cpp',
21+
'parser.cpp',
22+
'regex_yaml.cpp',
23+
'scanner.cpp',
24+
'scanscalar.cpp',
25+
'scantag.cpp',
26+
'scantoken.cpp',
27+
'simplekey.cpp',
28+
'singledocparser.cpp',
29+
'stream.cpp',
30+
'tag.cpp',
31+
)
32+
33+
if get_option('contrib')
34+
subdir('contrib')
35+
endif
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Latest gmock version only works with c++17, but library default standard is c++11
2+
# So use local copy of gmock
3+
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
4+
dllexp = '-DGTEST_CREATE_SHARED_LIBRARY=1'
5+
dllimp = '-DGTEST_LINKED_AS_SHARED_LIBRARY=1'
6+
else
7+
dllexp = []
8+
dllimp = []
9+
endif
10+
gtest_inc = include_directories(
11+
'gtest-1.11.0/googletest/include',
12+
'gtest-1.11.0/googletest',
13+
)
14+
gtest_lib = library(
15+
'gtest-all',
16+
sources: files('gtest-1.11.0/googletest/src/gtest-all.cc'),
17+
gnu_symbol_visibility: 'hidden',
18+
cpp_args: dllexp,
19+
dependencies: dependency('threads'),
20+
include_directories: gtest_inc,
21+
)
22+
gmock_inc = include_directories(
23+
'gtest-1.11.0/googlemock/include',
24+
'gtest-1.11.0/googlemock',
25+
'gtest-1.11.0/googletest/include',
26+
)
27+
gmock_lib = library(
28+
'gmock-all',
29+
files('gtest-1.11.0/googlemock/src/gmock-all.cc'),
30+
dependencies: dependency('threads'),
31+
include_directories: gmock_inc,
32+
link_with: gtest_lib,
33+
)
34+
gmock_dep = declare_dependency(
35+
include_directories: gmock_inc,
36+
link_with: [gmock_lib, gtest_lib],
37+
)
38+
39+
# Library tests
40+
tests_src = files(
41+
'binary_test.cpp',
42+
'integration/emitter_test.cpp',
43+
'integration/encoding_test.cpp',
44+
'integration/error_messages_test.cpp',
45+
'integration/gen_emitter_test.cpp',
46+
'integration/handler_spec_test.cpp',
47+
'integration/handler_test.cpp',
48+
'integration/load_node_test.cpp',
49+
'integration/node_spec_test.cpp',
50+
'main.cpp',
51+
'node/node_test.cpp',
52+
'ostream_wrapper_test.cpp',
53+
'parser_test.cpp',
54+
'regex_test.cpp',
55+
)
56+
57+
cc = meson.get_compiler('cpp')
58+
cpp_args = []
59+
if cc.get_argument_syntax() == 'gcc'
60+
cpp_args += ['-Wno-variadic-macros', '-Wno-sign-compare']
61+
if cc.get_id() in ['clang', 'clang-ci']
62+
cpp_args += ['-Wno-c99-extensions']
63+
endif
64+
endif
65+
66+
test_exe = executable(
67+
'yaml-cpp-tests',
68+
tests_src,
69+
cpp_args: cpp_args,
70+
link_with: yaml_cpp_lib,
71+
include_directories: yaml_cpp_private_inc,
72+
dependencies: [gmock_dep],
73+
)
74+
test('tests', test_exe)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
executable(
2+
'yaml-cpp-sandbox',
3+
'sandbox.cpp',
4+
dependencies: yaml_cpp_dep,
5+
)
6+
executable(
7+
'yaml-cpp-parse',
8+
'parse.cpp',
9+
dependencies: yaml_cpp_dep,
10+
)
11+
executable(
12+
'yaml-cpp-read',
13+
'read.cpp',
14+
dependencies: yaml_cpp_dep,
15+
)

subprojects/yaml-cpp.wrap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[wrap-file]
2+
directory = yaml-cpp-0.8.0
3+
source_url = https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.zip
4+
source_filename = yaml-cpp-0.8.0.zip
5+
source_hash = 334e80ab7b52e14c23f94e041c74bab0742f2281aad55f66be2f19f4b7747071
6+
patch_directory = yaml-cpp
7+
8+
[provide]
9+
yaml-cpp = yaml_cpp_dep

0 commit comments

Comments
 (0)