Skip to content

feat(cmake): install/export + pkg-config for find_package support + ADR-0028 (M7.4)#57

Merged
danielPoloWork merged 1 commit into
masterfrom
feat/m7-4-install-packaging
Jun 14, 2026
Merged

feat(cmake): install/export + pkg-config for find_package support + ADR-0028 (M7.4)#57
danielPoloWork merged 1 commit into
masterfrom
feat/m7-4-install-packaging

Conversation

@danielPoloWork

Copy link
Copy Markdown
Owner

Summary

Closes ROADMAP item 7.4 — Phase 1 distribution (ADR-0004 §5). Adds CMake install/export rules and a pkg-config file so consumers can find_package(pbr_memory_pool CONFIG REQUIRED) and link pbr::memory_pool, and switches the release packaging to cmake --install so Release tarballs are complete, find_package-ready install trees.

Motivation

The target already declared $<INSTALL_INTERFACE:include> but there were no install() rules — the library could only be vendored. ADR-0004 §5 Phase 1 requires find_package support and installable Release artifacts. A latent bug reinforced this: release.yml hand-copied only 3 of the 7 public headers and shipped no package config, so the "install the artifacts from a Release" claim was untrue.

Changes

  • ADR-0028 — records the layout: GNUInstallDirs destinations, one exported target name, relocatable config, SameMajorVersion compatibility, the install gate, and pkg-config (with its documented configure-time-prefix limitation).
  • CMake install/export (CMakeLists.txt + cmake/*.in): PBR_MEMORY_POOL_INSTALL option (default PROJECT_IS_TOP_LEVEL) gates install(TARGETS … EXPORT), the full it/d4np/memorypool/ header tree, the package config + version file, the pkg-config .pc, and LICENSE.
  • EXPORT_NAME memory_pool so the installed imported target is pbr::memory_pool — identical to the in-build alias. One target_link_libraries(app pbr::memory_pool) line works whether the consumer vendors via add_subdirectory / FetchContent or links an installed package.
  • release.yml packages via cmake --install instead of hand-copying — fixes the missing-headers / missing-config bug; tarballs are now complete install trees.
  • Docs: ROADMAP 7.4, ADR index, README Install and consume, CHANGELOG.

Design Patterns

  • None — build-system / packaging work; no new GoF pattern. (The catalogued patterns are unaffected.)

Verification

  • Builds cleanly on the full toolchain matrix — the install block runs at configure/install time only; no build-time or source impact. All four workflow YAMLs re-validated as parseable.
  • Unit tests pass — no library code changed.
  • clang-tidy clean on the diff — no C/C++ source changed (CMake + YAML + Markdown only).
  • ASan + UBSan / Valgrind — N/A, no runtime change.
  • Install + consumer verified end-to-end locally (MSVC 19.51 + Ninja): configure → build → cmake --install to a staging prefix; a separate project then did find_package(pbr_memory_pool CONFIG REQUIRED) + linked pbr::memory_pool, built, and ran (consumer OK: got=7 block_size=64). The installed targets file declares add_library(pbr::memory_pool STATIC IMPORTED); the .pc carries the correct prefix/libdir/version.
  • markdownlint clean on changed docs; all relative links resolve.

Note: the release.yml change can only be exercised at the next tag push (M7.7). The cmake --install path it now uses was validated locally and produced exactly the expected tree (lib + full headers + config + targets + version + .pc + LICENSE).

Documentation Impact

  • README.md updated — Install and consume section.
  • ROADMAP.md checkbox flipped — 7.4.
  • ADR added/updated — ADR-0028 + index row.
  • docs/patterns/README.md updated — N/A.
  • Spec updated — N/A.
  • CHANGELOG.md updated — Added (M7.4) + Changed (M7.4).

…DR-0028 (M7.4)

Closes ROADMAP item 7.4 — Phase 1 distribution (ADR-0004 §5).

- ADR-0028 records the install/packaging layout decision.
- CMake install/export: PBR_MEMORY_POOL_INSTALL option (default
  PROJECT_IS_TOP_LEVEL) gates install(TARGETS ... EXPORT) + install(EXPORT ...
  NAMESPACE pbr::), the full it/d4np/memorypool/ header tree, a relocatable
  package config (configure_package_config_file + SameMajorVersion version
  file), a pkg-config pbr-memory-pool.pc, and LICENSE under share/doc/.
- EXPORT_NAME memory_pool makes the installed imported target pbr::memory_pool,
  identical to the in-build alias — one link line for vendored and installed
  consumers alike.
- release.yml packages via `cmake --install` instead of hand-copying, fixing a
  latent bug where four of the seven public headers and the package config were
  missing from release tarballs.
- Docs: ROADMAP 7.4, ADR index, README "Install and consume", CHANGELOG.

Verified end-to-end locally (MSVC 19.51 + Ninja): configure -> build ->
cmake --install to a staging prefix, then a separate consumer project did
find_package(pbr_memory_pool CONFIG REQUIRED) + linked pbr::memory_pool and ran
(consumer OK: got=7 block_size=64).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@danielPoloWork danielPoloWork merged commit 89ae43e into master Jun 14, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant