Closed walbourn closed 6 years ago
Last year I updated DirectXMath to compile with clang. One of the issues I encountered is that clang does not define __m128
as a struct the way Visual C++ and the Intel compiler do. Instead it's defined as an opaque type. Because of C++ rules you're not able to overload just on the type. Therefore I added logic to remove those overloads when building with clang. I explain this in detail in this blog post
If you want a 'clean' build with clang, you need to turn off a bunch of warnings:
#ifdef __clang__
#pragma clang diagnostic ignored "-Wc++98-compat"
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
#pragma clang diagnostic ignored "-Wc++98-compat-local-type-template-args"
#pragma clang diagnostic ignored "-Wcast-align"
#pragma clang diagnostic ignored "-Wcovered-switch-default"
#pragma clang diagnostic ignored "-Wdouble-promotion"
#pragma clang diagnostic ignored "-Wexit-time-destructors"
#pragma clang diagnostic ignored "-Wfloat-equal"
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#pragma clang diagnostic ignored "-Wnested-anon-types"
#pragma clang diagnostic ignored "-Wnonportable-include-path"
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wswitch-enum"
#pragma clang diagnostic ignored "-Wtautological-type-limit-compare"
#pragma clang diagnostic ignored "-Wunused-const-variable"
#endif
The DirectXMath issues are fixed in this pull request along with clang x86 issues with InitOnceExecuteOnce
.
DirectX Tool Kit won't build with clang, primarily because it relies on the
XMVECTOR
operator overloads