[v2,2/2] buildtools: when building static library use static deps

Message ID 1710484222-17310-3-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series build: build only one library type on Windows |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Tyler Retzlaff March 15, 2024, 6:30 a.m. UTC
  Use static deps when default_library=static and use shared deps when
using default_library=shared.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 buildtools/chkincs/meson.build | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
  

Comments

Bruce Richardson March 15, 2024, 8:28 a.m. UTC | #1
On Thu, Mar 14, 2024 at 11:30:22PM -0700, Tyler Retzlaff wrote:
> Use static deps when default_library=static and use shared deps when
> using default_library=shared.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  buildtools/chkincs/meson.build | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
> index f2dadca..66245a5 100644
> --- a/buildtools/chkincs/meson.build
> +++ b/buildtools/chkincs/meson.build
> @@ -20,11 +20,19 @@ sources += gen_c_files.process(dpdk_chkinc_headers)
>  
>  # some driver SDK headers depend on these two buses, which are mandatory in build
>  # so we always include them in deps list
> -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> -# add the rest of the libs to the dependencies
> -foreach l:dpdk_libs_enabled
> -    deps += get_variable('shared_rte_' + l)
> -endforeach
> +if is_shared_enabled
> +    deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> +    # add the rest of the libs to the dependencies
> +    foreach l:dpdk_libs_enabled
> +        deps += get_variable('shared_rte_' + l)
> +    endforeach
> +else
> +    deps = [get_variable('static_rte_bus_vdev'), get_variable('static_rte_bus_pci')]
> +    # add the rest of the libs to the dependencies
> +    foreach l:dpdk_libs_enabled
> +        deps += get_variable('static_rte_' + l)
> +    endforeach
> +endif
>  

Should the deps checks in lib and driver not be similarly conditional?

>  executable('chkincs', sources,
>          c_args: cflags,
> -- 
> 1.8.3.1
>
  
Tyler Retzlaff April 4, 2024, 6:47 p.m. UTC | #2
On Fri, Mar 15, 2024 at 08:28:55AM +0000, Bruce Richardson wrote:
> On Thu, Mar 14, 2024 at 11:30:22PM -0700, Tyler Retzlaff wrote:
> > Use static deps when default_library=static and use shared deps when
> > using default_library=shared.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  buildtools/chkincs/meson.build | 18 +++++++++++++-----
> >  1 file changed, 13 insertions(+), 5 deletions(-)
> > 
> > diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
> > index f2dadca..66245a5 100644
> > --- a/buildtools/chkincs/meson.build
> > +++ b/buildtools/chkincs/meson.build
> > @@ -20,11 +20,19 @@ sources += gen_c_files.process(dpdk_chkinc_headers)
> >  
> >  # some driver SDK headers depend on these two buses, which are mandatory in build
> >  # so we always include them in deps list
> > -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > -# add the rest of the libs to the dependencies
> > -foreach l:dpdk_libs_enabled
> > -    deps += get_variable('shared_rte_' + l)
> > -endforeach
> > +if is_shared_enabled
> > +    deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > +    # add the rest of the libs to the dependencies
> > +    foreach l:dpdk_libs_enabled
> > +        deps += get_variable('shared_rte_' + l)
> > +    endforeach
> > +else
> > +    deps = [get_variable('static_rte_bus_vdev'), get_variable('static_rte_bus_pci')]
> > +    # add the rest of the libs to the dependencies
> > +    foreach l:dpdk_libs_enabled
> > +        deps += get_variable('static_rte_' + l)
> > +    endforeach
> > +endif
> >  
> 
> Should the deps checks in lib and driver not be similarly conditional?

i might need more context about what you think is wrong. i think the
problem here was that there are not separate variables for shared_deps
vs static_deps.

for my changes to lib/meson.build there's already a separate shared_deps
and static_deps variables holding the deps that are used with
shared_library and static_library respectively.

ty
  
Bruce Richardson April 5, 2024, 9:11 a.m. UTC | #3
On Thu, Apr 04, 2024 at 11:47:49AM -0700, Tyler Retzlaff wrote:
> On Fri, Mar 15, 2024 at 08:28:55AM +0000, Bruce Richardson wrote:
> > On Thu, Mar 14, 2024 at 11:30:22PM -0700, Tyler Retzlaff wrote:
> > > Use static deps when default_library=static and use shared deps when
> > > using default_library=shared.
> > > 
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  buildtools/chkincs/meson.build | 18 +++++++++++++-----
> > >  1 file changed, 13 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
> > > index f2dadca..66245a5 100644
> > > --- a/buildtools/chkincs/meson.build
> > > +++ b/buildtools/chkincs/meson.build
> > > @@ -20,11 +20,19 @@ sources += gen_c_files.process(dpdk_chkinc_headers)
> > >  
> > >  # some driver SDK headers depend on these two buses, which are mandatory in build
> > >  # so we always include them in deps list
> > > -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > > -# add the rest of the libs to the dependencies
> > > -foreach l:dpdk_libs_enabled
> > > -    deps += get_variable('shared_rte_' + l)
> > > -endforeach
> > > +if is_shared_enabled
> > > +    deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > > +    # add the rest of the libs to the dependencies
> > > +    foreach l:dpdk_libs_enabled
> > > +        deps += get_variable('shared_rte_' + l)
> > > +    endforeach
> > > +else
> > > +    deps = [get_variable('static_rte_bus_vdev'), get_variable('static_rte_bus_pci')]
> > > +    # add the rest of the libs to the dependencies
> > > +    foreach l:dpdk_libs_enabled
> > > +        deps += get_variable('static_rte_' + l)
> > > +    endforeach
> > > +endif
> > >  
> > 
> > Should the deps checks in lib and driver not be similarly conditional?
> 
> i might need more context about what you think is wrong. i think the
> problem here was that there are not separate variables for shared_deps
> vs static_deps.
> 
> for my changes to lib/meson.build there's already a separate shared_deps
> and static_deps variables holding the deps that are used with
> shared_library and static_library respectively.
> 
> ty
> 
Not sure I know the context of the question myself, but your answer
certainly seems reasonable. :-) Thanks.
  
