[v9,1/5] lib: allow libraries with no sources

Message ID 20240311144706.204831-2-paul.szczepanek@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series add pointer compression API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Paul Szczepanek March 11, 2024, 2:47 p.m. UTC
  Allow header only libraries.

Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 lib/meson.build | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

--
2.25.1
  

Comments

Bruce Richardson March 11, 2024, 3:23 p.m. UTC | #1
On Mon, Mar 11, 2024 at 02:47:02PM +0000, Paul Szczepanek wrote:
> Allow header only libraries.
> 
> Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
>  lib/meson.build | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/lib/meson.build b/lib/meson.build
> index 179a272932..e4e31f7ecf 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -222,6 +222,20 @@ foreach l:libraries
>      includes += include_directories(l)
>      dpdk_includes += include_directories(l)
> 
> +    # special case for header only libraries
> +    if sources.length() == 0
> +        header_lib_dep = declare_dependency(include_directories: includes,
> +                dependencies: shared_deps)
> +        set_variable('shared_rte_' + name, header_lib_dep)
> +        set_variable('static_rte_' + name, header_lib_dep)
> +        dpdk_shared_lib_deps += header_lib_dep
> +        dpdk_static_lib_deps += header_lib_dep
> +        if developer_mode
> +            message('lib/@0@: Defining dependency "@1@"'.format(l, name))
> +        endif
> +        continue
> +    endif
> +
>      if developer_mode and is_windows and use_function_versioning
>          message('@0@: Function versioning is not supported by Windows.'.format(name))
>      endif

Diff is much clearer this way, thanks.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Paul Szczepanek March 15, 2024, 8:33 a.m. UTC | #2
On 11/03/2024 15:23, Bruce Richardson wrote:
> On Mon, Mar 11, 2024 at 02:47:02PM +0000, Paul Szczepanek wrote:
>> Allow header only libraries.
>>
>> Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
>> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>> ---
>>  lib/meson.build | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/lib/meson.build b/lib/meson.build
>> index 179a272932..e4e31f7ecf 100644
>> --- a/lib/meson.build
>> +++ b/lib/meson.build
>> @@ -222,6 +222,20 @@ foreach l:libraries
>>      includes += include_directories(l)
>>      dpdk_includes += include_directories(l)
>>
>> +    # special case for header only libraries
>> +    if sources.length() == 0
>> +        header_lib_dep = declare_dependency(include_directories: includes,
>> +                dependencies: shared_deps)
>> +        set_variable('shared_rte_' + name, header_lib_dep)
>> +        set_variable('static_rte_' + name, header_lib_dep)
>> +        dpdk_shared_lib_deps += header_lib_dep
>> +        dpdk_static_lib_deps += header_lib_dep
>> +        if developer_mode
>> +            message('lib/@0@: Defining dependency "@1@"'.format(l, name))
>> +        endif
>> +        continue
>> +    endif
>> +
>>      if developer_mode and is_windows and use_function_versioning
>>          message('@0@: Function versioning is not supported by Windows.'.format(name))
>>      endif
> 
> Diff is much clearer this way, thank
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

I had to fix a problem with the addition of `dependencies: shared_deps`
requiring a separate header_lib_dep for static deps - which required a
V10. Can I please get an Ack for the V10?
  

Patch

diff --git a/lib/meson.build b/lib/meson.build
index 179a272932..e4e31f7ecf 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -222,6 +222,20 @@  foreach l:libraries
     includes += include_directories(l)
     dpdk_includes += include_directories(l)

+    # special case for header only libraries
+    if sources.length() == 0
+        header_lib_dep = declare_dependency(include_directories: includes,
+                dependencies: shared_deps)
+        set_variable('shared_rte_' + name, header_lib_dep)
+        set_variable('static_rte_' + name, header_lib_dep)
+        dpdk_shared_lib_deps += header_lib_dep
+        dpdk_static_lib_deps += header_lib_dep
+        if developer_mode
+            message('lib/@0@: Defining dependency "@1@"'.format(l, name))
+        endif
+        continue
+    endif
+
     if developer_mode and is_windows and use_function_versioning
         message('@0@: Function versioning is not supported by Windows.'.format(name))
     endif