Skip to contentSkip to conversation

build: make gpudev optional

PATCH Superseded [email protected] 3 participants 6 messages Nov 17, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: make gpudev optional

From: Elena Agostini <[email protected]>

This library can be made optional.
drivers/gpu and app/test-gpudev depend on this library, so there is a check for dependencies.

---
 app/test-gpudev/meson.build      | 11 +++++++++--
 doc/guides/prog_guide/gpudev.rst |  1 +
 drivers/gpu/meson.build          |  9 ++++++++-
 lib/meson.build                  |  1 +
 4 files changed, 19 insertions(+), 3 deletions(-)
app/test-gpudev/meson.build +9 -2
index 17bdef3646..7340fe29d6 100644
@@ -1,5 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (c) 2021 NVIDIA Corporation & Affiliates
 
-sources = files('main.c')
-deps = ['gpudev', 'ethdev']
+if dpdk_conf.has('RTE_LIB_GPUDEV')
+    sources = files('main.c')
+    deps = ['gpudev', 'ethdev']
+else
+    build = false
+    reason = 'gpudev library is disabled'
+    subdir_done()
+endif
+
doc/guides/prog_guide/gpudev.rst +1 -0
index e464109d35..8970c43865 100644
@@ -23,6 +23,7 @@ Out of scope of this library is to provide a wrapper for GPU specific libraries
 on the device or create GPU specific objects
 (e.g. CUDA Driver context or CUDA Streams in case of NVIDIA GPUs).
 
+This library is set as optional and can be disabled with ``-Ddisable_libs=gpudev``.
 
 Features
 --------
drivers/gpu/meson.build +8 -1
index 601bedcd61..f04594e712 100644
@@ -1,4 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (c) 2021 NVIDIA Corporation & Affiliates
 
-drivers = [ 'cuda' ]
+if dpdk_conf.has('RTE_LIB_GPUDEV')
+    drivers = [ 'cuda' ]
+else
+    build = false
+    reason = 'gpudev library is disabled'
+    subdir_done()
+endif
+
lib/meson.build +1 -0
index dad9fce14d..d6e7cac178 100644
@@ -76,6 +76,7 @@ optional_libs = [
         'pdump',
         'power',
         'vhost',
+        'gpudev',
 ]
 
 disabled_libs = []
Signature · 1 line
2.17.1
#1 lore raw

17/11/2021 21:33, [email protected]:

Quoted 6 lines
app/test-gpudev/meson.build +0 -0
@@ -1,5 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (c) 2021 NVIDIA Corporation & Affiliates
 

app/test-gpudev/meson.build line 11

Quoted 10 lines
app/test-gpudev/meson.build +8 -2
-sources = files('main.c')
-deps = ['gpudev', 'ethdev']
+if dpdk_conf.has('RTE_LIB_GPUDEV')
+    sources = files('main.c')
+    deps = ['gpudev', 'ethdev']
+else
+    build = false
+    reason = 'gpudev library is disabled'
+    subdir_done()
+endif

I would prefer the form "if not" so we can save the "else".

