Skip to content

Commit 1516226

Browse files
build: Add arm_neon.h include on Windows ARM64 with clang-cl (AcademySoftwareFoundation#4691)
On Windows ARM64, when building with clang-cl, LLVM can sometimes use it's own built-in intrin.h file, located in `<LLVM INSTALL PATH>\lib\clang\20\include`. This file, as opposed to the built-in one that ships with the Windows SDK that MSVC uses, doesn't have an inclusion of arm_neon.h. This PR adds a small check to the simd.h file to include this header. I didn't add an extra check to specifically only do this for clang, as it seemed a little messy - I can do this, but it's relatively harmless for MSVC given intrin.h includes it anyway for that compiler. This change has already been in place for some time in Blender, this is just an upstreaming PR for that change: https://projects.blender.org/blender/blender/src/commit/ea604b6b80e49adb51d12df4e4edd5af1c51f446/build_files/build_environment/patches/oiio_windows_arm64.diff
1 parent 5e5e09c commit 1516226

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/include/OpenImageIO/simd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@
115115
// Cuda -- don't include any of these headers
116116
#elif defined(_WIN32)
117117
# include <intrin.h>
118+
// MSVC's intrin.h includes arm_neon.h, clang (and by extension clang-cl)
119+
// has a version without this inclusion, so we need to manually add it
120+
# if defined(__ARM_NEON__) && !defined(OIIO_NO_NEON)
121+
# include <arm_neon.h>
122+
# endif
118123
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) || defined(__e2k__)
119124
# include <x86intrin.h>
120125
#elif defined(__GNUC__) && defined(__ARM_NEON__) && !defined(OIIO_NO_NEON)

0 commit comments

Comments
 (0)