Repository navigation
cmake: include static backend dependencies in pkg-config files - #861
BillyONeal wants to merge 2 commits into
Conversation
Keep the generic and backend-specific modules in sync so pkg-config --static reports the libraries used by the selected backend. Only declare a libusb module dependency when discovery used pkg-config; a parent-provided CMake target may not install a module. Assisted-by: github-copilot:gpt-6.2-sol
Keep the shared templates compatible with config.status so the Cflags line and existing FreeBSD private requirements survive. Substitute an empty value for the CMake-specific private linker field in Autotools. Assisted-by: github-copilot:gpt-6.2-sol
|
|
||
| AC_SUBST([HIDAPI_LIB_NAME]) | ||
| AC_SUBST([HIDAPI_GENERIC_REQUIRES_PRIVATE]) | ||
| AC_SUBST([HIDAPI_PC_LIBS_PRIVATE_FIELD], []) |
There was a problem hiding this comment.
I assume this is for build compatibility, but it is not really populated properly for autotools.
If so - that's fine, but just to confirm it verbally.
There was a problem hiding this comment.
Confirming, after running both build systems on Linux: this line only keeps the Autotools output valid, it does not populate anything.
Both .pc.in templates are shared between CMake and Autotools, so without this AC_SUBST the new @HIDAPI_PC_LIBS_PRIVATE_FIELD@ placeholder would be left verbatim in the Autotools-generated files. With it, the ./configure output of hidapi.pc, hidapi-hidraw.pc and hidapi-libusb.pc differs from master by one empty line and nothing else.
So an Autotools-built static library keeps the same gaps as before (no libudev / libusb / frameworks in its .pc files, apart from the existing FreeBSD Requires.private). That's fine given Autotools is deprecated.
A note in case someone wants to fix Autotools later: the placeholder is one name used by both templates and AC_SUBST is global, so hidraw and libusb cannot get different values through it. It would need the same GENERIC / BACKEND split that Requires.private has, plus one more sed argument in HIDAPI_CONFIGURE_BACKEND_PC. Not asking for that in this PR.
Drafted with Claude Code.
|
Should I assume with this chaneg no more patches would be required for vcpkg integration? |
I looked at the port to answer this myself: not quite. microsoft/vcpkg#55112 is merged, and
The second one is not vcpkg-specific. With this PR alone, a static Drafted with Claude Code. |
|
A few more findings:
I withdraw my original recommendation due to: https://github.com/libusb/hidapi/blob/master/BUILD.cmake.md#both-shared-and-static-build - with the gating that scenario will be partially broken anyway, so let keep the current behavior.
Maybe we want to include that into this PR as well. |
This PR is due to pointing code review bots at the vcpkg submission: microsoft/vcpkg#55112 Against that submission, GPT 6.2 Sol notes:
GPT 6.2 Sol wrote these changes to fix those problems. About these changes, it notes:
Assisted-by: github-copilot:gpt-6.2-sol