Repository navigation
fix(cmake): install every public header - #113
Conversation
v0.9.6 added four headers (index_switch.hpp, inline.hpp, owned_eval.hpp, plain_value.hpp) that were missing from the hand-written header list in CMakeLists.txt. cmake --install, and so the vcpkg port, left them out, and including ptn/patternia.hpp from an installed copy failed with a missing-file error. Collect the headers with file(GLOB_RECURSE) instead of a list, and add the install.consumer CTest test: it installs the build tree into a scratch prefix, checks that every header under include/ was installed, and builds and runs a consumer that uses find_package(patternia).
There was a problem hiding this comment.
Thanks, this is a clean fix for a real packaging bug. A hand-written PTN_HEADERS list falling behind new public headers is exactly why #include <ptn/patternia.hpp> broke from an installed tree (and why vcpkg noticed it) while the source tree kept working. For CMake >= 3.23 the FILE_SET install is driven by that list, so collecting include/ptn/*.hpp and *.h with file(GLOB_RECURSE ... CONFIGURE_DEPENDS) plus list(SORT) is the right replacement; dropping the no-op PTN_JOIN_HEADERS helper is fine.
The new install.consumer test is the actual safety net: it installs into a scratch prefix, checks the source include/ptn tree against what landed in the prefix, then configures, builds, and runs a find_package(patternia) consumer that #includes patternia.hpp and exercises dense val<>, is<T>(), and the owning $ path. That would have caught the four missing headers (inline.hpp, index_switch.hpp, owned_eval.hpp, plain_value.hpp). The test is gated on PTN_INSTALL and CMake >= 3.15 (cmake --install --prefix), which matches how CI configures the master project. The consumer correctly inherits cxx_std_17 from the exported interface, so it does not need its own standard setting.
A couple of non-blocking notes:
- In
run_install_test.cmake,file(GLOB_RECURSE ... include/ptn/*)is broader than the install glob (*.hpp/*.h) and, forGLOB_RECURSE,LIST_DIRECTORIESdefaults to true. That is harmless today because the tree is headers only and install creates the directories, but tightening the glob to*.hpp/*.hand settingLIST_DIRECTORIES falsewould keep the check aligned with what FILE_SET actually installs. cmake --installis invoked withOUTPUT_QUIET, so a failure only reports the exit code. Dropping that (or capturingERROR_VARIABLE) would make a CI failure easier to diagnose.project(patternia VERSION 0.9.6)is unchanged. If this is meant to repair the already-released v0.9.6 package, a patch bump will still be needed for the vcpkg/release side; fine to do that separately.
Approving.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Benchmark comparison (informational)Base Noise estimate: the 24 control rows below do not run Patternia code, so they should not change between base and PR. As a group they moved by a median of +0.1% (run order and machine drift); that offset is divided out of the Patternia deltas (Adjusted). The controls then scatter by a median of 0.1%. Adjusted differences under 5.0% are treated as noise. Patternia: 10 benchmarks, 0 slower, 0 faster, 10 within noise.
Control rows (not Patternia code)
Raw results and the comparison chart are attached to this workflow run as an artifact. Shared runners are noisy, so use this as a trend, not a measurement. |
Problem An installed copy of v0.9.6 does not compile: four headers added in v0.9.6 were missing from the install, so ptn/patternia.hpp fails to include them. Implementation Hotfix release carrying the install fix from #113. Bump the version to 0.9.7 in CMakeLists.txt, packaging/vcpkg/vcpkg.json and the README FetchContent tag, add docs/changelog/v0.9.7.md, and register it in releases.md, the mkdocs nav and the roadmap's Released table. Move the planned result-type and lazy-expression work from v0.9.7 to v0.9.8 in the roadmap. No performance note: generated code is unchanged. Tests Full suite on Apple Clang: 440 tests pass, including the install.consumer test from #113.
**Summary** Hotfix release v0.9.7. An installed copy of v0.9.6 does not compile because four new headers were left out of the install; #113 fixed that on `main`. This release ships the fix. Library code and generated code are the same as in v0.9.6. **Changes** - Bump the version to 0.9.7 in `CMakeLists.txt`, `packaging/vcpkg/vcpkg.json` and the README FetchContent `GIT_TAG`. - Add `docs/changelog/v0.9.7.md` and register it in `docs/changelog/releases.md`, the `mkdocs.yml` nav and the roadmap's Released table, and move the planned result-type and lazy-expression work from v0.9.7 to v0.9.8 (delivery sequence, section heading and the Exploring note). - No performance note: nothing since v0.9.6 changes generated code or dispatch. **Testing** - Full suite on Apple Clang: 440 tests pass, including `install.consumer`, which installs the package and builds a consumer through `find_package(patternia)`.
Summary
The v0.9.6 package is broken when installed: four new headers are
not installed, so
#include <ptn/patternia.hpp>from an installed copy(vcpkg,
cmake --install) fails with'ptn/core/common/inline.hpp' file not found. Copilot raised this onmicrosoft/vcpkg#55156. Using the source tree directly is not affected.
Changes
CMakeLists.txt: collect public headers withfile(GLOB_RECURSE)instead of a hand-written list, which was missing
index_switch.hpp,inline.hpp,owned_eval.hppandplain_value.hpp. Drop the unusedPTN_JOIN_HEADERShelper.install.consumer: installs the build tree into ascratch prefix, checks every header under
include/was installed,then builds and runs a consumer through
find_package(patternia).Testing
install.consumerfails on the oldCMakeLists.txtand lists thefour missing headers; it passes with the fix.