Skip to content

Set the version only in hipobj.h - #259

Merged
derobins merged 1 commit into
developfrom
derobins/single_source_of_truth
Oct 19, 2026
Merged

derobins merged 1 commit into
developfrom
derobins/single_source_of_truth

Conversation

@derobins

Copy link
Copy Markdown
Collaborator

The version was set twice, by the HIPOBJ_VERSION_* macros in include/hipobj.h and by set() calls in the top-level CMakeLists.txt, and the two had to be changed together. The header is now the only place it's set.

  • CMakeLists.txt reads the three #define lines from the header with file(STRINGS) before project(), and fails to configure if one is missing or isn't a plain number. It adds the header to CMAKE_CONFIGURE_DEPENDS, so changing the version there reconfigures the build without rerunning CMake by hand. Everything after that still uses HIPOBJ_VERSION_* and HIPOBJ_LIBRARY_VERSION as before.
  • docs/conf.py reads the version from the header instead of CMakeLists.txt, so the documentation workflows no longer need to run when CMakeLists.txt changes; include/**/*.h already covers the header.
  • A comment in the header, above the macros, says that they're the only place the version is set and that CMakeLists.txt and docs/conf.py read them. The macros themselves are unchanged.

AGENTS.md says that the version is set only in the public header.

Testing: a RelWithDebInfo build with HIPOBJ_WERROR built without warnings and passed all 32 tests, including hipobj-install, hipobj-subproject, and the package tests, and the library is still libhipobj.so.0.1.0 with the soname libhipobj.so.0. In a copy of the tree, changing HIPOBJ_VERSION_MINOR to 2 made the next build reconfigure, giving project version 0.2.0 and libhipobj.so.0.2.0, and hipobj-install and hipobj-package-deb passed. Defining HIPOBJ_VERSION_PATCH as (0) stops configuring with an error naming the macro and the header. The documentation reports 0.1.0, and is the same whether it's built with CMake or with doxygen and sphinx-build -W directly. black, pylint, vermin, clang-format, cmakelint, actionlint, doc8, and codespell are clean.

The version was set twice, by the HIPOBJ_VERSION_* macros in
include/hipobj.h and by set() calls in the top-level CMakeLists.txt,
and the two had to be changed together. The header is now the only
place it's set.

- CMakeLists.txt reads the three #define lines from the header with
  file(STRINGS) before project(), and fails to configure if one is
  missing or isn't a plain number. It adds the header to
  CMAKE_CONFIGURE_DEPENDS, so changing the version there reconfigures
  the build without rerunning CMake by hand. Everything after that
  still uses HIPOBJ_VERSION_* and HIPOBJ_LIBRARY_VERSION as before.
- docs/conf.py reads the version from the header instead of
  CMakeLists.txt, so the documentation workflows no longer need to run
  when CMakeLists.txt changes; include/**/*.h already covers the
  header.
- A comment in the header, above the macros, says that they're the
  only place the version is set and that CMakeLists.txt and
  docs/conf.py read them. The macros themselves are unchanged.

AGENTS.md says that the version is set only in the public header.

Testing: a RelWithDebInfo build with HIPOBJ_WERROR built without
warnings and passed all 32 tests, including hipobj-install,
hipobj-subproject, and the package tests, and the library is still
libhipobj.so.0.1.0 with the soname libhipobj.so.0. In a copy of the
tree, changing HIPOBJ_VERSION_MINOR to 2 made the next build
reconfigure, giving project version 0.2.0 and libhipobj.so.0.2.0, and
hipobj-install and hipobj-package-deb passed. Defining
HIPOBJ_VERSION_PATCH as (0) stops configuring with an error naming
the macro and the header. The documentation reports 0.1.0, and is
the same whether it's built with CMake or with doxygen and
sphinx-build -W directly. black, pylint, vermin, clang-format,
cmakelint, actionlint, doc8, and codespell are clean.

Co-authored-by: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Version handling is consistent across builds and documentation, with no unresolved blocking findings.

No open issues 🎉

What changed in this PR

Makes include/hipobj.h the single source of hipObject’s version, keeping builds and documentation aligned without changing the public API.

Changes:

  • CMake reads and validates the header’s version macros and reconfigures when the header changes.
  • Sphinx reads the version directly from the header.
  • Updates contributor guidance and removes obsolete documentation workflow triggers.
File Description
include/​hipobj.h Documents the version macros as the sole source.
docs/​conf.py Reads the documentation version from the header.
CMakeLists.txt Parses version macros and tracks header changes.
AGENTS.md Updates versioning and workflow guidance.
.github/​workflows/​hipobject-documentation-deploy.yml Removes the CMakeLists.txt trigger.
.github/​workflows/​hipobject-documentation-check.yml Removes the CMakeLists.txt trigger.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor
Security scan found no critical or high findings on lines changed by this pull request

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

@derobins
derobins merged commit ce15fe8 into develop Oct 19, 2026
46 checks passed
@derobins
derobins deleted the derobins/single_source_of_truth branch October 19, 2026 01:20
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.

2 participants