File tree Expand file tree Collapse file tree 8 files changed +30
-17
lines changed
Expand file tree Collapse file tree 8 files changed +30
-17
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ option(OCIO_USE_AVX2 "Specify whether to enable AVX2 CPU performance optimizatio
270270option (OCIO_USE_AVX512 "Specify whether to enable AVX512 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX} )
271271option (OCIO_USE_F16C "Specify whether to enable F16C CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C} )
272272
273- if (APPLE )
273+ if (APPLE OR WIN32 )
274274 # TODO: Revisit whether that option is necessary.
275275 option (OCIO_USE_SSE2NEON "Specify whether to enable SSE CPU performance optimizations using SSE2NEON for Apple ARM architecture" ON )
276276 mark_as_advanced (OCIO_USE_SSE2NEON)
@@ -332,8 +332,10 @@ if(OCIO_USE_SIMD AND OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_ARM_NEON)
332332 add_library (sse2neon INTERFACE )
333333 # Add the include directories to the target.
334334 target_include_directories (sse2neon INTERFACE "${sse2neon_INCLUDE_DIR} " )
335- # Ignore the warnings coming from sse2neon.h as they are false positives.
336- target_compile_options (sse2neon INTERFACE -Wno-unused-parameter)
335+ if (NOT MSVC )
336+ # Ignore the warnings coming from sse2neon.h as they are false positives.
337+ target_compile_options (sse2neon INTERFACE -Wno-unused-parameter)
338+ endif ()
337339 endif ()
338340endif ()
339341
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ include(FetchContent)
1616set (FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR} /ext/build/sse2neon" )
1717FetchContent_Declare(sse2neon
1818 GIT_REPOSITORY https://github.com/DLTcollab/sse2neon.git
19- GIT_TAG v1.6.0
19+ GIT_TAG 227cc413fb2d50b2a10073087be96b59d5364aea
2020)
2121
2222# FetchContent_MakeAvailable is not available until CMake 3.14+.
@@ -38,6 +38,8 @@ if(NOT sse2neon_POPULATED)
3838 add_library (sse2neon INTERFACE )
3939 # Add the include directories to the target.
4040 target_include_directories (sse2neon INTERFACE "${sse2neon_INCLUDE_DIR} " )
41- # Ignore the warnings coming from sse2neon.h as they are false positives.
42- target_compile_options (sse2neon INTERFACE -Wno-unused-parameter)
41+ if (NOT MSVC )
42+ # Ignore the warnings coming from sse2neon.h as they are false positives.
43+ target_compile_options (sse2neon INTERFACE -Wno-unused-parameter)
44+ endif ()
4345endif ()
Original file line number Diff line number Diff line change @@ -6,8 +6,13 @@ include(CheckCXXSourceCompiles)
66set (_cmake_required_flags_orig "${CMAKE_REQUIRED_FLAGS} " )
77set (_cmake_required_includes_orig "${CMAKE_REQUIRED_INCLUDES} " )
88set (_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES} " )
9+ set (_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS} " )
910
10- if (APPLE AND COMPILER_SUPPORTS_ARM_NEON)
11+ if (MSVC )
12+ set (CMAKE_CXX_FLAGS "/Zc:preprocessor" )
13+ endif ()
14+
15+ if ((APPLE OR WIN32 ) AND COMPILER_SUPPORTS_ARM_NEON)
1116
1217 if ("${CMAKE_OSX_ARCHITECTURES} " MATCHES "arm64;x86_64" OR
1318 "${CMAKE_OSX_ARCHITECTURES} " MATCHES "x86_64;arm64" )
@@ -63,8 +68,9 @@ endif()
6368set (CMAKE_REQUIRED_FLAGS "${_cmake_required_flags_orig} " )
6469set (CMAKE_REQUIRED_INCLUDES "${_cmake_required_includes_orig} " )
6570set (CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig} " )
71+ set (CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig} " )
6672
6773unset (_cmake_required_flags_orig)
6874unset (_cmake_required_includes_orig)
6975unset (_cmake_osx_architectures_orig)
70-
76+ unset (_cmake_cxx_flags_orig)
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ if(OCIO_USE_SIMD)
1919 if (OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_ARM_NEON)
2020 include (CheckSupportSSEUsingSSE2NEON)
2121 if (NOT COMPILER_SUPPORTS_SSE_WITH_SSE2NEON)
22+ # Enable the "new" preprocessor, to more closely match Clang/GCC, required for sse2neon
23+ set (PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS} ;/Zc:preprocessor" )
24+ else ()
2225 set (OCIO_USE_SSE2NEON OFF )
2326 endif ()
2427 endif ()
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ CPUInfo::CPUInfo()
183183 }
184184}
185185
186- #elif defined(__aarch64__) // ARM Processor or Apple ARM.
186+ #elif defined(__aarch64__) || defined(_M_ARM64) // ARM Processor or Apple ARM.
187187
188188CPUInfo::CPUInfo ()
189189{
Original file line number Diff line number Diff line change 66#cmakedefine01 OCIO_ARCH_X86_32
77
88// Relevant only for arm64 architecture.
9- #if defined(__aarch64__ )
9+ #if defined(__aarch64__ ) || defined( _M_ARM64 )
1010 #cmakedefine01 OCIO_USE_SSE2NEON
1111#else
1212 #define OCIO_USE_SSE2NEON 0
2323
2424// Building for x86_64 processor on a non-ARM host architecture
2525// OR Building on/for an ARM architecture and using SSE2NEON.
26- #if (OCIO_ARCH_X86 && !defined(__aarch64__ )) || (defined(__aarch64__ ) && OCIO_USE_SSE2NEON )
26+ #if (OCIO_ARCH_X86 && !defined(__aarch64__ )) || (( defined(__aarch64__ ) || defined( _M_ARM64 ) ) && OCIO_USE_SSE2NEON )
2727 #cmakedefine01 OCIO_USE_SSE2
2828 #cmakedefine01 OCIO_USE_SSE3
2929 #cmakedefine01 OCIO_USE_SSSE3
Original file line number Diff line number Diff line change 99#if OCIO_USE_SSE2
1010
1111// Include the appropriate SIMD intrinsics header based on the architecture (Intel vs. ARM).
12- #if !defined(__aarch64__)
12+ #if !defined(__aarch64__) && !defined(_M_ARM64)
1313 #if OCIO_USE_SSE2
1414 #include < emmintrin.h>
1515 #endif
16- #elif defined(__aarch64__)
16+ #elif defined(__aarch64__) || defined(_M_ARM64)
1717 // ARM architecture A64 (ARM64)
1818 #if OCIO_USE_SSE2NEON
1919 #include < sse2neon.h>
@@ -30,7 +30,7 @@ namespace OCIO_NAMESPACE
3030// Note that it is important for the code below this ifdef stays in the OCIO_NAMESPACE since
3131// it is redefining two of the functions from sse2neon.
3232
33- #if defined(__aarch64__)
33+ #if defined(__aarch64__) || defined(_M_ARM64)
3434 #if OCIO_USE_SSE2NEON
3535 // Using vmaxnmq_f32 and vminnmq_f32 rather than sse2neon's vmaxq_f32 and vminq_f32 due to
3636 // NaN handling. This doesn't seem to be significantly slower than the default sse2neon behavior.
Original file line number Diff line number Diff line change 99#if OCIO_USE_SSE2
1010
1111// Include the appropriate SIMD intrinsics header based on the architecture (Intel vs. ARM).
12- #if !defined(__aarch64__)
12+ #if !defined(__aarch64__) && !defined(_M_ARM64)
1313 #include < emmintrin.h>
14- #elif defined(__aarch64__)
14+ #elif defined(__aarch64__) || defined(_M_ARM64)
1515 // ARM architecture A64 (ARM64)
1616 #if OCIO_USE_SSE2NEON
1717 #include < sse2neon.h>
@@ -30,7 +30,7 @@ namespace OCIO_NAMESPACE
3030// Note that it is important for the code below this ifdef stays in the OCIO_NAMESPACE since
3131// it is redefining two of the functions from sse2neon.
3232
33- #if defined(__aarch64__)
33+ #if defined(__aarch64__) || defined(_M_ARM64)
3434 #if OCIO_USE_SSE2NEON
3535 // Using vmaxnmq_f32 and vminnmq_f32 rather than sse2neon's vmaxq_f32 and vminq_f32 due to
3636 // NaN handling. This doesn't seem to be significantly slower than the default sse2neon behavior.
You can’t perform that action at this time.
0 commit comments