My library imgui is supported in vcpkg (yeah!) but I noticed that vcpkg command-line defaults to creating DLL+import lib. Static library are available if I use e.g.
vcpkg install imgui:x86-windows-static
vcpkg install imgui:x64-windows-static
I am strongly advising my users against using a DLL because
By design the library doesn't guarantee ABI forward or backward compatibility. Any DLL in the wild = increased likehood of troubles.
The number of functions calls to imgui can be very large (e.g. tens of thousands calls every frame, running continuously), some are very short functions where the DLL calling overhead would add up, and the library aims to be as low cost as possible.
So my question is, is there a way to configure vcpkg so that users of imgui would default to getting a full .lib instead of a .dll+.lib ?
Thank you!
May be VCPKG_DEFAULT_TRIPLET is what you are looking for:
https://github.com/Microsoft/vcpkg/blob/master/docs/users/triplets.md#additional-remarks
For a single lib, we may also:
https://github.com/Microsoft/vcpkg/blob/master/ports/dcmtk/portfile.cmake#L3-L6
Thank you @myd7349
Not being a direct end-user of the vcpkg version I am also looking for feedback as to whether my suggestion seems sane and applicable within the wider vcpkg ecosystem or if I would be swimming against the tide too much.
Taking the liberty to tag people who have been updating the imgui package (THANK YOU!) so they can maybe see if as users/devs they agree this is worth changing? (Based on the points made of my post above).
@crackedmind @MarkIanHolland @Elekhyr @jhon
Thanks @ocornut! The port was previously static only, https://github.com/Microsoft/vcpkg/commit/ea6783f9ba878a58b43d8728fd816413f708eb04. I would be happy to follow your advice here, but I don't know if there are reasons in the ecosystem to keep the dlls. Maybe @ras0219-msft could offer better insight.
@ocornut I noticed that imgui has published a new release: v1.68. And I created a PR for this new version in vcpkg: https://github.com/Microsoft/vcpkg/pull/5426
In order to let users of this lib notice the existance of this issue, I added an extra warning message in the corresponding portfile.
@ocornut, thanks for your great library imgui!
Very appreciate for your contribution! @ocornut @myd7349 @MarkIanHolland
The PR is merged, so I think it's safe to close this issue.
Most helpful comment
May be
VCPKG_DEFAULT_TRIPLETis what you are looking for:https://github.com/Microsoft/vcpkg/blob/master/docs/users/triplets.md#additional-remarks
For a single lib, we may also:
https://github.com/Microsoft/vcpkg/blob/master/ports/dcmtk/portfile.cmake#L3-L6