Windows ARM64: Workaround #134676

PR as discussed on the thread for #134676.

Works by disabling dependent load flag in OIDN, and also switching off OpenMP.

The OIDN bit is just a workaround until they can resolve this properly on their side by fixing the manifest.

The OpenMP bit requires more investigation regarding delayed loading.

Pull Request: https://projects.blender.org/blender/blender/pulls/135319
This commit is contained in:
Anthony Roberts
2025-03-10 15:41:38 +01:00
parent 07c38e5612
commit 2c4628c474
4 changed files with 51 additions and 1 deletions
@@ -82,6 +82,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
)
endif()
if(WIN32 AND BLENDER_PLATFORM_ARM)
set(ODIN_PATCH_COMMAND ${ODIN_PATCH_COMMAND} &&
${PATCH_CMD} --verbose -p 1 -N -d
${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise <
${PATCH_DIR}/oidn_disable_dependentload.diff
)
endif()
ExternalProject_Add(external_openimagedenoise
URL file://${PACKAGE_DIR}/${OIDN_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -0,0 +1,29 @@
diff --git a/cmake/oidn_platform.cmake b/cmake/oidn_platform.cmake
index d5cc45e..24fcd5b 100644
--- a/cmake/oidn_platform.cmake
+++ b/cmake/oidn_platform.cmake
@@ -232,15 +232,15 @@ if(MSVC)
# Enable control flow guard
append(OIDN_C_CXX_FLAGS "/guard:cf")
- if(WIN32)
- if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- append(CMAKE_EXE_LINKER_FLAGS "/DEPENDENTLOADFLAG:0x2000")
- append(CMAKE_SHARED_LINKER_FLAGS "/DEPENDENTLOADFLAG:0x2000")
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
- append(CMAKE_EXE_LINKER_FLAGS "/Qoption,link,/DEPENDENTLOADFLAG:0x2000")
- append(CMAKE_SHARED_LINKER_FLAGS "/Qoption,link,/DEPENDENTLOADFLAG:0x2000")
- endif()
- endif()
+ #if(WIN32)
+ # if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ # append(CMAKE_EXE_LINKER_FLAGS "/DEPENDENTLOADFLAG:0x2000")
+ # append(CMAKE_SHARED_LINKER_FLAGS "/DEPENDENTLOADFLAG:0x2000")
+ # elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
+ # append(CMAKE_EXE_LINKER_FLAGS "/Qoption,link,/DEPENDENTLOADFLAG:0x2000")
+ # append(CMAKE_SHARED_LINKER_FLAGS "/Qoption,link,/DEPENDENTLOADFLAG:0x2000")
+ # endif()
+ #endif()
else()
append(OIDN_C_CXX_FLAGS_RELEASE "-fstack-protector")
+13
View File
@@ -88,3 +88,16 @@ endif()
# Language Support.
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
# -----------------------------------------------------------------------------
# OpenMP Support.
# OpenMP doesn't work on Windows ARM64 devices due to using an external manifest
# Note: This only applies to the bpy module, it works for regular builds.
# We can't use CMAKE_SYSTEM_PROCESSOR here as it's not set yet,
# so fall back to checking the env for vcvarsall's VSCMD_ARG_TGT_ARCH
if(WIN32 AND "$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "arm64")
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP_STATIC OFF CACHE BOOL "" FORCE)
endif()