8000 Fix lib version by xantares · Pull Request #237 · libharu/libharu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix lib version #237

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

Closed
wants to merge 1 commit into from
Closed

Fix lib version #237

wants to merge 1 commit into from

Conversation

xantares
Copy link
@xantares xantares commented Sep 2, 2022

No description provided.

@bramton
Copy link
Member
bramton commented Sep 5, 2022

Commit 9c5d084 nows sets the lib version based on the version defined in CMakelists.txt.

@bramton bramton closed this Sep 5, 2022
@vszakats
Copy link
Contributor
vszakats commented Sep 5, 2022

This commit makes CMake a required component/step. IOW it is now impossible to build libharu without first running CMake to generate the libharu version string. This could be fixed by (re)storing the canonical version number in a header file, so it remains available without any build-system-specific logic.

Also, by deleting HPDF_{MAJOR,MINOR,BUGFIX}_VERSION and HPDF_VERSION_ID, now it's also impossible to do compile-time detection of libharu version and including/excluding features accordingly.

Can these be restored in a non-generated header?

@xantares xantares deleted the patch-1 branch September 6, 2022 08:24
@acmiyaguchi
Copy link

One concrete place where this causes issues is in VTK, which relies on parsing from the hpdf_version.h header during library discovery in cmake. I do think this particular issue can be fixed downstream in VTK itself, but I wanted to mention it here since it took me a few hours to find.

https://github.com/Kitware/VTK/blob/9203514a8c93ab78fadd4c89e6d512628764aafb/CMake/FindLibHaru.cmake#L16-L22

bramton pushed a commit that referenced this pull request Sep 9, 2022
@bramton
Copy link
Member
bramton commented Sep 9, 2022

@vszakats defining the version number at different locations will be very prone to errors. I will just leave it as it is. Packaged versions of libharu will just include the generated include file, and won't require CMake for generating this file.

@vszakats @acmiyaguchi I realise now that I have been a bit to rigourous with the removal of these version defines. My apologies. Please have a look at the proposed PR #239, and let me know if you have any comments.

@vszakats
Copy link
Contributor
vszakats commented Sep 9, 2022

@bramton: No worries and thanks for your follow-up on this. #239 solves half of the problem, but since it uses CMake config files as the source of truth for version numbers, they are not available when pulling the source tree (such as the release archive) and using the C sources as-is, without CMake.

Storing the version numbers in hpdf_version.h would fix this, and in case CMake itself needs the version number for some reason, it may retrieve it from this header file, either via a regexp, a custom detection step or something alike.

@acmiyaguchi
Copy link

I appreciate the fast response relative to my comment. A generated include file should resolve issues on my end since I depend on a packaged version of the library.

bramton pushed a commit that referenced this pull request Sep 22, 2022
* version: add static hpdf_version.h header

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
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.

4 participants
0