recp / cglm

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
MIT License
2.34k stars 231 forks source link

Support for ARM and UWP #161

Open suyashmohan opened 4 years ago

suyashmohan commented 4 years ago

I am trying to add cglm to vcpkg https://github.com/microsoft/vcpkg/pull/13510

Apparently, CI pipeline have tests for all platforms and cglm is failing for ARM Windows UWP platform.

D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\include\cglm\vec4-ext.h(47,39): error C2719: 'd': formal parameter with requested alignment of 16 won't be aligned (compiling source file D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\src\euler.c) [D:\buildtrees\cglm\arm-uwp-dbg\cglm.vcxproj]
     4>D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\include\cglm\vec4-ext.h(63,34): error C2719: 'v': formal parameter with requested alignment of 16 won't be aligned (compiling source file D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\src\euler.c) [D:\buildtrees\cglm\arm-uwp-dbg\cglm.vcxproj]
     4>D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\include\cglm\vec4-ext.h(79,32): error C2719: 'v': formal parameter with requested alignment of 16 won't be aligned (compiling source file D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\src\euler.c) [D:\buildtrees\cglm\arm-uwp-dbg\cglm.vcxproj]
     4>D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\include\cglm\vec4-ext.h(94,36): error C2719: 'v': formal parameter with requested alignment of 16 won't be aligned (compiling source file D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\src\euler.c) [D:\buildtrees\cglm\arm-uwp-dbg\cglm.vcxproj]
     4>D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\include\cglm\vec4-ext.h(108,25): error C2719: 'v': formal parameter with requested alignment of 16 won't be aligned (compiling source file D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\src\euler.c) [D:\buildtrees\cglm\arm-uwp-dbg\cglm.vcxproj]
     4>D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\include\cglm\vec4-ext.h(120,30): error C2719: 'a': formal parameter with requested alignment of 16 won't be aligned (compiling source file D:\buildtrees\cglm\src\v0.7.8-ef8c98816b.clean\src\euler.c) [D:\buildtrees\cglm\arm-uwp-dbg\cglm.vcxproj]

Is there anything that needs to be added to CMake options or is it not supported by library? arm64_windows and x64_uwp are okay. It's just arm_uwp that had issue

recp commented 4 years ago

Hi @suyashmohan

Thanks for vcpkg support.

AFAIK, MSVC don't support to align function-parameters in older VC++ versions. So it is disabled in older Visual Studio versions:

include/cglm/types.h:

#if defined(_MSC_VER)
/* do not use alignment for older visual studio versions */
#  if _MSC_VER < 1913 /*  Visual Studio 2017 version 15.6  */
#    define CGLM_ALL_UNALIGNED
#    define CGLM_ALIGN(X) /* no alignment */
#  else
#    define CGLM_ALIGN(X) __declspec(align(X))
#  endif
#else
#  define CGLM_ALIGN(X) __attribute((aligned(X)))
#endif

I didn't test this with CMake and ARM Windows, maybe we can/must disable alignment where we cannot support. Defining CGLM_ALL_UNALIGNED will disable alignments if needed, also making CGLM_ALIGN empty is good idea as above

Is _MSC_VER defined in your case?


Similar issue: https://github.com/recp/cglm/issues/4

suyashmohan commented 4 years ago

I went through a lazy route. I disabled ARM port for now. Sorry 😅 I am new to vcpkg and cmake. I also don't have any resources, only option to debug is to make PRs to official repo to trigger tests on arm-uwp platform.

recp commented 4 years ago

No problem, we should fix this issue for the future

waywardmonkeys commented 9 months ago

This is still happening, noticed while getting CI working in #386.

recp commented 9 months ago

@waywardmonkeys thanks for reporting, will check again asap 👍