Repository navigation
piolib: Installation improvements - #237
Merged
Merged
Conversation
Generate and install libpio.pc, so that users of the library can find it with pkg-config (PKG_CHECK_MODULES in autotools, pkg_check_modules in CMake) rather than hard-coding the piolib include directory. The headers are installed in <includedir>/piolib and include each other by relative name, so Cflags adds that directory to the search path. The version defaults to 0; packagers can set PIOLIB_VERSION. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GNUInstallDirs needs to know the target architecture to choose the library directory, which it only does once project() has enabled the languages. Included before project(), as it was in both piolib and its examples, a standalone build warned "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known" and installed the library in <prefix>/lib even for a prefix of /usr, rather than in the Debian multiarch directory (lib/aarch64-linux-gnu) where the packaged libpio lives. Builds from the top-level utils directory were unaffected, as project(utils) comes first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The install rule for the pio target only had an ARCHIVE clause, so only the static library was assigned to the "piolib" component; a shared libpio.so fell into the default component, and was missed by "cmake --install <build> --component piolib". Give the LIBRARY artefacts the same destination and component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installing piolib also installed all of its example programs (apitest, blink, mirror, piotest, ...) into <prefix>/bin, which for the default /usr/local prefix puts them on everyone's PATH, where they linger after reverting to the packaged libpio. None of them is shipped in a package. Keep building the examples, but only install them if the new option PIOLIB_INSTALL_EXAMPLES is ON (default OFF), in an "examples" install component. The README describes the option, and how to try a build without displacing the packaged library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four patches to improve packaging and installation:
piolib: Install a pkg-config file
piolib: Include GNUInstallDirs after project()
piolib: Put the shared library in the piolib install component
piolib: Only install the examples on request