[4/5] build: make pdump optional

Message ID 20211110164814.5231-5-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Extend optional libraries list |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Nov. 10, 2021, 4:48 p.m. UTC
  This library can be made optional.
dumpcap and pdump applications depend on this library, check for
dependencies like what we have for examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/meson.build      | 18 +++++++++++++-----
 app/test/meson.build | 10 +++++-----
 lib/meson.build      |  1 +
 3 files changed, 19 insertions(+), 10 deletions(-)
  

Comments

Thomas Monjalon Nov. 16, 2021, 5:14 p.m. UTC | #1
10/11/2021 17:48, David Marchand:
> This library can be made optional.
> dumpcap and pdump applications depend on this library, check for
> dependencies like what we have for examples.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  

Patch

diff --git a/app/meson.build b/app/meson.build
index 310e83076f..93d8c15032 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -43,15 +43,23 @@  foreach app:apps
 
     subdir(name)
 
+    if build
+        dep_objs = []
+        foreach d:deps
+            var_name = get_option('default_library') + '_rte_' + d
+            if not is_variable(var_name)
+                build = false
+                message('Missing dependency "@0@" for app "@1@"'.format(d, name))
+                break
+            endif
+            dep_objs += [get_variable(var_name)]
+        endforeach
+    endif
+
     if not build
         continue
     endif
 
-    dep_objs = []
-    foreach d:deps
-        dep_objs += get_variable(get_option('default_library') + '_rte_' + d)
-    endforeach
-
     link_libs = []
     if get_option('default_library') == 'static'
         link_libs = dpdk_static_libraries + dpdk_drivers
diff --git a/app/test/meson.build b/app/test/meson.build
index b5f1a89edf..07fe4870b0 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -400,11 +400,9 @@  if dpdk_conf.has('RTE_NET_RING')
     test_sources += 'test_pmd_ring.c'
     test_sources += 'test_event_eth_tx_adapter.c'
     test_sources += 'sample_packet_forward.c'
-    test_sources += 'test_pdump.c'
     fast_tests += [['ring_pmd_autotest', true]]
     perf_test_names += 'ring_pmd_perf_autotest'
     fast_tests += [['event_eth_tx_adapter_autotest', false]]
-    fast_tests += [['pdump_autotest', true]]
     if dpdk_conf.has('RTE_LIB_BITRATESTATS')
         test_deps += 'bitratestats'
         test_sources += 'test_bitratestats.c'
@@ -415,6 +413,11 @@  if dpdk_conf.has('RTE_NET_RING')
         test_sources += 'test_latencystats.c'
         fast_tests += [['latencystats_autotest', true]]
     endif
+    if dpdk_conf.has('RTE_LIB_PDUMP')
+        test_deps += 'pdump'
+        test_sources += 'test_pdump.c'
+        fast_tests += [['pdump_autotest', true]]
+    endif
 endif
 
 if dpdk_conf.has('RTE_HAS_LIBPCAP')
@@ -431,9 +434,6 @@  endif
 if dpdk_conf.has('RTE_LIB_KNI')
     test_deps += 'kni'
 endif
-if dpdk_conf.has('RTE_LIB_PDUMP')
-    test_deps += 'pdump'
-endif
 
 if cc.has_argument('-Wno-format-truncation')
     cflags += '-Wno-format-truncation'
diff --git a/lib/meson.build b/lib/meson.build
index 961b95f4ad..dad9fce14d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -73,6 +73,7 @@  optional_libs = [
         'jobstats',
         'latencystats',
         'metrics',
+        'pdump',
         'power',
         'vhost',
 ]