Context
The compiler currently requires manual CLI invocation. This is the #1 usability blocker. Users live in CMake; a pre-build codegen step that is not a first-class citizen in the build graph is pure friction.
Goals
- find_package support:
find_package(h5cpp-compiler) or find_package(h5cpp COMPONENTS compiler) should work.
- add_custom_command integration: A CMake function that runs the compiler automatically when a struct header changes.
- Check / dry-run mode:
h5cpp-compiler --check to verify generated descriptors are current without overwriting. This belongs in CI.
- Deterministic output: Generated headers should be diff-friendly (already done: #pragma once instead of random include guards).
Proposed API
find_package(h5cpp-compiler REQUIRED)
h5cpp_compiler_generate(
TARGET my_target
INPUTS particle.hpp simulation.hpp
OUTPUTS particle_h5.hpp simulation_h5.hpp
STUB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stub
)
The function should:
- Register
add_custom_command so output is regenerated when inputs change
- Fail the build if compilation fails (struct not POD, missing includes, etc.)
- Optionally support
--check mode for CI gating
Acceptance criteria
Context
The compiler currently requires manual CLI invocation. This is the #1 usability blocker. Users live in CMake; a pre-build codegen step that is not a first-class citizen in the build graph is pure friction.
Goals
find_package(h5cpp-compiler)orfind_package(h5cpp COMPONENTS compiler)should work.h5cpp-compiler --checkto verify generated descriptors are current without overwriting. This belongs in CI.Proposed API
The function should:
add_custom_commandso output is regenerated when inputs change--checkmode for CI gatingAcceptance criteria
cmake/FindH5CPPCompiler.cmakeor config-file packageh5cpp_compiler_generate()function documented in READMEexamples/cmake-integration/