[libcamera-devel] [PATCH 01/16] android: Split HAL to its own shared library
Kieran Bingham
kieran.bingham at ideasonboard.com
Fri Jun 25 03:35:24 CEST 2021
The libcamera Android HAL implementation should not be an integral part
of libcamera, but a support library that utilises the libcamera public
API.
Move the implementation to its own distinct library.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
src/android/cros/meson.build | 2 +-
src/android/meson.build | 16 +++++++++++++++-
src/libcamera/meson.build | 13 -------------
src/meson.build | 8 ++------
4 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/src/android/cros/meson.build b/src/android/cros/meson.build
index 13ec8f0aecc7..c2bda70838e2 100644
--- a/src/android/cros/meson.build
+++ b/src/android/cros/meson.build
@@ -15,4 +15,4 @@ cros_hal_info = static_library('cros_hal_info',
include_directories : [android_includes,
libcamera_includes])
-libcamera_objects += cros_hal_info.extract_objects('camera3_hal.cpp')
+android_objects += cros_hal_info.extract_objects('camera3_hal.cpp')
diff --git a/src/android/meson.build b/src/android/meson.build
index 6270fb201338..feda3e0998bd 100644
--- a/src/android/meson.build
+++ b/src/android/meson.build
@@ -4,6 +4,7 @@ android_deps = [
dependency('libexif', required : get_option('android')),
dependency('libjpeg', required : get_option('android')),
dependency('yaml-0.1', required : get_option('android')),
+ libcamera_dep,
]
android_enabled = true
@@ -36,8 +37,11 @@ endif
android_deps += [libyuv_dep]
+android_cpp_args = []
+android_objects = []
+
if get_option('android_platform') == 'cros'
- libcamera_cpp_args += [ '-DOS_CHROMEOS']
+ android_cpp_args += ['-DOS_CHROMEOS']
endif
subdir('cros')
@@ -69,3 +73,13 @@ android_camera_metadata = static_library('camera_metadata',
android_camera_metadata_sources,
c_args : '-Wno-shadow',
include_directories : android_includes)
+
+libcamera_hal = shared_library('libcamera-hal',
+ android_hal_sources,
+ name_prefix : '',
+ link_with : android_camera_metadata,
+ install : true,
+ cpp_args : android_cpp_args,
+ objects : android_objects,
+ include_directories : android_includes,
+ dependencies : android_deps)
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 7e19a1774a59..d9b5bfae69fd 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -130,16 +130,6 @@ libcamera_deps = [
dependency('threads'),
]
-libcamera_link_with = []
-
-if android_enabled
- libcamera_sources += android_hal_sources
- includes += android_includes
- libcamera_link_with += android_camera_metadata
-
- libcamera_deps += android_deps
-endif
-
# We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.
# The build_rpath is stripped at install time by meson, so we determine at
# runtime if the library is running from an installed location by checking
@@ -148,10 +138,7 @@ endif
libcamera = shared_library('camera',
libcamera_sources,
install : true,
- link_with : libcamera_link_with,
- cpp_args : libcamera_cpp_args,
include_directories : includes,
- objects : libcamera_objects,
build_rpath : '/',
dependencies : libcamera_deps)
diff --git a/src/meson.build b/src/meson.build
index 573966055aa2..e0ea9c3570af 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -25,14 +25,10 @@ else
ipa_sign_module = false
endif
-libcamera_cpp_args = []
-libcamera_objects = []
+# libcamera must be built first as a dependency to the other components.
+subdir('libcamera')
-# The 'android' subdir must be processed first, and the build targets
-# are included directly into the libcamera library when this is enabled.
subdir('android')
-
-subdir('libcamera')
subdir('ipa')
subdir('lc-compliance')
--
2.30.2
More information about the libcamera-devel
mailing list