diff options
author | Nikita Nemkin <nikita@nemkin.ru> | 2020-06-23 19:33:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 19:33:23 (GMT) |
commit | 2c6e4e91c5a4d3f25908108f4ed32aba936df70c (patch) | |
tree | ef119b8cbd9e36f71fe2fc8e0a26d29bf731f895 /PCbuild/python3dll.vcxproj | |
parent | 4efc3360c9a83d5891f27ed67b4f0ab7275d2ab4 (diff) | |
download | cpython-2c6e4e91c5a4d3f25908108f4ed32aba936df70c.zip cpython-2c6e4e91c5a4d3f25908108f4ed32aba936df70c.tar.gz cpython-2c6e4e91c5a4d3f25908108f4ed32aba936df70c.tar.bz2 |
bpo-41039: Simplify python3.dll build (GH-20989)
Use linker comment #pragma and preprocessor for re-exporting stable
API functions and variables.
Module definition file, custom build targets and entry point code
become unnecessary and can be removed.
This change also fixes missing _PyErr_BadInternalCall export on x86.
Diffstat (limited to 'PCbuild/python3dll.vcxproj')
-rw-r--r-- | PCbuild/python3dll.vcxproj | 77 |
1 files changed, 2 insertions, 75 deletions
diff --git a/PCbuild/python3dll.vcxproj b/PCbuild/python3dll.vcxproj index ef344be..ec22e6f 100644 --- a/PCbuild/python3dll.vcxproj +++ b/PCbuild/python3dll.vcxproj @@ -88,32 +88,17 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <_Machine>X86</_Machine> - <_Machine Condition="$(Platform) == 'x64'">X64</_Machine> - <_Machine Condition="$(Platform) == 'ARM'">ARM</_Machine> - <_Machine Condition="$(Platform) == 'ARM64'">ARM64</_Machine> - <ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);$(IntDir)python3_d.def;$(IntDir)python3stub.def</ExtensionsToDeleteOnClean> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> + <PreprocessorDefinitions>PYTHON_DLL_NAME="$(PyDllName)";%(PreprocessorDefinitions)</PreprocessorDefinitions> <BufferSecurityCheck>false</BufferSecurityCheck> </ClCompile> <Link> - <AdditionalDependencies>$(OutDir)$(TargetName)stub.lib</AdditionalDependencies> - <ModuleDefinitionFile Condition="$(Configuration) != 'Debug'">$(PySourcePath)PC\python3.def</ModuleDefinitionFile> - <ModuleDefinitionFile Condition="$(Configuration) == 'Debug'">$(IntDir)python3_d.def</ModuleDefinitionFile> - <EntryPointSymbol>DllMain</EntryPointSymbol> + <NoEntryPoint>true</NoEntryPoint> </Link> - <PreLinkEvent> - <Command>lib /nologo /def:"$(IntDir)python3stub.def" /out:"$(OutDir)$(TargetName)stub.lib" /MACHINE:$(_Machine)</Command> - <Message>Rebuilding $(TargetName)stub.lib</Message> - <Outputs>$(OutDir)$(TargetName)stub.lib</Outputs> - </PreLinkEvent> </ItemDefinitionGroup> <ItemGroup> - <None Include="..\PC\python3.def" /> - </ItemGroup> - <ItemGroup> <ClCompile Include="..\PC\python3dll.c" /> </ItemGroup> <ItemGroup> @@ -122,62 +107,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> - - <Target Name="BuildPython3_dDef" BeforeTargets="BuildStubDef" Condition="$(Configuration) == 'Debug'"> - <ItemGroup> - <_DefLines Remove="@(_DefLines)" /> - <_Lines Remove="@(_Lines)" /> - <_OriginalLines Remove="@(_OriginalLines)" /> - </ItemGroup> - <ReadLinesFromFile File="..\PC\python3.def"> - <Output TaskParameter="Lines" ItemName="_DefLines" /> - </ReadLinesFromFile> - <ReadLinesFromFile File="$(IntDir)python3_d.def" Condition="Exists('$(IntDir)python3_d.def')"> - <Output TaskParameter="Lines" ItemName="_OriginalLines" /> - </ReadLinesFromFile> - <PropertyGroup> - <_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\.</_Pattern1> - <_Sub1>$1_d.</_Sub1> - <_Pattern2>"python3"</_Pattern2> - <_Sub2>"python3_d"</_Sub2> - </PropertyGroup> - <ItemGroup> - <_Lines Include="@(_DefLines)"> - <New>$([System.Text.RegularExpressions.Regex]::Replace($([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern1)`, `$(_Sub1)`)), `$(_Pattern2)`, `$(_Sub2)`))</New> - </_Lines> - </ItemGroup> - <MakeDir Directories="$(IntDir)" /> - <Message Text="Updating python3_d.def" Condition="@(_Lines->'%(New)') != @(_OriginalLines)" Importance="high" /> - <WriteLinesToFile File="$(IntDir)python3_d.def" Lines="@(_Lines->'%(New)')" Overwrite="true" - Condition="@(_Lines->'%(New)') != @(_OriginalLines)" /> - </Target> - - <Target Name="BuildStubDef" BeforeTargets="PreLinkEvent"> - <ItemGroup> - <_DefLines Remove="@(_DefLines)" /> - <_Lines Remove="@(_Lines)" /> - <_OriginalLines Remove="@(_OriginalLines)" /> - </ItemGroup> - <ReadLinesFromFile File="..\PC\python3.def"> - <Output TaskParameter="Lines" ItemName="_DefLines" /> - </ReadLinesFromFile> - <ReadLinesFromFile File="$(IntDir)python3stub.def" Condition="Exists('$(IntDir)python3stub.def')"> - <Output TaskParameter="Lines" ItemName="_OriginalLines" /> - </ReadLinesFromFile> - <PropertyGroup> - <_Pattern>^[\w.]+=.+?\.([^ ]+).*$</_Pattern> - <_Sub>$1</_Sub> - </PropertyGroup> - <ItemGroup> - <_Lines Include="EXPORTS" /> - <_Symbols Include="@(_DefLines)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(`%(Identity)`, `$(_Pattern)`))"> - <Symbol>$([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern)`, `$(_Sub)`))</Symbol> - </_Symbols> - <_Lines Include="@(_Symbols->'%(Symbol)')" /> - </ItemGroup> - <MakeDir Directories="$(IntDir)" /> - <Message Text="Updating python3stub.def" Condition="@(_Lines) != @(_OriginalLines)" Importance="high" /> - <WriteLinesToFile File="$(IntDir)python3stub.def" Lines="@(_Lines)" Overwrite="true" - Condition="@(_Lines) != @(_OriginalLines)" /> - </Target> </Project>
\ No newline at end of file |