summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-29 12:07:35 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-18 14:29:16 +0300
commite0766fa2051c4bcdd12a0b6a838be757018d103a (patch)
tree27ab8357d3ece1f6462ab98d2f9b2edb6fa8fe7f /src
parent9f00e78bf5a6b311c6d0e72b7c79f793863ea942 (diff)
meson: Compile libyaml as a subproject if not available on the system
AOSP doesn't ship libyaml, making it more difficult to compile libcamera for Android. Use a meson wrap to compile libyaml as a subproject if the dependency is not found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/meson.build13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 75d3a692..b57bee7e 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -67,7 +67,7 @@ subdir('proxy')
libdl = cc.find_library('dl')
libgnutls = cc.find_library('gnutls', required : true)
libudev = dependency('libudev', required : false)
-libyaml = dependency('yaml-0.1', required : true)
+libyaml = dependency('yaml-0.1', required : false)
if libgnutls.found()
config_h.set('HAVE_GNUTLS', 1)
@@ -88,6 +88,17 @@ if libudev.found()
])
endif
+# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.
+if not libyaml.found()
+ cmake = import('cmake')
+
+ libyaml_vars = cmake.subproject_options()
+ libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})
+ libyaml_vars.append_compile_args('c', '-Wno-unused-value')
+ libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)
+ libyaml = libyaml_wrap.dependency('yaml')
+endif
+
control_sources = []
foreach source : control_source_files