Napoleon314 / XMath

Modified DirectXMath for cross-platform compiling
32 stars 5 forks source link

Problem compiling on Android NDK #1

Open albertodemichelis opened 7 years ago

albertodemichelis commented 7 years ago

Hi, I tried to compile a project with your XMath with android's NDK (r12b) and It generated loads of errors. Most of the errors seem related to vector type conversion(uint32x4_t to float32x4_t etc...). Is there any compiler flag that is required for compiling on android?

my settings are like this and I've set "-flax-vector-conversions"

#define BUILD_INTRINSICS_LEVEL 1
#if defined(QN_ANDROID)
#define BUILD_ARCH_ARM
#define VE_COMPILER_GCC
#define BUILD_PLATFORM_ANDROID

#elif defined(QN_IOS)
#define BUILD_ARCH_ARM
#define VE_COMPILER_GCC
#define BUILD_PLATFORM_IOS

#elif defined(QN_LINUX)
#define VE_COMPILER_GCC
#endif

#if defined(BUILD_ARCH_ARM)
#   if  BUILD_INTRINSICS_LEVEL > 0
#       define _XM_ARM_NEON_INTRINSICS_
#   else
#       define _XM_NO_INTRINSICS_
#   endif
#else
#   if BUILD_INTRINSICS_LEVEL > 0
#       define _XM_SSE_INTRINSICS_
#   endif
#   if BUILD_INTRINSICS_LEVEL > 1
#       define _XM_SSE3_INTRINSICS_
#       define _XM_SSE4_INTRINSICS_
#       define _XM_AVX_INTRINSICS_
#   endif
#   if BUILD_INTRINSICS_LEVEL > 2
#       define _XM_F16C_INTRINSICS_
#   endif
#endif
#if defined(VE_COMPILER_GCC) || defined(BUILD_PLATFORM_IOS)
#   define _XM_NO_CALL_CONVENTION_
#   include <stdint.h>
#endif
#if defined(BUILD_PLATFORM_IOS) || defined(BUILD_PLATFORM_ANDROID)
#   define _XM_ARM_NEON_NO_ALIGN_
#endif

thank you Alberto

Napoleon314 commented 7 years ago

My testing environment is visual studio 2015 android. The compiler seems to be different from the official one. It may have to be modified, but I can not do that right now. I will check it when I be back to Australia. Thank you for you reporting. I appreciate it.

Napoleon314 commented 7 years ago

Did you compile you code with gcc? I have tested it only with clang

albertodemichelis commented 7 years ago

Thank you for the quick reply. Yes I use gcc, that might be the problem.