From 76f4eafd21cc22421eab288fd51c98a68a5afd1c Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Fri, 14 Jan 2022 09:50:11 +0100 Subject: [PATCH] [meson] Add use_bundled_deps option --- meson.build | 8 +++++--- meson_options.txt | 7 +++++++ tests/meson.build | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index d1c278b9..80b1df3f 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 3cced4d5..96b76c34 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 8204a0b7..c1d0d09a 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 -- GitLab