diff --git a/meson.build b/meson.build index d1c278b97d5a69a03446374166869cf2d419a1ab..80b1df3f9eca4bb3c2a3f4836e65596350002cc6 100644 --- a/meson.build +++ b/meson.build @@ -10,9 +10,12 @@ project('EMPER', 'c', 'cpp', thread_dep = dependency('threads') +conf_data = configuration_data() +use_bundled_deps = get_option('use_bundled_deps') + liburing_version = '2.0' -uring_dep = dependency('liburing', version: liburing_version, required: false) -if not uring_dep.found() +uring_dep = dependency('liburing', version: liburing_version, required: use_bundled_deps == 'never') +if not uring_dep.found() or use_bundled_deps == 'always' message('liburing ' + liburing_version + ' not found in system, using liburing subproject') liburing_sp = subproject('liburing') uring_dep = liburing_sp.get_variable('uring').as_system() @@ -32,7 +35,6 @@ tools_dir = join_paths(meson.source_root(), 'tools') run_target('iwyu', command: join_paths(tools_dir, 'check-iwyu')) -conf_data = configuration_data() option_urcu = get_option('userspace_rcu') conf_data.set('EMPER_LIBURCU', option_urcu) if option_urcu diff --git a/meson_options.txt b/meson_options.txt index 3cced4d588766dbbefb40d9c2b94e7d68bd81f44..96b76c34be3435f7737a42e7b4523b7811d2f014 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,10 @@ +option( + 'use_bundled_deps', + type: 'combo', + choices: ['automatic', 'always', 'never'], + description: 'Control when the bundled dependencies are used', + value: 'automatic', +) option( 'userspace_rcu', type: 'boolean', diff --git a/tests/meson.build b/tests/meson.build index 8204a0b7602990d0d968049febcfdb84f7ebaff4..c1d0d09a2aee9f1cb30a7367dad830a892b685fb 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -133,10 +133,10 @@ parallel_ok = (not io_uring_enabled) # Meson integration for GTest and GMock # See https://mesonbuild.com/Dependencies.html#gtest-and-gmock -gtest_dep = dependency('gtest', main: true, required: false) +gtest_dep = dependency('gtest', main: true, required: use_bundled_deps == 'never') # If gtest is not available on the system use the meson wrap provided # by WrapDB and build it ourself -if not gtest_dep.found() +if not gtest_dep.found() or use_bundled_deps == 'always' gtest_sp = subproject('gtest') gtest_dep = gtest_sp.get_variable('gtest_main_dep') endif