Skip to content

Commit baff1e4

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

File tree

10 files changed

+206
-0
lines changed

10 files changed

+206
-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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- a/src/emitterutils.cpp
2+
+++ b/src/emitterutils.cpp
3+
@@ -1,6 +1,7 @@
4+
#include <algorithm>
5+
#include <iomanip>
6+
#include <sstream>
7+
+#include <cstdint>
8+
9+
#include "emitterutils.h"
10+
#include "exp.h"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
project(
2+
'yaml-cpp',
3+
'cpp',
4+
version: '0.8.0',
5+
meson_version: '>=1.1.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+
if not meson.is_subproject()
17+
cc = meson.get_compiler('cpp')
18+
if cc.get_argument_syntax() == 'gcc'
19+
lib_cpp_args += [
20+
'-Wall',
21+
'-Wextra',
22+
'-Wshadow',
23+
'-Weffc++',
24+
'-Wno-long-long',
25+
'-pedantic',
26+
'-pedantic-errors',
27+
]
28+
endif
29+
endif
30+
31+
compile_args = []
32+
if get_option('default_library') == 'static'
33+
compile_args += ['-DYAML_CPP_STATIC_DEFINE']
34+
endif
35+
yaml_cpp_lib = library(
36+
'yaml-cpp',
37+
src,
38+
include_directories: inc,
39+
cpp_args: [lib_cpp_args, compile_args],
40+
soversion: project_version_split[0] + '.' + project_version_split[1],
41+
pic: true,
42+
)
43+
yaml_cpp_dep = declare_dependency(
44+
include_directories: inc,
45+
link_with: yaml_cpp_lib,
46+
compile_args: compile_args,
47+
)
48+
49+
if get_option('tools')
50+
subdir('util')
51+
endif
52+
53+
tests_feature = get_option('tests').disable_auto_if(meson.is_subproject())
54+
if tests_feature.allowed()
55+
subdir('test')
56+
endif
57+
58+
if not meson.is_subproject()
59+
clang_format_prog = find_program('clang-format', required: false)
60+
if clang_format_prog.found()
61+
run_target('format', command: [clang_format_prog, '--style=file', '-i', src])
62+
endif
63+
endif
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
option('contrib', type: 'boolean', description: 'Enable yaml-cpp contrib in library')
2+
option('tools', type: 'boolean', description: 'Enable parse tools')
3+
option('tests', type: 'feature', description: 'build and run tests', value: 'auto')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src += files(
2+
'graphbuilder.cpp',
3+
'graphbuilderadapter.cpp',
4+
)
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+
'nodebuilder.cpp',
15+
'node.cpp',
16+
'node_data.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: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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('gtest-1.11.0/googletest/include', 'gtest-1.11.0/googletest')
11+
gtest_lib = library(
12+
'gtest-all',
13+
sources: files('gtest-1.11.0/googletest/src/gtest-all.cc'),
14+
gnu_symbol_visibility: 'hidden',
15+
cpp_args: dllexp,
16+
dependencies: dependency('threads'),
17+
include_directories: gtest_inc,
18+
)
19+
gmock_inc = include_directories('gtest-1.11.0/googlemock/include', 'gtest-1.11.0/googlemock', 'gtest-1.11.0/googletest/include')
20+
gmock_lib = library(
21+
'gmock-all',
22+
files('gtest-1.11.0/googlemock/src/gmock-all.cc'),
23+
dependencies: dependency('threads'),
24+
include_directories: gmock_inc,
25+
link_with: gtest_lib,
26+
)
27+
gmock_dep = declare_dependency(
28+
include_directories: gmock_inc,
29+
link_with: [gmock_lib, gtest_lib],
30+
)
31+
32+
# Library tests
33+
tests_src = files(
34+
'integration/emitter_test.cpp',
35+
'integration/encoding_test.cpp',
36+
'integration/error_messages_test.cpp',
37+
'integration/gen_emitter_test.cpp',
38+
'integration/handler_spec_test.cpp',
39+
'integration/handler_test.cpp',
40+
'integration/load_node_test.cpp',
41+
'integration/node_spec_test.cpp',
42+
'node/node_test.cpp',
43+
'binary_test.cpp',
44+
'main.cpp',
45+
'ostream_wrapper_test.cpp',
46+
'parser_test.cpp',
47+
'regex_test.cpp',
48+
)
49+
50+
cc = meson.get_compiler('cpp')
51+
cpp_args = []
52+
if cc.get_argument_syntax() == 'gcc'
53+
cpp_args += ['-Wno-variadic-macros', '-Wno-sign-compare']
54+
if cc.get_id() in ['clang', 'clang-ci']
55+
cpp_args += ['-Wno-c99-extensions']
56+
endif
57+
endif
58+
59+
test_exe = executable(
60+
'yaml-cpp-tests',
61+
tests_src,
62+
cpp_args: cpp_args,
63+
link_with: yaml_cpp_lib,
64+
include_directories: yaml_cpp_private_inc,
65+
dependencies: [gmock_dep],
66+
)
67+
test('tests', test_exe)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
executable('yaml-cpp-sandbox', 'sandbox.cpp', dependencies: yaml_cpp_dep)
2+
executable('yaml-cpp-parse', 'parse.cpp', dependencies: yaml_cpp_dep)
3+
executable('yaml-cpp-read', 'read.cpp', dependencies: yaml_cpp_dep)

subprojects/yaml-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 = 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+
diff_files = yaml-cpp/emitterutils.cpp.patch
8+
9+
[provide]
10+
yaml-cpp = yaml_cpp_dep

tools/sanity_checks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@
149149
'makedef.py',
150150
'stddef.h.in',
151151
],
152+
'yaml-cpp': [
153+
'emitterutils.cpp.patch',
154+
],
152155
'zlib-ng': [
153156
'get-version.py',
154157
'process-zconf.py',

0 commit comments

Comments
 (0)