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

Fix and improve building with clang-cl #251

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fanc999
Copy link
Contributor

@fanc999 fanc999 commented May 11, 2022

Hi,

This attempts to fix building with clang-cl (the clang compiler that attempts to be MSVC compatible), by:

  • Fixing graphene-macros.h by checking for the existance of __GNUC__ before trying to check its value, since clang-cl defines _MSC_VER but not __GNUC__, unlike clang on *NIX.
  • Improve detection of compiler flags used for clang-cl, which follows more the ones used on GCC than Visual Studio, and filter out those that aren't supported. Also, force -msse4.1 since that is required for bulding the SSE 4.1 code on clang-cl.
  • Disable the deprecation warnings that result form the Visual Studio headers, which clang-cl utilizes.
  • For the SSE/ARM NEON SIMD implementations, make clang-cl follow the GCC codepath, since __extension__ is supported there as well.

With blessings, thank you!

fanc999-1 added 4 commits May 9, 2022 21:55
clang-cl does not like it if we try to check values of __GNUC__ without first
checking whether it is defined, so fix things up here.  clang-cl defines
_MSC_VER and __clang__ but not __GNUC__.
clang-cl follows some of the compiler flags that are used for GCC, but not all
them, so make sure that we don't try to use the compiler flags that it does not
understand.

Since the Visual Studio headers and libraries that clang-cl uses supported
SSE 4.1 for a very long while, even before the inception of clang-cl, always
pass in '-msse4.1' in the cflags when we are building with clang-cl (and it is
needed, otherwise the build fails).
We can actually turn off the deprecation warnings from the Visual Studio
headers that clang-cl uses, so let's do that.
...for SSE and ARM NEON intrinsics, since the __extension__ stuff is supported
on clang-cl.  Update the error messages accordingly.
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