Skip to content

Commit 1378f6b

Browse files
committed
[CMAKE] Fix ARM64 build
Since VS 17.14.36203.30 / MSVC 19.44.35209.0 the default behavior on ARM64 is to not inline _Interlocked* functions. Until we have those implemented, we disable this feature, going back to the old behavior. For additional details / tracking of the implementation see CORE-20255
1 parent 6ed46ba commit 1378f6b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sdk/cmake/msvc.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ if(ARCH STREQUAL "amd64" AND MSVC_VERSION GREATER 1922)
7878
add_link_options(/d2:-FH4-)
7979
endif()
8080

81+
# Workaround: Newer ARM64 builds do not inline interlocked functions by default.
82+
# A better fix would be to implement the interlocked functions in assembly.
83+
# See https://devblogs.microsoft.com/cppblog/introducing-the-forceinterlockedfunctions-switch-for-arm64/
84+
if(ARCH STREQUAL "arm64" AND MSVC_VERSION GREATER_EQUAL 1944)
85+
message(STATUS "Forcing interlocked functions to be inlined for ARM64 builds")
86+
add_compile_options("/forceInterlockedFunctions-")
87+
endif()
88+
8189
# Generate Warnings Level 3
8290
add_compile_options(/W3)
8391

0 commit comments

Comments
 (0)