google / libultrahdr

Ultra HDR is a true HDR image format, and is backcompatible. libultrahdr is the reference codec for the Ultra HDR format. The codecs that support the format can render the HDR intent of the image on HDR displays; other codecs can still decode and display the SDR intent of the image.
https://developer.android.com/guide/topics/media/platform/hdr-image-format
Apache License 2.0
157 stars 27 forks source link

Missing flag in pkgconfig file #289

Open kmilos opened 1 month ago

kmilos commented 1 month ago

Although not strictly necessary and functions without so far, the -DUHDR_USING_SHARED_LIBRARY hint might help the linker generate more optimal output on Windows.

When building a shared lib on Windows (any compiler), the resulting .pc file should look like:

Cflags: -I${includedir} -DUHDR_USING_SHARED_LIBRARY

P.S. At least on MSYS2 (using pkgconf rather than pkg-config), the same .pc file can also support both shared and static libs by also adding the (undocumented)

Cflags.private: -UUHDR_USING_SHARED_LIBRARY

as well.

See e.g. https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libdeflate/002-pkg-config.patch

Edit: I see that vcpkg also ships pkgconf rather than pkg-config, so should work out there as well.

ram-mohan commented 6 days ago

@kmilos instead of pkgconf if pkg-config were used, wouldn't this change break static builds as cflags.private is not supported by later.

kmilos commented 5 days ago

Possibly, in theory... However, you'd only add these on Windows when building a shared lib (or both shared + static), and all "major" Windows dev frameworks I'm aware of (vcpkg, MSYS2 MinGW, and Cygwin, even Conan) ship only pkgconf.

So it's up to you - either do this and wait for (unlikely?) breakage reports from some more exotic build environments on Windows, or leave it out and let the packagers patch it on their own accord...