diff --git a/deps/python3/arm64-unicodectype.props b/deps/python3/arm64-unicodectype.props new file mode 100644 index 0000000000..5f5727c842 --- /dev/null +++ b/deps/python3/arm64-unicodectype.props @@ -0,0 +1,12 @@ + + + + + + Disabled + false + + + diff --git a/deps/python3/python3.cmake b/deps/python3/python3.cmake index 2eae315d0b..3e063fac4e 100644 --- a/deps/python3/python3.cmake +++ b/deps/python3/python3.cmake @@ -88,8 +88,18 @@ if(WIN32) list(APPEND _python_env_args "PreferredToolArchitecture=${_python_tool_arch}") endif() + # MSBuild reads extra switches from PCbuild/msbuild.rsp. + set(_python_rsp "/p:PlatformToolset=${_python_platform_toolset}\n") + # VS 2026's ARM64 code generator needs about 27 GB for one function in + # Objects/unicodectype.c (python/cpython#153668); the property sheet compiles + # that file without optimisation. + if(_python_pcbuild_platform STREQUAL "ARM64") + file(TO_NATIVE_PATH "${CMAKE_CURRENT_LIST_DIR}/arm64-unicodectype.props" _python_arm64_props) + string(APPEND _python_rsp "/p:ForceImportAfterCppTargets=\"${_python_arm64_props}\"\n") + endif() + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/python3-msbuild.rsp" "${_python_rsp}") set(_conf_cmd - cmd /c "echo /p:PlatformToolset=${_python_platform_toolset}>PCbuild\\msbuild.rsp" + ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/python3-msbuild.rsp" /PCbuild/msbuild.rsp ) set(_build_cmd ${CMAKE_COMMAND} -E env ${_python_env_args}