From 0064548b34cd71da93e70c98809d9473c22c50c5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:49:08 +0200 Subject: [PATCH 1/7] add option to enable gstreamer backend in opencv --- recipes/opencv/4.x/conandata.yml | 15 ++++ recipes/opencv/4.x/conanfile.py | 81 ++++++++++++++----- .../4.1.2-0012-find-gstreamer-windows.patch | 9 +++ 3 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 recipes/opencv/4.x/patches/4.1.2-0012-find-gstreamer-windows.patch diff --git a/recipes/opencv/4.x/conandata.yml b/recipes/opencv/4.x/conandata.yml index d536778d0cf88..388c288b52c6e 100644 --- a/recipes/opencv/4.x/conandata.yml +++ b/recipes/opencv/4.x/conandata.yml @@ -47,6 +47,9 @@ patches: - patch_file: "patches/4.1.2-0007-android-install-layout.patch" patch_description: "Honor install layout from conan if Android" patch_type: "conan" + - patch_file: "patches/4.1.2-0012-find-gstreamer-windows.patch" + patch_description: "Windows: find & link gstreamer with pkgconfig" + patch_type: "conan" "4.8.1": - patch_file: "patches/4.5.5-0001-find-openexr.patch" patch_description: "Robust discovery & injection of OpenEXR" @@ -76,6 +79,9 @@ patches: patch_description: "MinGW: disable obsensor to avoid build issue" patch_type: "portability" patch_source: "https://github.com/opencv/opencv/pull/24478" + - patch_file: "patches/4.1.2-0012-find-gstreamer-windows.patch" + patch_description: "Windows: find & link gstreamer with pkgconfig" + patch_type: "conan" "4.5.5": - patch_file: "patches/4.5.5-0001-find-openexr.patch" patch_description: "Robust discovery & injection of OpenEXR" @@ -109,6 +115,9 @@ patches: - patch_file: "patches/4.1.2-0007-android-install-layout.patch" patch_description: "Honor install layout from conan if Android" patch_type: "conan" + - patch_file: "patches/4.1.2-0012-find-gstreamer-windows.patch" + patch_description: "Windows: find & link gstreamer with pkgconfig" + patch_type: "conan" "4.5.3": - patch_file: "patches/4.5.3-0001-find-openexr.patch" patch_description: "Robust discovery & injection of OpenEXR" @@ -142,6 +151,9 @@ patches: patch_description: "Compatibility with protobuf >= 3.18" patch_type: "portability" patch_source: "https://github.com/opencv/opencv/pull/20386" + - patch_file: "patches/4.1.2-0012-find-gstreamer-windows.patch" + patch_description: "Windows: find & link gstreamer with pkgconfig" + patch_type: "conan" "4.1.2": - patch_file: "patches/4.1.2-0001-find-openexr.patch" patch_description: "Robust discovery & injection of OpenEXR" @@ -178,3 +190,6 @@ patches: patch_description: "Compatibility with OpenEXR 3.x" patch_type: "portability" patch_source: "https://github.com/opencv/opencv/pull/19970" + - patch_file: "patches/4.1.2-0012-find-gstreamer-windows.patch" + patch_description: "Windows: find & link gstreamer with pkgconfig" + patch_type: "conan" diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index 668c160992885..3d705c291bbfe 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -147,6 +147,7 @@ class OpenCVConan(ConanFile): "with_quirc": [True, False], # videoio module options "with_ffmpeg": [True, False], + "with_gstreamer": [True, False], "with_v4l": [True, False], # text module options "with_tesseract": [True, False], @@ -206,6 +207,7 @@ class OpenCVConan(ConanFile): "with_quirc": True, # videoio module options "with_ffmpeg": True, + "with_gstreamer": False, "with_v4l": False, # text module options "with_tesseract": True, @@ -244,6 +246,10 @@ def _contrib_folder(self): def _extra_modules_folder(self): return os.path.join(self._contrib_folder, "modules") + @property + def _build_depends_on_pkgconfig(self): + return self.options.get_safe("with_gstreamer") or self.options.get_safe("with_wayland") + @property def _has_with_jpeg2000_option(self): return self.settings.os != "iOS" @@ -254,7 +260,11 @@ def _has_with_tiff_option(self): @property def _has_with_ffmpeg_option(self): - return self.settings.os != "iOS" and self.settings.os != "WindowsStore" + return self.settings.os not in ["iOS", "WindowsStore"] + + @property + def _has_with_gstreamer_option(self): + return self.settings.os not in ["Android", "iOS", "WindowsStore"] @property def _has_superres_option(self): @@ -325,6 +335,8 @@ def config_options(self): del self.options.with_jpeg2000 if not self._has_with_tiff_option: del self.options.with_tiff + if not self._has_with_gstreamer_option: + del self.options.with_gstreamer if not self._has_superres_option: del self.options.superres if not self._has_alphamat_option: @@ -396,6 +408,22 @@ def ffmpeg(): components = ["ffmpeg::avcodec", "ffmpeg::avformat", "ffmpeg::avutil", "ffmpeg::swscale"] return components + def gstreamer(): + components = [] + if self.options.get_safe("with_gstreamer"): + components.extend([ + "gstreamer::gstreamer-base-1.0", + "gst-plugins-base::gstreamer-app-1.0", + "gst-plugins-base::gstreamer-riff-1.0", + "gst-plugins-base::gstreamer-pbutils-1.0", + "gst-plugins-base::gstreamer-video-1.0", + "gst-plugins-base::gstreamer-audio-1.0", + ]) + return components + + def gstreamer_in_gapi(): + return gstreamer() if Version(self.version) >= "4.5.5" else [] + def gtk(): return ["gtk::gtk"] if self.options.get_safe("with_gtk") else [] @@ -518,7 +546,7 @@ def opencv_xfeatures2d(): "gapi": { "is_built": self.options.gapi, "mandatory_options": ["imgproc"], - "requires": ["opencv_imgproc", "ade::ade"], + "requires": ["opencv_imgproc", "ade::ade"] + gstreamer_in_gapi(), "system_libs": [ (self.settings.os == "Windows", ["ws2_32", "wsock32"]), ], @@ -578,7 +606,7 @@ def opencv_xfeatures2d(): "videoio": { "is_built": self.options.videoio, "mandatory_options": ["imgcodecs", "imgproc"], - "requires": ["opencv_imgcodecs", "opencv_imgproc"] + ffmpeg() + ipp(), + "requires": ["opencv_imgcodecs", "opencv_imgproc"] + ffmpeg() + gstreamer() + ipp(), "system_libs": [ (self.settings.os == "Android" and int(str(self.settings.os.api_level)) > 20, ["mediandk"]), ], @@ -1069,6 +1097,8 @@ def configure(self): if not self.options.videoio: self.options.rm_safe("with_ffmpeg") self.options.rm_safe("with_v4l") + if not (self.options.videoio or (self.options.gapi and Version(self.version) >= "4.5.5")): + self.options.rm_safe("with_gstreamer") if not self.options.with_cuda: self.options.rm_safe("with_cublas") self.options.rm_safe("with_cudnn") @@ -1145,6 +1175,9 @@ def requirements(self): if self.options.get_safe("with_ffmpeg"): # opencv doesn't support ffmpeg >= 5.0.0 for the moment (until 4.5.5 at least) self.requires("ffmpeg/4.4.4") + if self.options.get_safe("with_gstreamer"): + self.requires("gst-plugins-base/1.19.2") + self.requires("gstreamer/1.22.6") # freetype module dependencies if self.options.freetype: self.requires("freetype/2.13.2") @@ -1221,8 +1254,9 @@ def build_requirements(self): self.tool_requires("wayland-protocols/1.33") if not self._is_legacy_one_profile: self.tool_requires("wayland/") + if self._build_depends_on_pkgconfig: if not self.conf.get("tools.gnu:pkg_config", check_type=str): - self.tool_requires("pkgconf/2.1.0") + self.tool_requires("pkgconf/2.2.0") def source(self): get(self, **self.conan_data["sources"][self.version][0], strip_root=True) @@ -1398,7 +1432,9 @@ def generate(self): tc.variables[f"FFMPEG_lib{component}_VERSION"] = ffmpeg_component_version tc.variables["FFMPEG_LIBRARIES"] = ";".join(ffmpeg_libraries) - tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_GSTREAMER"] = self.options.get_safe("with_gstreamer", False) + if Version(self.version) >= "4.5.5": + tc.variables["OPENCV_GAPI_GSTREAMER"] = self.options.get_safe("with_gstreamer", False) tc.variables["WITH_HALIDE"] = False tc.variables["WITH_HPX"] = False tc.variables["WITH_IMGCODEC_HDR"] = self.options.get_safe("with_imgcodec_hdr", False) @@ -1540,24 +1576,25 @@ def generate(self): CMakeDeps(self).generate() - if self.options.get_safe("with_wayland"): + if self._build_depends_on_pkgconfig: deps = PkgConfigDeps(self) - if self._is_legacy_one_profile: - # Manually generate pkgconfig file of wayland-protocols since - # PkgConfigDeps.build_context_activated can't work with legacy 1 profile - wp_prefix = self.dependencies.build["wayland-protocols"].package_folder - wp_version = self.dependencies.build["wayland-protocols"].ref.version - wp_pkg_content = textwrap.dedent(f"""\ - prefix={wp_prefix} - datarootdir=${{prefix}}/res - pkgdatadir=${{datarootdir}}/wayland-protocols - Name: Wayland Protocols - Description: Wayland protocol files - Version: {wp_version} - """) - save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) - else: - deps.build_context_activated = ["wayland-protocols"] + if self.options.get_safe("with_wayland"): + if self._is_legacy_one_profile: + # Manually generate pkgconfig file of wayland-protocols since + # PkgConfigDeps.build_context_activated can't work with legacy 1 profile + wp_prefix = self.dependencies.build["wayland-protocols"].package_folder + wp_version = self.dependencies.build["wayland-protocols"].ref.version + wp_pkg_content = textwrap.dedent(f"""\ + prefix={wp_prefix} + datarootdir=${{prefix}}/res + pkgdatadir=${{datarootdir}}/wayland-protocols + Name: Wayland Protocols + Description: Wayland protocol files + Version: {wp_version} + """) + save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) + else: + deps.build_context_activated = ["wayland-protocols"] deps.generate() def build(self): diff --git a/recipes/opencv/4.x/patches/4.1.2-0012-find-gstreamer-windows.patch b/recipes/opencv/4.x/patches/4.1.2-0012-find-gstreamer-windows.patch new file mode 100644 index 0000000000000..27b3d0c1a2ef6 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0012-find-gstreamer-windows.patch @@ -0,0 +1,9 @@ +--- a/modules/videoio/cmake/detect_gstreamer.cmake ++++ b/modules/videoio/cmake/detect_gstreamer.cmake +@@ -1,5 +1,5 @@ + # --- GStreamer --- +-if(NOT HAVE_GSTREAMER AND WIN32) ++if(0) + set(env_paths "${GSTREAMER_DIR}" ENV GSTREAMER_ROOT) + if(X86_64) + list(APPEND env_paths ENV GSTREAMER_1_0_ROOT_X86_64 ENV GSTREAMER_ROOT_X86_64) From 24d95c5ecbc09faacd80543df8438fd5b7edf28e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 7 Jul 2024 11:44:27 +0200 Subject: [PATCH 2/7] add patch for gstreamer to new 4.10.0 version also --- recipes/opencv/4.x/conandata.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/opencv/4.x/conandata.yml b/recipes/opencv/4.x/conandata.yml index 766479ab79ce1..b965dedb59c09 100644 --- a/recipes/opencv/4.x/conandata.yml +++ b/recipes/opencv/4.x/conandata.yml @@ -52,6 +52,9 @@ patches: - patch_file: "patches/4.1.2-0007-android-install-layout.patch" patch_description: "Honor install layout from conan if Android" patch_type: "conan" + - patch_file: "patches/4.1.2-0012-find-gstreamer-windows.patch" + patch_description: "Windows: find & link gstreamer with pkgconfig" + patch_type: "conan" "4.9.0": - patch_file: "patches/4.5.5-0001-find-openexr.patch" patch_description: "Robust discovery & injection of OpenEXR" From 91de6240b227fd7fc7d00dde35df13744a191da0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:32:12 +0200 Subject: [PATCH 3/7] add with_aravis option to opencv 4.x recipe this option enables aravis backend in videoio module of opencv --- recipes/opencv/4.x/conanfile.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index 7a01607f69453..feeda5bc05150 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -149,6 +149,7 @@ class OpenCVConan(ConanFile): "with_ffmpeg": [True, False], "with_gstreamer": [True, False], "with_v4l": [True, False], + "with_aravis": [True, False], # text module options "with_tesseract": [True, False], # TODO: deprecated options to remove in few months @@ -209,6 +210,7 @@ class OpenCVConan(ConanFile): "with_ffmpeg": True, "with_gstreamer": False, "with_v4l": False, + "with_aravis": False, # text module options "with_tesseract": True, # TODO: deprecated options to remove in few months @@ -248,7 +250,11 @@ def _extra_modules_folder(self): @property def _build_depends_on_pkgconfig(self): - return self.options.get_safe("with_gstreamer") or self.options.get_safe("with_wayland") + return ( + self.options.get_safe("with_aravis") + or self.options.get_safe("with_gstreamer") + or self.options.get_safe("with_wayland") + ) @property def _has_with_jpeg2000_option(self): @@ -266,6 +272,10 @@ def _has_with_ffmpeg_option(self): def _has_with_gstreamer_option(self): return self.settings.os not in ["Android", "iOS", "WindowsStore"] + @property + def _has_with_aravis_option(self): + return self.settings.os not in ["Android", "iOS", "Windows", "WindowsStore"] + @property def _has_superres_option(self): return self.settings.os != "iOS" @@ -337,6 +347,8 @@ def config_options(self): del self.options.with_tiff if not self._has_with_gstreamer_option: del self.options.with_gstreamer + if not self._has_with_aravis_option: + del self.options.with_aravis if not self._has_superres_option: del self.options.superres if not self._has_alphamat_option: @@ -399,6 +411,9 @@ def imageformats_deps(): components.append("gdcm::gdcm") return components + def aravis(): + return ["aravis::aravis"] if self.options.get_safe("with_aravis") else [] + def eigen(): return ["eigen::eigen"] if self.options.with_eigen else [] @@ -606,7 +621,7 @@ def opencv_xfeatures2d(): "videoio": { "is_built": self.options.videoio, "mandatory_options": ["imgcodecs", "imgproc"], - "requires": ["opencv_imgcodecs", "opencv_imgproc"] + ffmpeg() + gstreamer() + ipp(), + "requires": ["opencv_imgcodecs", "opencv_imgproc"] + aravis() + ffmpeg() + gstreamer() + ipp(), "system_libs": [ (self.settings.os == "Android" and int(str(self.settings.os.api_level)) > 20, ["mediandk"]), ], @@ -1097,6 +1112,7 @@ def configure(self): if not self.options.videoio: self.options.rm_safe("with_ffmpeg") self.options.rm_safe("with_v4l") + self.options.rm_safe("with_aravis") if not (self.options.videoio or (self.options.gapi and Version(self.version) >= "4.5.5")): self.options.rm_safe("with_gstreamer") if not self.options.with_cuda: @@ -1178,6 +1194,8 @@ def requirements(self): if self.options.get_safe("with_gstreamer"): self.requires("gst-plugins-base/1.19.2") self.requires("gstreamer/1.22.6") + if self.options.get_safe("with_aravis"): + self.requires("aravis/0.8.30") # freetype module dependencies if self.options.freetype: self.requires("freetype/2.13.2") @@ -1245,6 +1263,14 @@ def validate(self): raise ConanInvalidConfiguration( "viz module can't be enabled yet. It requires VTK which is not available in conan-center." ) + if self.options.get_safe("with_aravis"): + aravis_version = Version(self.dependencies["aravis"].ref.version) + aravis_major_minor = f"{aravis_version.major}.{aravis_version.minor}" + supported_aravis_major_minor = "0.6" if Version(self.version) < "4.6.0" else "0.8" + if aravis_major_minor != supported_aravis_major_minor: + raise ConanInvalidConfiguration( + f"{self.ref} requires aravis {supported_aravis_major_minor}.x when with_aravis option is enabled" + ) def build_requirements(self): if self.options.get_safe("with_protobuf"): @@ -1410,7 +1436,7 @@ def generate(self): tc.variables["BUILD_opencv_ts"] = False tc.variables["WITH_1394"] = False - tc.variables["WITH_ARAVIS"] = False + tc.variables["WITH_ARAVIS"] = self.options.get_safe("with_aravis", False) tc.variables["WITH_CLP"] = False tc.variables["WITH_NVCUVID"] = False From 021ee84f96f5dac34aab35539a0a4fff8e53d0e5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:43:07 +0200 Subject: [PATCH 4/7] add with_gphoto2 option to opencv 4.x recipe this option enables libgphoto2 backend in videoio module of opencv --- recipes/opencv/4.x/conanfile.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index feeda5bc05150..45e6469e1add5 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -150,6 +150,7 @@ class OpenCVConan(ConanFile): "with_gstreamer": [True, False], "with_v4l": [True, False], "with_aravis": [True, False], + "with_gphoto2": [True, False], # text module options "with_tesseract": [True, False], # TODO: deprecated options to remove in few months @@ -211,6 +212,7 @@ class OpenCVConan(ConanFile): "with_gstreamer": False, "with_v4l": False, "with_aravis": False, + "with_gphoto2": False, # text module options "with_tesseract": True, # TODO: deprecated options to remove in few months @@ -252,6 +254,7 @@ def _extra_modules_folder(self): def _build_depends_on_pkgconfig(self): return ( self.options.get_safe("with_aravis") + or self.options.get_safe("with_gphoto2") or self.options.get_safe("with_gstreamer") or self.options.get_safe("with_wayland") ) @@ -276,6 +279,10 @@ def _has_with_gstreamer_option(self): def _has_with_aravis_option(self): return self.settings.os not in ["Android", "iOS", "Windows", "WindowsStore"] + @property + def _has_with_gphoto2_option(self): + return self.settings.os not in ["Android", "iOS", "Windows", "WindowsStore"] + @property def _has_superres_option(self): return self.settings.os != "iOS" @@ -349,6 +356,8 @@ def config_options(self): del self.options.with_gstreamer if not self._has_with_aravis_option: del self.options.with_aravis + if not self._has_with_gphoto2_option: + del self.options.with_gphoto2 if not self._has_superres_option: del self.options.superres if not self._has_alphamat_option: @@ -423,6 +432,9 @@ def ffmpeg(): components = ["ffmpeg::avcodec", "ffmpeg::avformat", "ffmpeg::avutil", "ffmpeg::swscale"] return components + def gphoto2(): + return ["libgphoto2::libgphoto2"] if self.options.get_safe("with_gphoto2") else [] + def gstreamer(): components = [] if self.options.get_safe("with_gstreamer"): @@ -621,7 +633,7 @@ def opencv_xfeatures2d(): "videoio": { "is_built": self.options.videoio, "mandatory_options": ["imgcodecs", "imgproc"], - "requires": ["opencv_imgcodecs", "opencv_imgproc"] + aravis() + ffmpeg() + gstreamer() + ipp(), + "requires": ["opencv_imgcodecs", "opencv_imgproc"] + aravis() + ffmpeg() + gphoto2() + gstreamer() + ipp(), "system_libs": [ (self.settings.os == "Android" and int(str(self.settings.os.api_level)) > 20, ["mediandk"]), ], @@ -1113,6 +1125,7 @@ def configure(self): self.options.rm_safe("with_ffmpeg") self.options.rm_safe("with_v4l") self.options.rm_safe("with_aravis") + self.options.rm_safe("with_gphoto2") if not (self.options.videoio or (self.options.gapi and Version(self.version) >= "4.5.5")): self.options.rm_safe("with_gstreamer") if not self.options.with_cuda: @@ -1196,6 +1209,8 @@ def requirements(self): self.requires("gstreamer/1.22.6") if self.options.get_safe("with_aravis"): self.requires("aravis/0.8.30") + if self.options.get_safe("with_gphoto2"): + self.requires("libgphoto2/2.5.31") # freetype module dependencies if self.options.freetype: self.requires("freetype/2.13.2") @@ -1513,6 +1528,7 @@ def generate(self): tc.variables["WITH_OPENJPEG"] = self.options.get_safe("with_jpeg2000") == "openjpeg" tc.variables["WITH_OPENEXR"] = self.options.get_safe("with_openexr", False) tc.variables["WITH_GDAL"] = self.options.get_safe("with_gdal", False) + tc.variables["WITH_GPHOTO2"] = self.options.get_safe("with_gphoto2", False) tc.variables["WITH_GDCM"] = self.options.get_safe("with_gdcm", False) tc.variables["WITH_EIGEN"] = self.options.with_eigen tc.variables["WITH_DSHOW"] = self._is_cl_like From 6579dcaa8adf788be1ba4856a9d5bf3e64345477 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:51:29 +0200 Subject: [PATCH 5/7] add with_librealsense option to opencv 4.x recipe this option enables librealsense backend in videoio module of opencv --- recipes/opencv/4.x/conanfile.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index 45e6469e1add5..6722300eadddb 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -151,6 +151,7 @@ class OpenCVConan(ConanFile): "with_v4l": [True, False], "with_aravis": [True, False], "with_gphoto2": [True, False], + "with_librealsense": [True, False], # text module options "with_tesseract": [True, False], # TODO: deprecated options to remove in few months @@ -213,6 +214,7 @@ class OpenCVConan(ConanFile): "with_v4l": False, "with_aravis": False, "with_gphoto2": False, + "with_librealsense": False, # text module options "with_tesseract": True, # TODO: deprecated options to remove in few months @@ -461,6 +463,9 @@ def ipp(): return ["ippiw"] return [] + def librealsense(): + return ["librealsense::librealsense"] if self.options.get_safe("with_librealsense") else [] + def parallel(): return ["onetbb::onetbb"] if self.options.parallel == "tbb" else [] @@ -633,7 +638,7 @@ def opencv_xfeatures2d(): "videoio": { "is_built": self.options.videoio, "mandatory_options": ["imgcodecs", "imgproc"], - "requires": ["opencv_imgcodecs", "opencv_imgproc"] + aravis() + ffmpeg() + gphoto2() + gstreamer() + ipp(), + "requires": ["opencv_imgcodecs", "opencv_imgproc"] + aravis() + ffmpeg() + gphoto2() + gstreamer() + librealsense() + ipp(), "system_libs": [ (self.settings.os == "Android" and int(str(self.settings.os.api_level)) > 20, ["mediandk"]), ], @@ -1126,6 +1131,7 @@ def configure(self): self.options.rm_safe("with_v4l") self.options.rm_safe("with_aravis") self.options.rm_safe("with_gphoto2") + self.options.rm_safe("with_librealsense") if not (self.options.videoio or (self.options.gapi and Version(self.version) >= "4.5.5")): self.options.rm_safe("with_gstreamer") if not self.options.with_cuda: @@ -1211,6 +1217,8 @@ def requirements(self): self.requires("aravis/0.8.30") if self.options.get_safe("with_gphoto2"): self.requires("libgphoto2/2.5.31") + if self.options.get_safe("with_librealsense"): + self.requires("librealsense/2.53.1") # freetype module dependencies if self.options.freetype: self.requires("freetype/2.13.2") @@ -1330,6 +1338,12 @@ def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "${GDAL_LIBRARY}", "GDAL::GDAL") if Version(self.version) >= "4.8.0": replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "${AVIF_LIBRARY}", "avif") + replace_in_file( + self, + os.path.join(self.source_folder, "modules", "videoio", "cmake", "detect_realsense.cmake"), + 'ocv_add_external_target(librealsense "" "${realsense2_LIBRARY}" "HAVE_LIBREALSENSE")', + 'ocv_add_external_target(librealsense "${realsense2_INCLUDE_DIRS}" "${realsense2_LIBRARIES}" "HAVE_LIBREALSENSE")', + ) ## Fix detection of ffmpeg replace_in_file(self, os.path.join(self.source_folder, "modules", "videoio", "cmake", "detect_ffmpeg.cmake"), @@ -1488,7 +1502,7 @@ def generate(self): tc.variables["IPPROOT"] = ipp_root tc.variables["IPPIWROOT"] = ipp_root tc.variables["WITH_ITT"] = False - tc.variables["WITH_LIBREALSENSE"] = False + tc.variables["WITH_LIBREALSENSE"] = self.options.get_safe("with_librealsense", False) tc.variables["WITH_MFX"] = False tc.variables["WITH_OPENCL"] = self.options.get_safe("with_opencl", False) tc.variables["WITH_OPENCLAMDBLAS"] = False From 6dbecadfb538c727617ed4433c6b61e86c27ce7e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:38:38 +0200 Subject: [PATCH 6/7] Empty-Commit From 152b5952257941ff1de369724265fcd7db43730a Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:26:12 +0200 Subject: [PATCH 7/7] Empty Commit