[libcamera-devel] [PATCH v3 1/4] android: Define CHROMEOS macro if android_platform=cros

Hirokazu Honda hiroh at chromium.org
Tue Mar 30 07:25:18 CEST 2021


Android Camera HAL 3 API used in ChromeOS has a ChromeOS own
extension, for example, crop_rotate_scale_degrees in
camera3_stream. To avoid breaking bisection for platforms using
the API without the extensions, this introduce CHROMEOS macro,
which is defined if and only if android_platform is 'cros'.

Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
 src/android/meson.build   | 6 ++++++
 src/libcamera/meson.build | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/src/android/meson.build b/src/android/meson.build
index 8e7d07d9..00a3d86b 100644
--- a/src/android/meson.build
+++ b/src/android/meson.build
@@ -35,6 +35,12 @@ endif
 
 android_deps += [libyuv_dep]
 
+android_cpp_args = []
+
+if get_option('android_platform') == 'cros'
+   android_cpp_args += [ '-DCHROMEOS']
+endif
+
 subdir('cros')
 
 android_hal_sources = files([
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 815629db..c0443fd2 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -131,10 +131,13 @@ libcamera_deps = [
 
 libcamera_link_with = []
 
+libcamera_cpp_args = []
+
 if android_enabled
     libcamera_sources += android_hal_sources
     includes += android_includes
     libcamera_link_with += android_camera_metadata
+    libcamera_cpp_args += android_cpp_args
 
     libcamera_deps += android_deps
 endif
@@ -144,10 +147,13 @@ endif
 # runtime if the library is running from an installed location by checking
 # for the presence or abscence of the dynamic tag.
 
+message(libcamera_cpp_args)
+
 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 : '/',
-- 
2.31.0.291.g576ba9dcdaf-goog



More information about the libcamera-devel mailing list