Skip to content

cmake: Add Find Module to support Android and iOS consumers

amyspark requested to merge amyspark/gstreamer:add-cmake-find-module into main

Hi all,

This MR is related to !6794 -- it's a second approach. This one adds a Find Module implementing the necessary logic to link against GStreamer, while implementing some extra bits to enhance the compatibility.

The first addition is the mobile target, which implements the monolithic gstreamer_android library, and which here gains compatibility with Apple's operating systems.

The second addition is the handling of the basic GStreamer libraries as --whole-archive when statically linked, which was ported from the ndk-build project in Cerbero. This is not easy to do, as CMake suffers from several issues that impede its proper usage of pkg-config:

  • It cannot differentiate between system/compiler specific libraries e.g. -lm, -ldl, but especially -framework Cocoa.
  • It does not support --whole-archive natively until 3.27
  • It attempts to reorder flags blindly by separating them with spaces, thus requiring the use of -Wl, wrapping or (in the case of Apple frameworks) manual framework lookup

The third addition is the port of the Fontconfig and ca-certificates bundling logic. I've not added the necessary files here, as I am not sure if they belong to the GStreamer monorepo or should be supplied from elsewhere.

Let me know what you think.

Merge request reports