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
151 stars 26 forks source link

Support static builds on Windows #282

Open gregbenz opened 2 days ago

gregbenz commented 2 days ago

It would be helpful if CMakeLists.txt were updated to support static builds on Windows so that any external dependencies could be easily built into ultrahdr_app.exe when compiling

ram-mohan commented 2 days ago

Option -DBUILD_SHARED_LIBS=0 during cmake configuration should create a static binary.

gregbenz commented 2 days ago

Thank you, didn't realize that was already established for Win too.

ram-mohan commented 2 days ago

For distributing binaries, it is best if they are purely static. That is they should not depend on runtime dlls/so's. The option -DBUILD_SHARED_LIBS=0 ensures the third party dependencies that are used during linking are static ones. However the app that is generated is not purely static. It still could be using system libraries that are shared in nature. To address this, target_link_options(ultrahdr_app PRIVATE -static) or something of this sort (basing on the platform) is needed. As make install is not distributing any binaries, this is not done.

gregbenz commented 2 days ago

Is there a compile command which wouuld accomplish that purely static result with the current CMakeLists.txt? If not, could it be updated so that a command could be used without needing to edit CMakeLists.txt (as that would become outdated anytime the source is downloaded).

ram-mohan commented 2 days ago

Is there a compile command which wouuld accomplish that purely static result with the current CMakeLists.txt? If not, could it be updated so that a command could be used without needing to edit CMakeLists.txt (as that would become outdated anytime the source is downloaded).

currently no.

gregbenz commented 1 day ago

re-opening as a request, I believe this would be ideal to fix in the original source