[libcamera-devel,v2] meson: Use library() in order to let user chose the library type
diff mbox series

Message ID 20221202210818.343046-1-Rauch.Christian@gmx.de
State Rejected
Headers show
Series
  • [libcamera-devel,v2] meson: Use library() in order to let user chose the library type
Related show

Commit Message

Christian Rauch Dec. 2, 2022, 9:08 p.m. UTC
Defining libraries via shared_library() prevents compiling libcamera as
static library. The meson project recommends using library() instead of
shared_library(), static_library() or both_libraries():
https://mesonbuild.com/Reference-manual_functions.html#library

Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
---
 src/libcamera/base/meson.build | 18 +++++++++---------
 src/libcamera/meson.build      | 18 +++++++++---------
 2 files changed, 18 insertions(+), 18 deletions(-)

--
2.34.1

Comments

Kieran Bingham Dec. 7, 2022, 12:05 p.m. UTC | #1
Hi Christian,

Quoting Christian Rauch via libcamera-devel (2022-12-02 21:08:18)
> Defining libraries via shared_library() prevents compiling libcamera as
> static library. The meson project recommends using library() instead of
> shared_library(), static_library() or both_libraries():
> https://mesonbuild.com/Reference-manual_functions.html#library

I'm afraid I'm a bit worried by this patch. It's not clear what you're
trying to solve?

libcamera doesn't really fit well to static library usage in my opinion.
(At least not right now).

Because libcamera dynamically loads IPA modules, which are identified by
a configured path - the implementation of the both the library and the
IPA's should 'match'. We do have an ability to version match IPA
components, but I don't think it's used right now. Perhaps we should tie
that to the version number of libcamera at least. (It was supposed to be
an IPA interface specific version number).

If you statically link in libcamera to an application, you won't be able
to statically link in the IPA modules, and I would be worried that this
would cause support issues in the future.

If you are trying to ensure your application does not use a distribution
provided package of libcamera, I would recommend instead building a
custom libcamera with a custom -Dprefix=/usr/local/mylibcamera/ and
using that to link against with your application. Then all the search
paths will be correct, and it would function without the distribution
installed package.

--
Kieran




> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
> ---
>  src/libcamera/base/meson.build | 18 +++++++++---------
>  src/libcamera/meson.build      | 18 +++++++++---------
>  2 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
> index 7a7fd7e4..91dc1e71 100644
> --- a/src/libcamera/base/meson.build
> +++ b/src/libcamera/base/meson.build
> @@ -48,15 +48,15 @@ libcamera_base_deps = [
>  # the use of headers which must not be exposed to the libcamera public api.
>  libcamera_base_args = [ '-DLIBCAMERA_BASE_PRIVATE' ]
> 
> -libcamera_base_lib = shared_library('libcamera-base',
> -                                    [libcamera_base_sources, libcamera_base_headers],
> -                                    version : libcamera_version,
> -                                    soversion : libcamera_soversion,
> -                                    name_prefix : '',
> -                                    install : true,
> -                                    cpp_args : libcamera_base_args,
> -                                    include_directories : libcamera_includes,
> -                                    dependencies : libcamera_base_deps)
> +libcamera_base_lib = library('libcamera-base',
> +                             [libcamera_base_sources, libcamera_base_headers],
> +                             version : libcamera_version,
> +                             soversion : libcamera_soversion,
> +                             name_prefix : '',
> +                             install : true,
> +                             cpp_args : libcamera_base_args,
> +                             include_directories : libcamera_includes,
> +                             dependencies : libcamera_base_deps)
> 
>  libcamera_base = declare_dependency(sources : [
>                                          libcamera_base_headers,
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index 0494e808..cd1bf4ed 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -163,15 +163,15 @@ libcamera_deps = [
>  # runtime if the library is running from an installed location by checking
>  # for the presence or abscence of the dynamic tag.
> 
> -libcamera = shared_library('libcamera',
> -                           libcamera_sources,
> -                           version : libcamera_version,
> -                           soversion : libcamera_soversion,
> -                           name_prefix : '',
> -                           install : true,
> -                           include_directories : includes,
> -                           build_rpath : '/',
> -                           dependencies : libcamera_deps)
> +libcamera = library('libcamera',
> +                    libcamera_sources,
> +                    version : libcamera_version,
> +                    soversion : libcamera_soversion,
> +                    name_prefix : '',
> +                    install : true,
> +                    include_directories : includes,
> +                    build_rpath : '/',
> +                    dependencies : libcamera_deps)
> 
>  libcamera_public = declare_dependency(sources : [
>                                            libcamera_ipa_headers,
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
index 7a7fd7e4..91dc1e71 100644
--- a/src/libcamera/base/meson.build
+++ b/src/libcamera/base/meson.build
@@ -48,15 +48,15 @@  libcamera_base_deps = [
 # the use of headers which must not be exposed to the libcamera public api.
 libcamera_base_args = [ '-DLIBCAMERA_BASE_PRIVATE' ]

-libcamera_base_lib = shared_library('libcamera-base',
-                                    [libcamera_base_sources, libcamera_base_headers],
-                                    version : libcamera_version,
-                                    soversion : libcamera_soversion,
-                                    name_prefix : '',
-                                    install : true,
-                                    cpp_args : libcamera_base_args,
-                                    include_directories : libcamera_includes,
-                                    dependencies : libcamera_base_deps)
+libcamera_base_lib = library('libcamera-base',
+                             [libcamera_base_sources, libcamera_base_headers],
+                             version : libcamera_version,
+                             soversion : libcamera_soversion,
+                             name_prefix : '',
+                             install : true,
+                             cpp_args : libcamera_base_args,
+                             include_directories : libcamera_includes,
+                             dependencies : libcamera_base_deps)

 libcamera_base = declare_dependency(sources : [
                                         libcamera_base_headers,
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 0494e808..cd1bf4ed 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -163,15 +163,15 @@  libcamera_deps = [
 # runtime if the library is running from an installed location by checking
 # for the presence or abscence of the dynamic tag.

-libcamera = shared_library('libcamera',
-                           libcamera_sources,
-                           version : libcamera_version,
-                           soversion : libcamera_soversion,
-                           name_prefix : '',
-                           install : true,
-                           include_directories : includes,
-                           build_rpath : '/',
-                           dependencies : libcamera_deps)
+libcamera = library('libcamera',
+                    libcamera_sources,
+                    version : libcamera_version,
+                    soversion : libcamera_soversion,
+                    name_prefix : '',
+                    install : true,
+                    include_directories : includes,
+                    build_rpath : '/',
+                    dependencies : libcamera_deps)

 libcamera_public = declare_dependency(sources : [
                                           libcamera_ipa_headers,