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

changed STREQUAL to MATCHES #595

Merged
merged 1 commit into from
Mar 30, 2024
Merged

changed STREQUAL to MATCHES #595

merged 1 commit into from
Mar 30, 2024

Conversation

zerothi
Copy link
Contributor

@zerothi zerothi commented Mar 19, 2024

This changes the logic in the CMake infrastructure somewhat.

STREQUAL is an exact match.
MATCHES just matches a string in the full string.
E.g.

... MATCHES ABC

will find for "fooABCbar" and all variants where ABC is present. This may sometimes not be decired.
However, in the case for compilers and systems, using matches may be the best choice to allow smaller variations of variables (coming down the road).

In this change SYSTEM_PROCESSOR will now use MATCHES instead of STREQUAL.
The original code could be dated back to 2015 in
1c36bf1.

The same goes for the compiler specifications.
Now MATCHES allows a greater variability in the
compiler naming conventions. This change results
in some logic changes (should be changed if not
desired).

For instance this change:

  • elseif(CMAKE_C_COMPILER_ID STREQUAL Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 13)
  • elseif(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 13)

results in ALTIVEC=TRUE for AppleClang compilers at versions >=13. It did not previously.

While MATCHES Intel will also match IntelLLVM I have added explicit IntelLLVM to make it clear the
intent, this is strictly not needed due to the
above.

This changes the logic in the CMake infrastructure somewhat.

STREQUAL is an exact match.
MATCHES just matches a string in the full string.
E.g.

  ... MATCHES ABC

will find for "fooABCbar" and all variants where ABC
is present. This may sometimes not be decired.
However, in the case for compilers and systems, using
matches may be the best choice to allow smaller variations
of variables (coming down the road).

In this change SYSTEM_PROCESSOR will now use MATCHES
instead of STREQUAL.
The original code could be dated back to 2015 in
1c36bf1.

The same goes for the compiler specifications.
Now MATCHES allows a greater variability in the
compiler naming conventions. This change results
in some logic changes (should be changed if not
desired).

For instance this change:

-    elseif(CMAKE_C_COMPILER_ID STREQUAL Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 13)
+    elseif(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 13)

results in ALTIVEC=TRUE for AppleClang compilers at versions >=13.
It did not previously.

While MATCHES Intel will also match IntelLLVM I have
added explicit IntelLLVM to make it clear the
intent, this is strictly not needed due to the
above.

Signed-off-by: Nick Papior <[email protected]>
@zerothi
Copy link
Contributor Author

zerothi commented Mar 19, 2024

This should solve #533, but I haven't tested it yet!

Would something like this be applicable?

@FrancescAlted
Copy link
Member

This should solve #533, but I haven't tested it yet!

Would something like this be applicable?

Indeed. Keep us informed if this is enough and I will be happy to merge. Thanks!

@FrancescAlted FrancescAlted merged commit 8d1c482 into Blosc:main Mar 30, 2024
17 checks passed
@zerothi
Copy link
Contributor Author

zerothi commented Apr 3, 2024

Thanks!

FYI, I just tried this with Intel oneAPI 2024.0.1.46, and the built succeeds, though with some warnings related to unknown arguments when building zlib-ng.

Other than that, everything runs smoothly. All 1745 tests pass! :)

@zerothi zerothi deleted the compilers branch April 3, 2024 07:30
@KingKarp4
Copy link

KingKarp4 commented Apr 20, 2024 via email

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.

3 participants