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

xxhash: Add header_only option #25795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vasama
Copy link
Contributor

@vasama vasama commented Nov 2, 2024

Summary

Changes to recipe: xxhash/0.8.2

Motivation

  • XXH_STATIC_LINKING_ONLY enables static allocation of hash states. This is important for performance reasons.
  • The header-only mode allows inlining the hashing functions in the caller. This is important for performance reasons.

Closes #25778.

Details

  • Add header_only option (default: false), define XXH_INLINE_ALL in consumers in header-only mode.
  • Define XXH_STATIC_LINKING_ONLY in consumers when the package is not a shared library.
  • Improve the test package to test linking in header-only mode.

Define XXH_STATIC_LINKING_ONLY in consumers when the package is not a shared library.
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

Warning

Conan Center will stop receiving updates for Conan 1.x packages soon - please see announcement.

All green in build 1 (455672d8ee282295ac9e786a818b9da1b760e104):

  • xxhash/0.8.0:
    Built 25 packages out of 27 (All logs)

  • xxhash/0.8.2:
    Built 25 packages out of 27 (All logs)

  • xxhash/0.8.1:
    Built 25 packages out of 27 (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 1 (455672d8ee282295ac9e786a818b9da1b760e104):

  • xxhash/0.8.2:
    All packages built successfully! (All logs)

  • xxhash/0.8.1:
    All packages built successfully! (All logs)

  • xxhash/0.8.0:
    All packages built successfully! (All logs)

@AbrilRBS AbrilRBS self-assigned this Nov 4, 2024
@uilianries uilianries self-assigned this Nov 5, 2024
Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

Thank you for your suggestion.

I understand your point of view about performance benefit, but it's a feature/build to be discussed with the upstream first.

Conan tries to keep as closer as possible to the upstream implementation, and there is no such header-only option supported right now in the upstream.

The XXH_STATIC_LINKING_ONLY is always defined as well.

The Makefile build both static and shared library, but does not offer a header-only option.

The unofficial CMakeLists.txt has support for both static and shared library, but not for header-only.

Plus, checking other package managers, I did not find any of them offering such approach, so I would prefer not integrating this change to the current recipe as we will be maintaining a non-official build.

Please, discuss with the upstream, trying to integrate a header-only option there first.

@vasama
Copy link
Contributor Author

vasama commented Nov 6, 2024

The XXH_STATIC_LINKING_ONLY is always defined as well.

It needs to be defined for the consumers as well. When this macro is not defined, the internal types are not defined in the header. The implementation defines it because it needs access to those types. Consumers need access to those types in order to allocate them statically. As the naming suggest, this macro should only be defined when linking statically, which is what this PR does.

Please, discuss with the upstream, trying to integrate a header-only option there first.

Header-only usage is something explicitly supported by upstream. See here. It's presumably not part of the build scripts because header-only usage doesn't actually require any build steps. So to be clear, before accepting this, upstream needs a CMake option that builds nothing and installs just the header?

@vasama
Copy link
Contributor Author

vasama commented Nov 12, 2024

So to be clear, before accepting this, upstream needs a CMake option that builds nothing and installs just the header?

@uilianries are you able to clarify this?

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.

[package] xxhash/0.8.2: missing options
4 participants