Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version: add static hpdf_version.h header #241

Merged
merged 2 commits into from
Sep 22, 2022
Merged

version: add static hpdf_version.h header #241

merged 2 commits into from
Sep 22, 2022

Conversation

vszakats
Copy link
Contributor

Store the libharu version number values (major/minor/bugfix and suffix) in the C header include/hpdf_version.h. Generate HPDF_VERSION_TEXT and HPDF_VERSION_ID from these values using the C preprocessor.

To make the version number available to CMake, add CMake logic that automatically pulls these values from the C header.

After this patch, the libharu version number is available to dependents without running CMake first, or without running CMake at all, making the source tree build-system agnostic. All the while retaining the advantage of having to maintain/update the version number at a single place.

While here, make sure to include hpdf_version.h from hpdf.h again, so existing apps do not need to be modified to access the version numbers.

This restores compatibility with pre-2.4.1 releases, where version number was accessible from C without custom build steps, and always available to users when including hpdf.h.

Ref: #237

include/hpdf_version.h Outdated Show resolved Hide resolved
Store the libharu version number values (major/minor/bugfix and suffix)
in the C header `include/hpdf_version.h`. Generate `HPDF_VERSION_TEXT`
and `HPDF_VERSION_ID` from these values using the C preprocessor.

To make the version number available to CMake, add CMake logic that
automatically pulls these values from the C header.

After this patch, the libharu version number is available to dependents
without running CMake first, or without running CMake at all, making
the source tree build-system agnostic. All the while retaining the
advantage of having to maintain/update the version number at a single
place.

While here, make sure to include `hpdf_version.h` from `hpdf.h` again,
so existing apps do not need to be modified to access the version
numbers.

This restores compatibility with pre-2.4.1 releases, where version
number was accessible from C without custom build steps, and always
available to users when including `hpdf.h`.

Ref: #237
@bramton bramton changed the base branch from master to devel September 22, 2022 13:20
@bramton
Copy link
Member

bramton commented Sep 22, 2022

Thanks! (Though, IMHO the bunch of regular expressions are a bit sore to the eye 😄)

@bramton bramton closed this Sep 22, 2022
@bramton bramton reopened this Sep 22, 2022
@bramton bramton merged commit e9aa8c7 into libharu:devel Sep 22, 2022
@vszakats vszakats deleted the ver-to-c-header branch September 22, 2022 14:31
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.

None yet

2 participants