File tree 4 files changed +62
-1
lines changed 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ Programs/_testembed
92
92
PC /python_nt * .h
93
93
PC /pythonnt_rc * .h
94
94
Modules /python.exp
95
+ PC /pyconfig.h
95
96
PC /* /* .exp
96
97
PC /* /* .lib
97
98
PC /* /* .bsc
Original file line number Diff line number Diff line change 1
1
#ifndef Py_CONFIG_H
2
2
#define Py_CONFIG_H
3
3
4
- /* pyconfig.h. NOT Generated automatically by configure .
4
+ /* pyconfig.h.in .
5
5
6
6
This is a manually maintained version used for the Watcom,
7
7
Borland 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 */
710
710
/* Define to 1 if you have the `erfc' function. */
711
711
#define HAVE_ERFC 1
712
712
713
+ /* Define if you want to disable the GIL */
714
+ #undef Py_NOGIL
715
+
713
716
// netdb.h functions (provided by winsock.h)
714
717
#define HAVE_GETHOSTNAME 1
715
718
#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 3
3
<Import Project =" $(VCTargetsPath)\Microsoft.Cpp.Default.props" />
4
4
<Import Project =" $(VCTargetsPath)\Microsoft.Cpp.props" />
5
5
<Import Project =" $(VCTargetsPath)\Microsoft.Cpp.targets" />
6
+ <Import Project =" python.props" />
6
7
<PropertyGroup Label =" Globals" >
7
8
<ProjectGuid >{CC9B93A2-439D-4058-9D29-6DCF43774405}</ProjectGuid >
8
9
<Platform Condition =" '$(Platform)' == ''" >Win32</Platform >
14
15
<IncludeSSL Condition =" '$(IncludeSSL)' == ''" >true</IncludeSSL >
15
16
<IncludeTkinter Condition =" '$(IncludeTkinter)' == ''" >true</IncludeTkinter >
16
17
<IncludeUwp Condition =" '$(IncludeUwp)' == ''" >false</IncludeUwp >
18
+ <PyConfigArgs Condition =" '$(DisableGil)' == 'true'" >Py_NOGIL=1,$(PyConfigArgs)</PyConfigArgs >
17
19
</PropertyGroup >
18
20
19
21
<ItemDefinitionGroup >
94
96
<Projects2 Include =" venvlauncher.vcxproj;venvwlauncher.vcxproj" />
95
97
</ItemGroup >
96
98
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
+
97
104
<Target Name =" Build" >
98
105
<MSBuild Projects =" @(FreezeProjects)"
99
106
Properties =" Configuration=%(Configuration);Platform=%(Platform);%(Properties)"
You can’t perform that action at this time.
0 commit comments