diff --git a/Build/CMakeLists.txt b/Build/CMakeLists.txt index f701a55a9..50b7c80d4 100644 --- a/Build/CMakeLists.txt +++ b/Build/CMakeLists.txt @@ -297,6 +297,7 @@ function(SET_INTERPROCEDURAL_OPTIMIZATION) # On ARM, whole program optimization triggers an internal compiler error during code gen, so we don't turn it on # When compiling as a shared lib with MinGW, turning on LTO causes errors of the form 'ld.exe: cannot export symbol X wrong type (4 vs 3)' if (INTERPROCEDURAL_OPTIMIZATION + AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64EC") AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64") AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM") AND (NOT CROSS_COMPILE_ARM OR ("${CROSS_COMPILE_ARM_TARGET}" STREQUAL "aarch64-linux-gnu")) diff --git a/Build/cmake_vs2022_cl_arm_ec.bat b/Build/cmake_vs2022_cl_arm_ec.bat new file mode 100644 index 000000000..f29732fe1 --- /dev/null +++ b/Build/cmake_vs2022_cl_arm_ec.bat @@ -0,0 +1,3 @@ +@echo off +cmake -S . -B VS2022_CL_ARM_EC -G "Visual Studio 17 2022" -A ARM64EC %* +echo Open VS2022_CL_ARM_EC\JoltPhysics.sln to build the project. \ No newline at end of file diff --git a/Jolt/Core/Core.h b/Jolt/Core/Core.h index 321c90c3f..1690e623e 100644 --- a/Jolt/Core/Core.h +++ b/Jolt/Core/Core.h @@ -117,7 +117,20 @@ #endif // Detect CPU architecture -#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) +#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM) || defined(_M_ARM64EC) + // ARM CPU architecture + #define JPH_CPU_ARM + #if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) + #define JPH_CPU_ARCH_BITS 64 + #define JPH_USE_NEON + #define JPH_VECTOR_ALIGNMENT 16 + #define JPH_DVECTOR_ALIGNMENT 32 + #else + #define JPH_CPU_ARCH_BITS 32 + #define JPH_VECTOR_ALIGNMENT 8 // 32-bit ARM does not support aligning on the stack on 16 byte boundaries + #define JPH_DVECTOR_ALIGNMENT 8 + #endif +#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) // X86 CPU architecture #define JPH_CPU_X86 #if defined(__x86_64__) || defined(_M_X64) @@ -167,19 +180,6 @@ #error Undefined compiler #endif #endif -#elif defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM) - // ARM CPU architecture - #define JPH_CPU_ARM - #if defined(__aarch64__) || defined(_M_ARM64) - #define JPH_CPU_ARCH_BITS 64 - #define JPH_USE_NEON - #define JPH_VECTOR_ALIGNMENT 16 - #define JPH_DVECTOR_ALIGNMENT 32 - #else - #define JPH_CPU_ARCH_BITS 32 - #define JPH_VECTOR_ALIGNMENT 8 // 32-bit ARM does not support aligning on the stack on 16 byte boundaries - #define JPH_DVECTOR_ALIGNMENT 8 - #endif #elif defined(__riscv) // RISC-V CPU architecture #define JPH_CPU_RISCV