lib/meson.build optional_libs = [ · line 80

Quoted 8 lines
lib/meson.build +1 -0
@@ -76,6 +76,7 @@ optional_libs = [
         'pdump',
         'power',
         'vhost',
+        'gpudev',
 ]

It should be sorted alphabetically.

#2 lore raw

17/11/2021 13:36, Thomas Monjalon:

Quoted 7 lines

17/11/2021 21:33, [email protected]:

Quoted 6 lines
app/test-gpudev/meson.build +0 -0
@@ -1,5 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (c) 2021 NVIDIA Corporation & Affiliates
 
Quoted 12 lines

app/test-gpudev/meson.build line 11

Quoted 10 lines
app/test-gpudev/meson.build +8 -2
-sources = files('main.c')
-deps = ['gpudev', 'ethdev']
+if dpdk_conf.has('RTE_LIB_GPUDEV')
+    sources = files('main.c')
+    deps = ['gpudev', 'ethdev']
+else
+    build = false
+    reason = 'gpudev library is disabled'
+    subdir_done()
+endif

I would prefer the form "if not" so we can save the "else".

Actually no need to check at all in app and driver. If the dependency is missing the driver is disabled already with this reason:
reason = 'missing internal dependency, "@0@"'.format(d)
For the app, there is an automatic message:

	message('Missing dependency "@0@" for app "@1@"'.format(d, name))
Quoted 10 lines

lib/meson.build optional_libs = [ · line 80

Quoted 8 lines
lib/meson.build +1 -0
@@ -76,6 +76,7 @@ optional_libs = [
         'pdump',
         'power',
         'vhost',
+        'gpudev',
 ]

It should be sorted alphabetically.

#3 lore raw

PATCH v2 1/1 build: make gpudev optional

In reply to [email protected]

From: Elena Agostini <[email protected]>

This library can be made optional.
drivers/gpu and app/test-gpudev depend on this library, so there is a check for dependencies.

---
 app/test-gpudev/meson.build      | 1 +
 doc/guides/prog_guide/gpudev.rst | 1 +
 drivers/gpu/meson.build          | 1 +
 lib/meson.build                  | 1 +
 4 files changed, 4 insertions(+)
app/test-gpudev/meson.build +1 -0
index 17bdef3646..02286d3a6a 100644
@@ -3,3 +3,4 @@
 
 sources = files('main.c')
 deps = ['gpudev', 'ethdev']
+
doc/guides/prog_guide/gpudev.rst +1 -0
index e464109d35..8970c43865 100644
@@ -23,6 +23,7 @@ Out of scope of this library is to provide a wrapper for GPU specific libraries
 on the device or create GPU specific objects
 (e.g. CUDA Driver context or CUDA Streams in case of NVIDIA GPUs).
 
+This library is set as optional and can be disabled with ``-Ddisable_libs=gpudev``.
 
 Features
 --------
drivers/gpu/meson.build +1 -0
index 601bedcd61..1e68a7746d 100644
@@ -2,3 +2,4 @@
 # Copyright (c) 2021 NVIDIA Corporation & Affiliates
 
 drivers = [ 'cuda' ]
+
lib/meson.build +1 -0
index dad9fce14d..018976df17 100644
@@ -67,6 +67,7 @@ libraries = [
 
 optional_libs = [
         'bitratestats',
+        'gpudev',
         'gro',
         'gso',
         'kni',
Signature · 1 line
2.17.1
#4 lore raw
Quoted 19 lines · On Wed, Nov 17, 2021 at 09:39:01PM +0000, [email protected] wrote:

From: Elena Agostini <[email protected]>

This library can be made optional.
drivers/gpu and app/test-gpudev depend on this library, so there is a check for dependencies.

---
 app/test-gpudev/meson.build      | 1 +
 doc/guides/prog_guide/gpudev.rst | 1 +
 drivers/gpu/meson.build          | 1 +
 lib/meson.build                  | 1 +
 4 files changed, 4 insertions(+)
app/test-gpudev/meson.build +0 -0
index 17bdef3646..02286d3a6a 100644

app/test-gpudev/meson.build line 6

Quoted 4 lines
app/test-gpudev/meson.build +1 -0
@@ -3,3 +3,4 @@
 
 sources = files('main.c')
 deps = ['gpudev', 'ethdev']
+

This file and "drivers/gpu/meson.build" file can be removed from the patch, since adding a blank line is unnecessary and is not related to the actual patch changes. When preparing a patch, I'd suggest always double checking that all changes introduced in the patch are intentional, and relevant to the patch itself. If these whitespace fixups are intentional needed, they should be sent as a separate patch just to make reviewing easier and ensure each patch has only one logical change in it.

Thanks,
/Bruce