Visitar URL original
Only build perf_counters if tests are enabled by wader · Pull Request #3541 · google/highway · GitHub
Skip to content

Only build perf_counters if tests are enabled - #3541

Open
wader wants to merge 1 commit into
google:masterfrom
wader:perf_counters-only-test
Open

wader wants to merge 1 commit into
google:masterfrom
wader:perf_counters-only-test

Conversation

@wader

@wader wader commented Nov 10, 2026

Copy link
Copy Markdown

Makes it possible to build library without linux headers installed. Wihtout build fails on including linux/perf_event.h

Was noticed in alpine container where linux headers are not installed by default.

Makes it possible to build library without linux headers installed.
Wihtout build fails on including linux/perf_event.h

Was noticed in alpine container where linux headers are not installed
by default.
@wader

wader commented Nov 10, 2026

Copy link
Copy Markdown
Author

Don't know much about cmake or meason so reused existing test only pattern

@jan-wassenberg jan-wassenberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for reporting. This is not actually test-only, and adding a separate library for this is undesirable. What we could do is gate/prevent the include:

#ifndef HWY_HAVE_PERF_COUNTERS  // allow override
#if HWY_OS_LINUX || HWY_IDE
#if defined(__has_include)  // note: wrapper macro fails on Clang ~17
// clang-format off
#if __has_include(<linux/perf_event.h>)
// clang-format on
#define HWY_HAVE_PERF_COUNTERS 1
#endif  // __has_include
#endif  // defined(__has_include)
#endif  // HWY_OS_LINUX || HWY_IDE
#ifndef HWY_HAVE_PERF_COUNTERS
#define HWY_HAVE_PERF_COUNTERS 0
#endif
#endif  // HWY_HAVE_PERF_COUNTERS

Would you like to make this change? If so, please also add perf_counters.h to HWY_SOURCES in CMakeLists.txt and hwy_headers in meson.build.

This branch has not been deployed

No deployments
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