build: make gpudev optional
Subsystems (3)
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
@@ -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
@@ -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
@@ -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
@@ -76,6 +76,7 @@ optional_libs = [ 'pdump', 'power', 'vhost', + 'gpudev', ] disabled_libs = []
Signature · 1 line
2.17.1
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.
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() +endifI 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.
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
@@ -3,3 +3,4 @@ sources = files('main.c') deps = ['gpudev', 'ethdev'] +
doc/guides/prog_guide/gpudev.rst +1 -0
@@ -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
@@ -2,3 +2,4 @@ # Copyright (c) 2021 NVIDIA Corporation & Affiliates drivers = [ 'cuda' ] +
lib/meson.build +1 -0
@@ -67,6 +67,7 @@ libraries = [ optional_libs = [ 'bitratestats', + 'gpudev', 'gro', 'gso', 'kni',
Signature · 1 line
2.17.1
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/gpuand app/test-gpudev depend on this library, so there is a check for dependencies.Signed-off-by Elena Agostini <[email protected]>--- 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
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
17/11/2021 22:39, [email protected]:
Quoted 5 lines
From: Elena Agostini <[email protected]>
This library can be made optional.
drivers/gpuand app/test-gpudev depend on this library, so there is a check for dependencies.
Changed to
so they are automatically disabled if the lib is disabled.
Quoted 1 line
Signed-off-by Elena Agostini <[email protected]>
Applied with blank lines fixed.