diff options
author | David Robillard <d@drobilla.net> | 2025-02-06 20:50:15 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-02-06 20:50:15 -0500 |
commit | 2c52c6ec921130bed612b96c2939207391d5237c (patch) | |
tree | 28bc533ed2c6932a803c2e77e96935fba30c8819 | |
parent | 86b30b3db30909c025b9c42a10078d64a66c813a (diff) | |
download | pugl-2c52c6ec921130bed612b96c2939207391d5237c.tar.gz pugl-2c52c6ec921130bed612b96c2939207391d5237c.tar.bz2 pugl-2c52c6ec921130bed612b96c2939207391d5237c.zip |
Add option to disable C++ bindings
-rw-r--r-- | examples/meson.build | 11 | ||||
-rw-r--r-- | meson.build | 14 | ||||
-rw-r--r-- | meson_options.txt | 5 | ||||
-rw-r--r-- | test/headers/meson.build | 2 | ||||
-rw-r--r-- | test/meson.build | 6 |
5 files changed, 29 insertions, 9 deletions
diff --git a/examples/meson.build b/examples/meson.build index 0c4f998..ef77e65 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2023 David Robillard <d@drobilla.net> +# Copyright 2021-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC data_dir = get_option('prefix') / get_option('datadir') / 'pugl-0' @@ -148,6 +148,10 @@ else elif target == 'pugl_print_events' dependencies += [pugl_stub_dep] elif target == 'pugl_cpp_demo' + if not is_variable('puglpp_dep') + continue + endif + dependencies += [puglpp_dep] endif @@ -185,8 +189,13 @@ else defines = [] if target == 'pugl_vulkan_cpp_demo' + if not is_variable('puglpp_dep') + continue + endif + source += ['file_utils.c'] defines += ['-D_POSIX_C_SOURCE=200809L'] + dependencies += [puglpp_dep] endif executable( diff --git a/meson.build b/meson.build index fee2f3c..2da6a8e 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2023 David Robillard <d@drobilla.net> +# Copyright 2021-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC project( @@ -28,8 +28,11 @@ versioned_name = 'pugl' + version_suffix pkg = import('pkgconfig') cc = meson.get_compiler('c') -# Enable C++ support if we're building the examples -if not get_option('examples').disabled() or not get_option('tests').disabled() +# Enable C++ support if we're building the examples or the bindings +if ( + not get_option('bindings_cpp').disabled() + or not get_option('examples').disabled() +) if add_languages(['cpp'], native: false, required: false) cpp = meson.get_compiler('cpp') endif @@ -458,7 +461,10 @@ endif ############################### subdir('include') -subdir('bindings/cpp') + +if not get_option('bindings_cpp').disabled() + subdir('bindings/cpp') +endif ###################### # Tests and Examples # diff --git a/meson_options.txt b/meson_options.txt index 6e92100..fa55c67 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ -# Copyright 2021-2024 David Robillard <d@drobilla.net> +# Copyright 2021-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC option('cairo', type: 'feature', @@ -7,6 +7,9 @@ option('cairo', type: 'feature', option('examples', type: 'feature', yield: true, description: 'Build example programs') +option('bindings_cpp', type: 'feature', yield: true, + description: 'Build C++ bindings') + option('docs', type: 'feature', yield: true, description: 'Build documentation') diff --git a/test/headers/meson.build b/test/headers/meson.build index c0adabd..a6c279e 100644 --- a/test/headers/meson.build +++ b/test/headers/meson.build @@ -11,7 +11,7 @@ if get_option('warning_level') == 'everything' endif endif -header_c_suppressions = cpp.get_supported_arguments(header_c_suppressions) +header_c_suppressions = cc.get_supported_arguments(header_c_suppressions) test_headers_c_args = header_c_suppressions test_headers_c_args += [ diff --git a/test/meson.build b/test/meson.build index f015596..6bd0aa3 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2023 David Robillard <d@drobilla.net> +# Copyright 2021-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC # Suppress some additional C warnings in tests @@ -148,4 +148,6 @@ subdir('headers') # C++ / Objective C++ # ####################### -subdir('cpp') +if is_variable('cpp') + subdir('cpp') +endif |