diff mbox series

[meta-oe,3/3] nanopb-runtime: Enable shared library

Message ID 20240210005921.1909326-4-wak@google.com
State Accepted
Headers show
Series nanopb: Updates and package split | expand

Commit Message

William Kennington Feb. 10, 2024, 12:59 a.m. UTC
Some users would like to be able to share library code between multiple
applications without embedding a static copy.

Signed-off-by: William A. Kennington III <wak@google.com>
---
 .../meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb  | 1 +
 1 file changed, 1 insertion(+)

Comments

Christian Eggers Feb. 12, 2024, 6:07 a.m. UTC | #1
On Saturday, 10 February 2024, 01:59:20 CET, William A. Kennington III via lists.openembedded.org wrote:
> Some users would like to be able to share library code between multiple
> applications without embedding a static copy.

Some CMake based recipes have a PACKAGECONFIG for this:

PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF"

Particularly for permissive licenses I personally prefer static linking
due to performance benefits.

regards,
Christian

> 
> Signed-off-by: William A. Kennington III <wak@google.com>
> ---
>  .../meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb  | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> index e36abf808..e43931a4e 100644
> --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> @@ -2,6 +2,7 @@ require nanopb.inc
>  
>  EXTRA_OECMAKE += " \
>    -Dnanopb_PROTOC_PATH=/bin/false \
> +  -DBUILD_SHARED_LIBS=ON \
>    -Dnanopb_BUILD_RUNTIME=ON \
>    -Dnanopb_BUILD_GENERATOR=OFF \
>    "
>
William Kennington Feb. 12, 2024, 11 a.m. UTC | #2
On Sun, Feb 11, 2024 at 10:07 PM Christian Eggers <ceggers@arri.de> wrote:
>
> On Saturday, 10 February 2024, 01:59:20 CET, William A. Kennington III via lists.openembedded.org wrote:
> > Some users would like to be able to share library code between multiple
> > applications without embedding a static copy.
>
> Some CMake based recipes have a PACKAGECONFIG for this:
>
> PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF"
>
> Particularly for permissive licenses I personally prefer static linking
> due to performance benefits.

You could still statically link if you want to, this just builds both
sets of libraries instead of the static library only. I don't mind
adding the option though.

>
> regards,
> Christian
>
> >
> > Signed-off-by: William A. Kennington III <wak@google.com>
> > ---
> >  .../meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb  | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > index e36abf808..e43931a4e 100644
> > --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > @@ -2,6 +2,7 @@ require nanopb.inc
> >
> >  EXTRA_OECMAKE += " \
> >    -Dnanopb_PROTOC_PATH=/bin/false \
> > +  -DBUILD_SHARED_LIBS=ON \
> >    -Dnanopb_BUILD_RUNTIME=ON \
> >    -Dnanopb_BUILD_GENERATOR=OFF \
> >    "
> >
>
>
>
>
Christian Eggers Feb. 12, 2024, 11:04 a.m. UTC | #3
On Monday, 12 February 2024, 12:00:22 CET, William Kennington wrote:
> On Sun, Feb 11, 2024 at 10:07 PM Christian Eggers <ceggers@arri.de> wrote:
> >
> > On Saturday, 10 February 2024, 01:59:20 CET, William A. Kennington III via lists.openembedded.org wrote:
> > > Some users would like to be able to share library code between multiple
> > > applications without embedding a static copy.
> >
> > Some CMake based recipes have a PACKAGECONFIG for this:
> >
> > PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF"
> >
> > Particularly for permissive licenses I personally prefer static linking
> > due to performance benefits.
> 
> You could still statically link if you want to, this just builds both
> sets of libraries instead of the static library only. I don't mind
> adding the option though.

I didn't actually try, but this sounds fine for me.

From usual CMake projects am I am used to get either shared or
static libraries, depending on BUILD_SHARED_LIBS.

> 
> >
> > regards,
> > Christian
> >
> > >
> > > Signed-off-by: William A. Kennington III <wak@google.com>
> > > ---
> > >  .../meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb  | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > > index e36abf808..e43931a4e 100644
> > > --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > > +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > > @@ -2,6 +2,7 @@ require nanopb.inc
> > >
> > >  EXTRA_OECMAKE += " \
> > >    -Dnanopb_PROTOC_PATH=/bin/false \
> > > +  -DBUILD_SHARED_LIBS=ON \
> > >    -Dnanopb_BUILD_RUNTIME=ON \
> > >    -Dnanopb_BUILD_GENERATOR=OFF \
> > >    "
> > >
> >
> >
> >
> >
>
William Kennington Feb. 12, 2024, 11:22 a.m. UTC | #4
On Mon, Feb 12, 2024 at 3:05 AM Christian Eggers <ceggers@arri.de> wrote:
>
> On Monday, 12 February 2024, 12:00:22 CET, William Kennington wrote:
> > On Sun, Feb 11, 2024 at 10:07 PM Christian Eggers <ceggers@arri.de> wrote:
> > >
> > > On Saturday, 10 February 2024, 01:59:20 CET, William A. Kennington III via lists.openembedded.org wrote:
> > > > Some users would like to be able to share library code between multiple
> > > > applications without embedding a static copy.
> > >
> > > Some CMake based recipes have a PACKAGECONFIG for this:
> > >
> > > PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF"
> > >
> > > Particularly for permissive licenses I personally prefer static linking
> > > due to performance benefits.
> >
> > You could still statically link if you want to, this just builds both
> > sets of libraries instead of the static library only. I don't mind
> > adding the option though.
>
> I didn't actually try, but this sounds fine for me.
>
> From usual CMake projects am I am used to get either shared or
> static libraries, depending on BUILD_SHARED_LIBS.

Theirs happens to do both
https://github.com/nanopb/nanopb/blob/0.4.8/CMakeLists.txt#L11

IIRC most CMake projects I've encountered allow building both this way.

>
> >
> > >
> > > regards,
> > > Christian
> > >
> > > >
> > > > Signed-off-by: William A. Kennington III <wak@google.com>
> > > > ---
> > > >  .../meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb  | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > > > index e36abf808..e43931a4e 100644
> > > > --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > > > +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
> > > > @@ -2,6 +2,7 @@ require nanopb.inc
> > > >
> > > >  EXTRA_OECMAKE += " \
> > > >    -Dnanopb_PROTOC_PATH=/bin/false \
> > > > +  -DBUILD_SHARED_LIBS=ON \
> > > >    -Dnanopb_BUILD_RUNTIME=ON \
> > > >    -Dnanopb_BUILD_GENERATOR=OFF \
> > > >    "
> > > >
> > >
> > >
> > >
> > >
> >
>
>
>
>
diff mbox series

Patch

diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
index e36abf808..e43931a4e 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb-runtime_0.4.8.bb
@@ -2,6 +2,7 @@  require nanopb.inc
 
 EXTRA_OECMAKE += " \
   -Dnanopb_PROTOC_PATH=/bin/false \
+  -DBUILD_SHARED_LIBS=ON \
   -Dnanopb_BUILD_RUNTIME=ON \
   -Dnanopb_BUILD_GENERATOR=OFF \
   "