[PATCH v1 1/1] lib: allow libraries with no sources
David Marchand
david.marchand at redhat.com
Thu Mar 7 11:46:51 CET 2024
On Wed, Mar 6, 2024 at 11:17 PM Paul Szczepanek <paul.szczepanek at arm.com> wrote:
>
> Allow header only libraries.
>
> Signed-off-by: Paul Szczepanek <paul.szczepanek at arm.com>
> Reviewed-by: Dhruv Tripathi <Dhruv.Tripathi at arm.com>
Don't forget to Cc: Bruce, he is the build system maintainer.
>
> ---
> lib/meson.build | 176 +++++++++++++++++++++++++-----------------------
> 1 file changed, 91 insertions(+), 85 deletions(-)
Copy/pasting git show -w, it is easier to review:
> diff --git a/lib/meson.build b/lib/meson.build
> index 179a272932..293d65385d 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -222,6 +222,7 @@ foreach l:libraries
> includes += include_directories(l)
> dpdk_includes += include_directories(l)
>
> + if sources.length() != 0
> if developer_mode and is_windows and use_function_versioning
> message('@0@: Function versioning is not supported by Windows.'.format(name))
> endif
> @@ -321,6 +322,11 @@ foreach l:libraries
>
> dpdk_libraries = [shared_lib] + dpdk_libraries
> dpdk_static_libraries = [static_lib] + dpdk_static_libraries
> + else # sources.length() == 0
> + # if no C files, just set a dependency on header path
> + shared_dep = declare_dependency(include_directories: includes)
In the hypothetical case that such a header only library would depend
on some external library, I suspect we would need to pass external
dependencies here.
Like:
- shared_dep = declare_dependency(include_directories: includes)
+ shared_dep = declare_dependency(include_directories: includes,
+ dependencies: shared_deps)
> + static_dep = shared_dep
> + endif
>
> set_variable('shared_rte_' + name, shared_dep)
> set_variable('static_rte_' + name, static_dep)
--
David Marchand
More information about the dev
mailing list