diff options
Diffstat (limited to 'bindings/cpp/meson.build')
-rw-r--r-- | bindings/cpp/meson.build | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/bindings/cpp/meson.build b/bindings/cpp/meson.build new file mode 100644 index 00000000..627e537c --- /dev/null +++ b/bindings/cpp/meson.build @@ -0,0 +1,75 @@ +versioned_cpp_name = 'serdxx' + version_suffix + +cpp_prog_args = [] + +# Set ultra strict warnings for developers, if requested +if get_option('strict') + cpp_warnings = all_cpp_warnings + if cpp.get_id() == 'clang' + cpp_warnings += [ + '-Wno-documentation-unknown-command', + '-Wno-format-nonliteral', + '-Wno-nullability-extension', + '-Wno-padded', + ] + elif cpp.get_id() == 'gcc' + cpp_warnings += [ + '-Wno-abi-tag', + '-Wno-float-equal', + '-Wno-inline', + '-Wno-multiple-inheritance', + '-Wno-padded', + '-Wno-suggest-attribute=pure', + '-Wno-switch-default', + '-Wno-unused-const-variable', + ] + elif cpp.get_id() == 'msvc' + cpp_warnings += [ + '/wd4355', # 'this' used in base member initializer list + '/wd4571', # structured exceptions are no longer caught + '/wd4623', # default constructor implicitly deleted + '/wd4625', # copy constructor implicitly deleted + '/wd4626', # assignment operator implicitly deleted + '/wd4710', # function not inlined + '/wd4868', # may not enforce left-to-right evaluation order + '/wd5026', # move constructor implicitly deleted + '/wd5027', # move assignment operator implicitly deleted + ] + endif + + cpp_prog_args = cpp.get_supported_arguments(cpp_warnings) + +endif + +cpp_headers = [ + 'include/serd/serd.hpp', + 'include/serd/detail/Copyable.hpp', + 'include/serd/detail/Flags.hpp', + 'include/serd/detail/Optional.hpp', + 'include/serd/detail/StringView.hpp', + 'include/serd/detail/Wrapper.hpp', +] + +serdxx_dep = declare_dependency( + include_directories: include_directories(['include']), + link_with: libserd) + +pkg.generate( + description: 'C++ bindings for serd', + filebase: versioned_cpp_name, + name: 'Serdxx', + subdirs: [versioned_cpp_name], + version: meson.project_version()) + +# Install headers to a versioned include directory +install_headers(cpp_headers, subdir: versioned_cpp_name / 'serd') + +cpp_test_args = cpp.get_supported_arguments(['-Wno-float-equal']) + +test('bindings', + executable('test_serd_hpp', + 'test/test_serd_hpp.cpp', + include_directories: include_directories(['include']), + cpp_args: cpp_prog_args + cpp_test_args, + dependencies: [serd_dep, serdxx_dep]), + suite: 'cpp') |