summaryrefslogtreecommitdiff
path: root/src/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'src/meson.build')
-rw-r--r--src/meson.build31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/meson.build b/src/meson.build
index 165a77bb..8eb8f05b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -27,6 +27,37 @@ else
ipa_sign_module = false
endif
+# libyuv, used by the Android adaptation layer and the virtual pipeline handler.
+# Fallback to a subproject if libyuv isn't found, as it's typically not provided
+# by distributions. Where libyuv is provided by a distribution, it may not
+# always supply a pkg-config implementation, requiring cxx.find_library() to
+# search for it.
+if not get_option('force_fallback_for').contains('libyuv')
+ libyuv_dep = dependency('libyuv', required : false)
+ if not libyuv_dep.found()
+ libyuv_dep = cxx.find_library('yuv', has_headers : 'libyuv.h',
+ required : false)
+ endif
+else
+ libyuv_dep = dependency('', required : false)
+endif
+
+if (pipelines.contains('virtual') or get_option('android').allowed()) and \
+ not libyuv_dep.found()
+ cmake = import('cmake')
+
+ libyuv_vars = cmake.subproject_options()
+ libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})
+ libyuv_vars.set_override_option('cpp_std', 'c++17')
+ libyuv_vars.append_compile_args('cpp',
+ '-Wno-sign-compare',
+ '-Wno-unused-variable',
+ '-Wno-unused-parameter')
+ libyuv_vars.append_link_args('-ljpeg')
+ libyuv = cmake.subproject('libyuv', options : libyuv_vars)
+ libyuv_dep = libyuv.dependency('yuv')
+endif
+
# libcamera must be built first as a dependency to the other components.
subdir('libcamera')