Skip to content

Commit

Permalink
pythongh-112984 Update Windows build for free-threaded builds
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba committed Dec 14, 2023
1 parent fb4cb7c commit 00478ff
Show file tree
Hide file tree
Showing 41 changed files with 138 additions and 66 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -111,10 +111,14 @@ PCbuild/*-pgo
PCbuild/*.VC.db
PCbuild/*.VC.opendb
PCbuild/amd64/
PCbuild/amd64t/
PCbuild/arm32/
PCbuild/arm32t/
PCbuild/arm64/
PCbuild/arm64t/
PCbuild/obj/
PCbuild/win32/
PCbuild/win32t/
Tools/unicode/data/
/autom4te.cache
/build/
Expand Down
19 changes: 14 additions & 5 deletions PC/pyconfig.h.in
Expand Up @@ -94,6 +94,9 @@ WIN32 is still required for the locale module.
#endif
#endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */

/* Define to 1 if you want to disable the GIL */
#undef Py_GIL_DISABLED

/* Compiler specific defines */

/* ------------------------------------------------------------------------*/
Expand Down Expand Up @@ -305,15 +308,24 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* not building the core - must be an ext */
# if defined(_MSC_VER)
/* So MSVC users need not specify the .lib
file in their Makefile (other compilers are
generally taken care of by distutils.) */
file in their Makefile */
# if defined(Py_GIL_DISABLED)
# if defined(_DEBUG)
# pragma comment(lib,"python313t_d.lib")
# elif defined(Py_LIMITED_API)
# pragma comment(lib,"python3t.lib")
# else
# pragma comment(lib,"python313t.lib")
# endif /* _DEBUG */
# else /* Py_GIL_DISABLED */
# if defined(_DEBUG)
# pragma comment(lib,"python313_d.lib")
# elif defined(Py_LIMITED_API)
# pragma comment(lib,"python3.lib")
# else
# pragma comment(lib,"python313.lib")
# endif /* _DEBUG */
# endif /* Py_GIL_DISABLED */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */
Expand Down Expand Up @@ -739,7 +751,4 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1

/* Define if you want to disable the GIL */
#undef Py_GIL_DISABLED

#endif /* !Py_CONFIG_H */
2 changes: 1 addition & 1 deletion PCbuild/_asyncio.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_bz2.vcxproj
Expand Up @@ -80,7 +80,7 @@
<PropertyGroup Label="Configuration" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_ctypes.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_ctypes_test.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_decimal.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_elementtree.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_hashlib.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_lzma.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_multiprocessing.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_overlapped.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_queue.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_socket.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_sqlite3.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_ssl.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testbuffer.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testcapi.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
4 changes: 2 additions & 2 deletions PCbuild/_testclinic.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand All @@ -107,4 +107,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion PCbuild/_testclinic_limited.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testconsole.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testimportmultiple.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testinternalcapi.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testmultiphase.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_testsinglephase.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_tkinter.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_uuid.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_wmi.vcxproj
Expand Up @@ -80,7 +80,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_zoneinfo.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/pyexpat.vcxproj
Expand Up @@ -79,7 +79,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<TargetExt>.pyd</TargetExt>
<TargetExt>$(PyStdlibPydExt)</TargetExt>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down
13 changes: 10 additions & 3 deletions PCbuild/pyproject.props
Expand Up @@ -23,6 +23,13 @@
<LinkIncremental Condition="$(Configuration) != 'Debug'">false</LinkIncremental>
</PropertyGroup>

<PropertyGroup>
<TargetNameExt>$(TargetName)$(TargetExt)</TargetNameExt>
<_TargetNameSep>$(TargetNameExt.LastIndexOf(`.`))</_TargetNameSep>
<TargetName>$(TargetNameExt.Substring(0, $(_TargetNameSep)))</TargetName>
<TargetExt>$(TargetNameExt.Substring($(_TargetNameSep)))</TargetExt>
</PropertyGroup>

<PropertyGroup Label="MSVC Bug Workarounds" Condition="$(VCToolsVersion) != ''">
<_VCToolsVersion>$([System.Version]::Parse(`$(VCToolsVersion)`).Major).$([System.Version]::Parse(`$(VCToolsVersion)`).Minor)</_VCToolsVersion>

Expand All @@ -36,7 +43,7 @@
<_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition>
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;</_PlatformPreprocessorDefinition>
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
<_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)";</_Py3NamePreprocessorDefinition>
<_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)$(PyDebugExt)";</_Py3NamePreprocessorDefinition>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
Expand Down Expand Up @@ -155,8 +162,8 @@ public override bool Execute() {
</UsingTask>

<Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
<Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
<KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" />
<Message Text="Killing any running $(PyExeName)$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
<KillPython FileName="$(OutDir)$(PyExeName)$(PyDebugExt)$(PyTestExt).exe" />
</Target>

<!--
Expand Down

0 comments on commit 00478ff

Please sign in to comment.