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
150 stars 25 forks source link

Add support for installing static library #264

Closed ram-mohan closed 2 weeks ago

ram-mohan commented 2 weeks ago

By default BUILD_SHARED_LIBS is enabled. In this mode, shared libuhdr and static libuhdr are generated in the build process. These libraries, header file and pkg-config file are installed in the default/desired location after make install.

To make use of this, g++ ultrahdr_app.cpp pkg-config --libs libuhdr This is expected to generate a dynamic executable.

For static linking, g++ --static ultrahdr_app.cpp pkg-config --static --libs libuhdr This is expected to generate a static executable. However, this can also fail if the static version of the dependencies are not available. For instance, if the library is built with GPU acceleration enabled, then mostly static versions of EGL and GLESv3 may not be present causing the aforth mentioned command to fail. In this scenario, we have to live with dynamic executable.

For pure static executables, reconfigure the package with BUILD_SHARED_LIBS=0. In this mode only static libraries are built and installed. If the required dependencies are not available in static form, then the build process is expected to fail while those feature are enabled. Then the user can reconfigure accordingly. The static library, header file and pkg-config file that are generated can be installed as-per usual.

To make use of this, g++ ultrahdr_app.cpp pkg-config --static --libs libuhdr or g++ --static ultrahdr_app.cpp pkg-config --static --libs libuhdr This is expected to generate a static executable