diff options
-rw-r--r-- | .clang-tidy | 2 | ||||
-rw-r--r-- | meson.build | 9 | ||||
-rw-r--r-- | meson_options.txt | 3 | ||||
-rw-r--r-- | test/cpp/.clang-tidy | 18 | ||||
-rw-r--r-- | test/cpp/meson.build | 14 | ||||
-rw-r--r-- | test/cpp/test_lilv_hpp.cpp (renamed from test/lilv_cxx_test.cpp) | 2 | ||||
-rw-r--r-- | test/meson.build | 8 |
7 files changed, 54 insertions, 2 deletions
diff --git a/.clang-tidy b/.clang-tidy index 02314a8..333f376 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,8 +3,10 @@ Checks: > *, + -*-vararg, -altera-*, -bugprone-easily-swappable-parameters, + -bugprone-macro-parentheses, -llvmlibc-*, CheckOptions: - key: hicpp-uppercase-literal-suffix.NewSuffixes diff --git a/meson.build b/meson.build index aeb79bf..4920b23 100644 --- a/meson.build +++ b/meson.build @@ -20,10 +20,17 @@ versioned_name = 'lilv' + version_suffix # Compilers and Flags # ####################### -# Load build tools +# Required tools pkg = import('pkgconfig') cc = meson.get_compiler('c') +# Enable C++ support if bindings aren't disabled +if not get_option('bindings_cpp').disabled() + if add_languages(['cpp'], native: false, required: false) + cpp = meson.get_compiler('cpp') + endif +endif + # Set global warning flags if get_option('strict') and not meson.is_subproject() subdir('meson/warnings') diff --git a/meson_options.txt b/meson_options.txt index 6d64d1b..41de10f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,6 +4,9 @@ option('bindings_py', type: 'feature', value: 'auto', yield: true, description: 'Build Python bindings') +option('bindings_cpp', type: 'feature', value: 'auto', yield: true, + description: 'Build C++ bindings') + option('default_lv2_path', type: 'string', value: '', yield: true, description: 'Default LV2_PATH to use if it is unset') diff --git a/test/cpp/.clang-tidy b/test/cpp/.clang-tidy new file mode 100644 index 0000000..8e5e749 --- /dev/null +++ b/test/cpp/.clang-tidy @@ -0,0 +1,18 @@ +# Copyright 2020-2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +Checks: > + -cert-dcl50-cpp, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -fuchsia-overloaded-operator, + -google-explicit-constructor, + -google-readability-todo, + -hicpp-explicit-conversions, + -hicpp-no-array-decay, + -misc-non-private-member-variables-in-classes, + -modernize-return-braced-init-list, + -modernize-use-trailing-return-type, + -readability-implicit-bool-conversion, +HeaderFilterRegex: '.*/lilvmm\.hpp' +InheritParentConfig: true diff --git a/test/cpp/meson.build b/test/cpp/meson.build new file mode 100644 index 0000000..6451b0c --- /dev/null +++ b/test/cpp/meson.build @@ -0,0 +1,14 @@ +# Copyright 2020-2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +test( + 'lilv_hpp', + executable( + 'test_lilv_hpp', + files('test_lilv_hpp.cpp'), + c_args: test_args + c_suppressions, + dependencies: [lv2_dep, lilv_static_dep], + include_directories: include_directories('../../src'), + ), + suite: 'unit', +) diff --git a/test/lilv_cxx_test.cpp b/test/cpp/test_lilv_hpp.cpp index 1fc674e..57cbda1 100644 --- a/test/lilv_cxx_test.cpp +++ b/test/cpp/test_lilv_hpp.cpp @@ -6,7 +6,7 @@ int main() { - Lilv::World world; + Lilv::World world{}; return 0; } diff --git a/test/meson.build b/test/meson.build index 665b08f..e974951 100644 --- a/test/meson.build +++ b/test/meson.build @@ -55,6 +55,14 @@ subdir('new_version.lv2') subdir('old_version.lv2') subdir('test_plugin.lv2') +################ +# C++ Bindings # +################ + +if not get_option('bindings_cpp').disabled() + subdir('cpp') +endif + ############## # Unit Tests # ############## |