File tree Expand file tree Collapse file tree 4 files changed +62
-1
lines changed
Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ Programs/_testembed
9292PC /python_nt * .h
9393PC /pythonnt_rc * .h
9494Modules /python.exp
95+ PC /pyconfig.h
9596PC /* /* .exp
9697PC /* /* .lib
9798PC /* /* .bsc
Original file line number Diff line number Diff line change 11#ifndef Py_CONFIG_H
22#define Py_CONFIG_H
33
4- /* pyconfig.h. NOT Generated automatically by configure .
4+ /* pyconfig.h.in .
55
66This is a manually maintained version used for the Watcom,
77Borland and Microsoft Visual C++ compilers. It is a
@@ -710,6 +710,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
710710/* Define to 1 if you have the `erfc' function. */
711711#define HAVE_ERFC 1
712712
713+ /* Define if you want to disable the GIL */
714+ #undef Py_NOGIL
715+
713716// netdb.h functions (provided by winsock.h)
714717#define HAVE_GETHOSTNAME 1
715718#define HAVE_GETHOSTBYADDR 1
Original file line number Diff line number Diff line change 1+ #
2+ # Generates pyconfig.h from PC\pyconfig.h.in
3+ #
4+
5+ param (
6+ [string []]$define ,
7+ [string ]$File
8+ )
9+
10+ $definedValues = @ {}
11+
12+ foreach ($arg in $define ) {
13+ $parts = $arg -split ' ='
14+
15+ if ($parts.Count -eq 1 ) {
16+ $key = $parts [0 ]
17+ $definedValues [$key ] = " "
18+ } elseif ($parts.Count -eq 2 ) {
19+ $key = $parts [0 ]
20+ $value = $parts [1 ]
21+ $definedValues [$key ] = $value
22+ } else {
23+ Write-Host " Invalid argument: $arg "
24+ exit 1
25+ }
26+ }
27+
28+ $cpythonRoot = Split-Path $PSScriptRoot - Parent
29+ $pyconfigPath = Join-Path $cpythonRoot " PC\pyconfig.h.in"
30+
31+ $header = " /* pyconfig.h. Generated from PC\pyconfig.h.in by generate_pyconfig.ps1. */"
32+
33+ $lines = Get-Content - Path $pyconfigPath
34+ $lines = @ ($header ) + $lines
35+
36+ foreach ($i in 0 .. ($lines.Length - 1 )) {
37+ if ($lines [$i ] -match " ^#undef (\w+)$" ) {
38+ $key = $Matches [1 ]
39+ if ($definedValues.ContainsKey ($key )) {
40+ $value = $definedValues [$key ]
41+ $lines [$i ] = " #define $key $value " .TrimEnd()
42+ } else {
43+ $lines [$i ] = " /* #undef $key */"
44+ }
45+ }
46+ }
47+
48+ $ParentDir = Split-Path - Path $File - Parent
49+ New-Item - ItemType Directory - Force - Path $ParentDir | Out-Null
50+ Set-Content - Path $File - Value $lines
Original file line number Diff line number Diff line change 33 <Import Project =" $(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44 <Import Project =" $(VCTargetsPath)\Microsoft.Cpp.props" />
55 <Import Project =" $(VCTargetsPath)\Microsoft.Cpp.targets" />
6+ <Import Project =" python.props" />
67 <PropertyGroup Label =" Globals" >
78 <ProjectGuid >{CC9B93A2-439D-4058-9D29-6DCF43774405}</ProjectGuid >
89 <Platform Condition =" '$(Platform)' == ''" >Win32</Platform >
1415 <IncludeSSL Condition =" '$(IncludeSSL)' == ''" >true</IncludeSSL >
1516 <IncludeTkinter Condition =" '$(IncludeTkinter)' == ''" >true</IncludeTkinter >
1617 <IncludeUwp Condition =" '$(IncludeUwp)' == ''" >false</IncludeUwp >
18+ <PyConfigArgs Condition =" '$(DisableGil)' == 'true'" >Py_NOGIL=1,$(PyConfigArgs)</PyConfigArgs >
1719 </PropertyGroup >
1820
1921 <ItemDefinitionGroup >
9496 <Projects2 Include =" venvlauncher.vcxproj;venvwlauncher.vcxproj" />
9597 </ItemGroup >
9698
99+ <Target Name =" PreBuild" BeforeTargets =" Build" >
100+ <!-- Stick a _PLACEHOLDER=1 after $(PyConfigArgs) to handle both trailing commas and empty $(PyConfigArgs) -->
101+ <Exec Command =" powershell.exe $(PySourcePath)PCbuild\generate_pyconfig.ps1 -File $(PySourcePath)PC\pyconfig.h -define $(PyConfigArgs)_PLACEHOLDER=1" />
102+ </Target >
103+
97104 <Target Name =" Build" >
98105 <MSBuild Projects =" @(FreezeProjects)"
99106 Properties =" Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
You can’t perform that action at this time.
0 commit comments