The libyuv wrap uses a libyuv commit between versions 1770 and 1772, more than 5 years old. This specifies CMake 2.8 as the minimum required version. The most recent CMake has dropped compatibility with versions older than 3.5 in CMake 4.0. CMake 3.5 was released in 2016, and all distributions we care about ship more recent versions. With CMake 4.0 or newer, shipped for instance by Gentoo, compilation of the libyuv wrap fails. Update the wrap to version 1922, which is the latest numbered version (libyuv doesn't tag release by increases a version number in the README.chromium file). This requires CMake 3.16, released 6 years ago, and available in at least the last two LTS of major distributions. This update introduces two issues. First, due to a bug in Meson (see https://github.com/mesonbuild/meson/issues/10764), PIC handling is broken when a CMake project wraps a static library into another static library that has no additional source file. Work around it by wrapping the libyuv static library again, manually setting 'pic' to true. The second issue is that libyuv fails to compile for armhf platforms that don't support NEON instructions. This is the case on Debian 12 and 13 that ship armhf toolchains with NEON disabled by default. The issue causes CI failures. As the libyuv wrap is a convenience measure, disable NEON optimization on armfd platforms the same way Debian does in its armhf packages. If NEON support is important, the build environment should provide a suitable libyuv. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
86 lines
3.3 KiB
Meson
86 lines
3.3 KiB
Meson
# SPDX-License-Identifier: CC0-1.0
|
|
|
|
# Cache system paths
|
|
libcamera_datadir = get_option('datadir') / 'libcamera'
|
|
libcamera_libdir = get_option('libdir') / 'libcamera'
|
|
libcamera_libexecdir = get_option('libexecdir') / 'libcamera'
|
|
libcamera_sysconfdir = get_option('sysconfdir') / 'libcamera'
|
|
|
|
config_h.set('LIBCAMERA_DATA_DIR', '"' + get_option('prefix') / libcamera_datadir + '"')
|
|
config_h.set('LIBCAMERA_SYSCONF_DIR', '"' + get_option('prefix') / libcamera_sysconfdir + '"')
|
|
|
|
summary({
|
|
'LIBCAMERA_DATA_DIR' : config_h.get('LIBCAMERA_DATA_DIR'),
|
|
'LIBCAMERA_SYSCONF_DIR' : config_h.get('LIBCAMERA_SYSCONF_DIR'),
|
|
}, section : 'Paths')
|
|
|
|
# Module Signing
|
|
openssl = find_program('openssl', required : false)
|
|
if openssl.found()
|
|
ipa_priv_key = custom_target('ipa-priv-key',
|
|
output : ['ipa-priv-key.pem'],
|
|
command : [gen_ipa_priv_key, '@OUTPUT@'])
|
|
config_h.set('HAVE_IPA_PUBKEY', 1)
|
|
ipa_sign_module = true
|
|
else
|
|
warning('openssl not found, all IPA modules will be isolated')
|
|
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)
|
|
|
|
# Meson fails to apply the -fPIC flag to static libraries produced by CMake
|
|
# that wraps other static libraries without adding any source file, despite
|
|
# setting CMAKE_POSITION_INDEPENDENT_CODE to ON. See
|
|
# https://github.com/mesonbuild/meson/issues/10764.
|
|
#
|
|
# Work around the issue by wrapping the libyuv static library into another
|
|
# static library with 'pic' set to true.
|
|
libyuv_static = static_library('libyuv-static',
|
|
dependencies : libyuv.dependency('yuv'),
|
|
pic : true,
|
|
install : false)
|
|
libyuv_include = libyuv.include_directories('yuv')
|
|
libyuv_dep = declare_dependency(link_with : libyuv_static,
|
|
include_directories : libyuv_include)
|
|
endif
|
|
|
|
# libcamera must be built first as a dependency to the other components.
|
|
subdir('libcamera')
|
|
|
|
subdir('android')
|
|
subdir('ipa')
|
|
|
|
subdir('apps')
|
|
|
|
subdir('gstreamer')
|
|
subdir('py')
|
|
subdir('v4l2')
|