Skip to content

CMake: misc. build fixes for older toolchains#181

Open
robUx4 wants to merge 5 commits intoAcademySoftwareFoundation:mainfrom
robUx4:misc-cmake
Open

CMake: misc. build fixes for older toolchains#181
robUx4 wants to merge 5 commits intoAcademySoftwareFoundation:mainfrom
robUx4:misc-cmake

Conversation

@robUx4
Copy link

@robUx4 robUx4 commented Jan 15, 2026

  • use _WIN32 to detect Windows builds consistently (pthread.h was included on Windows)
  • set strict C99 via the proper CMake commands
  • don't add compiler flags not supported by the compiler
  • check the compiler supports _mm256_setr_m128i(). Some older AVX2 compilers don't have it, but it's possible to use a macro instead 1.

Footnotes

  1. https://stackoverflow.com/a/32630658/1266123

@robUx4 robUx4 changed the title CMake: check _mm256_setr_m128i is supported CMake: misc. build fixes for older toolchains Jan 15, 2026
@robUx4 robUx4 force-pushed the misc-cmake branch 3 times, most recently from 24df7e0 to 5524000 Compare January 15, 2026 07:51
Copy link
Contributor

@Anemptyship Anemptyship left a comment

Choose a reason for hiding this comment

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

Please check my comment. Thanks!

It's set by all Windows compilers, including x86_64 and arm64.
Otherwise pthread.h is included instead of windows.h/process.h in oapv_tpool.c.

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
It can generate some warnings or compilations errors.

The official CMake way of picking the thread library [^1] should probably be used for non-Windows targets.

[^1]: https://cmake.org/cmake/help/latest/module/FindThreads.html

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Some older AVX2 compilers don't have it, but it's possible to use a macro instead [^1].

[^1]: https://stackoverflow.com/a/32630658/1266123

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
@robUx4
Copy link
Author

robUx4 commented Jan 16, 2026

I updated the commit that uses CMAKE_C_STANDARD to remove the hardcoded -std=c99 in the same commit. I also updated the documentation of why _WIN32 should be used to detect Windows.

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