Skip to content

xtensor: Make HighFive compatible with 0.26. - #36

Merged
1uc merged 1 commit into
mainfrom
1uc/update-xtensor
Jun 3, 2025
Merged

xtensor: Make HighFive compatible with 0.26.#36
1uc merged 1 commit into
mainfrom
1uc/update-xtensor

Conversation

@1uc

@1uc1uc commented Apr 27, 2025

Copy link
Copy Markdown
Contributor

XTensor reorganized its headers in 0.26. This commit introduces come logic to guess the correct path: if the compiler is C++17 or later, use __has_include to check both locations; otherwise it must be an xtensor version prior to 0.26, because 0.26 onwards require a C++17 compiler.

What makes this all a bit more fun is that:

  • There's no common header, that would allow us to get an XTensor version number.
  • MSVC sets __cplusplus to 199711 regardless of the requested C++ standard.
  • Spack doesn't have the new version yet.

@1uc
1uc marked this pull request as draft April 27, 2025 16:39
@1uc
1ucforce-pushed the 1uc/update-xtensor branch from 10fca9b to ac640aeCompareApril 27, 2025 16:53
@codecov

codecovBot commented Apr 27, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@1uc
1ucforce-pushed the 1uc/update-xtensor branch 7 times, most recently from e33138c to a4b60f8CompareMay 3, 2025 14:53
@1uc
1uc marked this pull request as ready for review May 13, 2025 14:50
@1uc

1uc commented May 13, 2025

Copy link
Copy Markdown
ContributorAuthor

@matz-e could you please have a look? It doesn't feel clean, but I also completely out of any other ideas. The good feature of this approach is that it can be overridden, e.g. if a user does #include <xtensor/xtensor.hpp> then they can use HighFive reliably (and with CMake fuss) by making the following change:

#define HIGHFIVE_XTENSOR_HEADER_VERSION 1
#include <highfive/xtensor.hpp>

@1uc
1ucforce-pushed the 1uc/update-xtensor branch 2 times, most recently from 3095ec5 to 5dff8c0CompareMay 30, 2025 18:57
XTensor reorganized its headers in 0.26. This commit introduces come
logic to guess the correct path: if the compiler is C++17 or later, use
`__has_include` to check both locations; otherwise it must be an xtensor
version prior to 0.26, because 0.26 onwards require a C++17 compiler.
@1uc
1ucforce-pushed the 1uc/update-xtensor branch from 5dff8c0 to 85d1064CompareMay 30, 2025 19:09
@sonarqubecloud

Copy link
Copy Markdown

@1uc

1uc commented Jun 3, 2025

Copy link
Copy Markdown
ContributorAuthor

I'm merging this because I still don't have a better idea and I want CI to be green again.

@1uc
1uc merged commit 599bb32 into mainJun 3, 2025
@1uc
1uc deleted the 1uc/update-xtensor branch June 3, 2025 20:10
Sign up for freeto 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.

1 participant

@1uc