Bruce Richardson April 12, 2024, 2:09 p.m. UTC | #4
On Thu, Mar 14, 2024 at 11:30:22PM -0700, Tyler Retzlaff wrote:
> Use static deps when default_library=static and use shared deps when
> using default_library=shared.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  buildtools/chkincs/meson.build | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
> index f2dadca..66245a5 100644
> --- a/buildtools/chkincs/meson.build
> +++ b/buildtools/chkincs/meson.build
> @@ -20,11 +20,19 @@ sources += gen_c_files.process(dpdk_chkinc_headers)
>  
>  # some driver SDK headers depend on these two buses, which are mandatory in build
>  # so we always include them in deps list
> -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> -# add the rest of the libs to the dependencies
> -foreach l:dpdk_libs_enabled
> -    deps += get_variable('shared_rte_' + l)
> -endforeach

shorter fix might be to use get_option('default_library') in place of the
"shared" string, rather than using a condition.

/Bruce

> +if is_shared_enabled
> +    deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> +    # add the rest of the libs to the dependencies
> +    foreach l:dpdk_libs_enabled
> +        deps += get_variable('shared_rte_' + l)
> +    endforeach
> +else
> +    deps = [get_variable('static_rte_bus_vdev'), get_variable('static_rte_bus_pci')]
> +    # add the rest of the libs to the dependencies
> +    foreach l:dpdk_libs_enabled
> +        deps += get_variable('static_rte_' + l)
> +    endforeach
> +endif
>  
>  executable('chkincs', sources,
>          c_args: cflags,
> -- 
> 1.8.3.1
>
  
Tyler Retzlaff April 12, 2024, 10:52 p.m. UTC | #5
On Fri, Apr 12, 2024 at 03:09:12PM +0100, Bruce Richardson wrote:
> On Thu, Mar 14, 2024 at 11:30:22PM -0700, Tyler Retzlaff wrote:
> > Use static deps when default_library=static and use shared deps when
> > using default_library=shared.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  buildtools/chkincs/meson.build | 18 +++++++++++++-----
> >  1 file changed, 13 insertions(+), 5 deletions(-)
> > 
> > diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
> > index f2dadca..66245a5 100644
> > --- a/buildtools/chkincs/meson.build
> > +++ b/buildtools/chkincs/meson.build
> > @@ -20,11 +20,19 @@ sources += gen_c_files.process(dpdk_chkinc_headers)
> >  
> >  # some driver SDK headers depend on these two buses, which are mandatory in build
> >  # so we always include them in deps list
> > -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > -# add the rest of the libs to the dependencies
> > -foreach l:dpdk_libs_enabled
> > -    deps += get_variable('shared_rte_' + l)
> > -endforeach
> 
> shorter fix might be to use get_option('default_library') in place of the
> "shared" string, rather than using a condition.

done in v3.

> 
> /Bruce
> 
> > +if is_shared_enabled
> > +    deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > +    # add the rest of the libs to the dependencies
> > +    foreach l:dpdk_libs_enabled
> > +        deps += get_variable('shared_rte_' + l)
> > +    endforeach
> > +else
> > +    deps = [get_variable('static_rte_bus_vdev'), get_variable('static_rte_bus_pci')]
> > +    # add the rest of the libs to the dependencies
> > +    foreach l:dpdk_libs_enabled
> > +        deps += get_variable('static_rte_' + l)
> > +    endforeach
> > +endif
> >  
> >  executable('chkincs', sources,
> >          c_args: cflags,
> > -- 
> > 1.8.3.1
> >
  

Patch

diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index f2dadca..66245a5 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -20,11 +20,19 @@  sources += gen_c_files.process(dpdk_chkinc_headers)
 
 # some driver SDK headers depend on these two buses, which are mandatory in build
 # so we always include them in deps list
-deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
-# add the rest of the libs to the dependencies
-foreach l:dpdk_libs_enabled
-    deps += get_variable('shared_rte_' + l)
-endforeach
+if is_shared_enabled
+    deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
+    # add the rest of the libs to the dependencies
+    foreach l:dpdk_libs_enabled
+        deps += get_variable('shared_rte_' + l)
+    endforeach
+else
+    deps = [get_variable('static_rte_bus_vdev'), get_variable('static_rte_bus_pci')]
+    # add the rest of the libs to the dependencies
+    foreach l:dpdk_libs_enabled
+        deps += get_variable('static_rte_' + l)
+    endforeach
+endif
 
 executable('chkincs', sources,
         c_args: cflags,