early-access version 2853
This commit is contained in:
77
externals/vcpkg/ports/python3/0001-static-library.patch
vendored
Executable file
77
externals/vcpkg/ports/python3/0001-static-library.patch
vendored
Executable file
@@ -0,0 +1,77 @@
|
||||
From 14d91e4f4a9377f47cc4cc33faeeb7c82f64b176 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Thu, 28 May 2020 17:25:21 -0400
|
||||
Subject: [PATCH 1/7] static library
|
||||
|
||||
builds the pythoncore as a static library instead of a DLL
|
||||
---
|
||||
PC/pyconfig.h | 9 +++++++++
|
||||
PCbuild/pythoncore.vcxproj | 4 ++--
|
||||
2 files changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
|
||||
index d7d3cf081e..34269f0b75 100644
|
||||
--- a/PC/pyconfig.h
|
||||
+++ b/PC/pyconfig.h
|
||||
@@ -251,6 +251,7 @@ typedef int pid_t;
|
||||
|
||||
/* For Windows the Python core is in a DLL by default. Test
|
||||
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
||||
+#define Py_NO_ENABLE_SHARED
|
||||
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
|
||||
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
|
||||
# define MS_COREDLL /* deprecated old symbol */
|
||||
@@ -276,6 +277,14 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
||||
# endif /* _DEBUG */
|
||||
# endif /* _MSC_VER */
|
||||
# endif /* Py_BUILD_CORE */
|
||||
+#else
|
||||
+ /* So MSVC users need not specify the .lib file in their own config */
|
||||
+# pragma comment(lib, "version.lib")
|
||||
+# pragma comment(lib, "shlwapi.lib")
|
||||
+# pragma comment(lib, "ws2_32.lib")
|
||||
+# if Py_WINVER > 0x0601
|
||||
+# pragma comment(lib, "pathcch.lib")
|
||||
+# endif /* Py_WINVER */
|
||||
#endif /* MS_COREDLL */
|
||||
|
||||
#if defined(MS_WIN64)
|
||||
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
||||
index 2625d0293d..2f8bdaa931 100644
|
||||
--- a/PCbuild/pythoncore.vcxproj
|
||||
+++ b/PCbuild/pythoncore.vcxproj
|
||||
@@ -73,7 +73,7 @@
|
||||
<Import Project="python.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
- <ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
+ <ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@@ -102,7 +102,7 @@
|
||||
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
- <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
+ <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
|
||||
index ac49f7867a..f3583345ff 100644
|
||||
--- a/Python/sysmodule.c
|
||||
+++ b/Python/sysmodule.c
|
||||
@@ -2804,6 +2804,9 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
|
||||
#ifdef MS_COREDLL
|
||||
SET_SYS("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule));
|
||||
SET_SYS_FROM_STRING("winver", PyWin_DLLVersionString);
|
||||
+#elif defined(MS_WINDOWS)
|
||||
+ SET_SYS("dllhandle", PyLong_FromVoidPtr(NULL));
|
||||
+ SET_SYS_FROM_STRING("winver", MS_DLL_ID);
|
||||
#endif
|
||||
#ifdef ABIFLAGS
|
||||
SET_SYS_FROM_STRING("abiflags", ABIFLAGS);
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
39
externals/vcpkg/ports/python3/0002-use-vcpkg-zlib.patch
vendored
Executable file
39
externals/vcpkg/ports/python3/0002-use-vcpkg-zlib.patch
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
From 196555707236f4387875749f66620fb519166963 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Wed, 9 Sep 2020 15:20:36 -0400
|
||||
Subject: [PATCH 2/6] use vcpkg zlib
|
||||
|
||||
building without zlib is not a supported configuration, per the warning
|
||||
messages.
|
||||
---
|
||||
PCbuild/pythoncore.vcxproj | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
||||
index dbe236829a..5f30a35eb3 100644
|
||||
--- a/PCbuild/pythoncore.vcxproj
|
||||
+++ b/PCbuild/pythoncore.vcxproj
|
||||
@@ -507,8 +507,10 @@
|
||||
<ClCompile Include="..\Python\thread.c" />
|
||||
<ClCompile Include="..\Python\traceback.c" />
|
||||
</ItemGroup>
|
||||
- <ItemGroup Condition="$(IncludeExternals)">
|
||||
+ <ItemGroup>
|
||||
<ClCompile Include="..\Modules\zlibmodule.c" />
|
||||
+ </ItemGroup>
|
||||
+ <ItemGroup Condition="false">
|
||||
<ClCompile Include="$(zlibDir)\adler32.c" />
|
||||
<ClCompile Include="$(zlibDir)\compress.c" />
|
||||
<ClCompile Include="$(zlibDir)\crc32.c" />
|
||||
@@ -556,7 +558,7 @@
|
||||
<Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140' and $(PlatformToolset) != 'v141' and $(PlatformToolset) != 'v142'">
|
||||
<Warning Text="Toolset $(PlatformToolset) is not used for official builds. Your build may have errors or incompatibilities." />
|
||||
</Target>
|
||||
- <Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="!$(IncludeExternals)">
|
||||
+ <Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="false">
|
||||
<Warning Text="Not including zlib is not a supported configuration." />
|
||||
</Target>
|
||||
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
117
externals/vcpkg/ports/python3/0003-devendor-external-dependencies.patch
vendored
Executable file
117
externals/vcpkg/ports/python3/0003-devendor-external-dependencies.patch
vendored
Executable file
@@ -0,0 +1,117 @@
|
||||
From 6c5c3793cbc6ba2a1d0d623a2bdaa9c2125be516 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Wed, 9 Sep 2020 15:24:38 -0400
|
||||
Subject: [PATCH 3/6] devendor external dependencies
|
||||
|
||||
externally fetched libraries may cause linker errors resulting from
|
||||
duplicate symbols in downstream projects.
|
||||
---
|
||||
PCbuild/_bz2.vcxproj | 4 +++-
|
||||
PCbuild/_lzma.vcxproj | 5 ++---
|
||||
PCbuild/_sqlite3.vcxproj | 2 +-
|
||||
PCbuild/_ssl.vcxproj | 2 +-
|
||||
PCbuild/pyexpat.vcxproj | 6 ++++--
|
||||
5 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/PCbuild/_bz2.vcxproj b/PCbuild/_bz2.vcxproj
|
||||
index 3fe95fbf83..6b12e8818e 100644
|
||||
--- a/PCbuild/_bz2.vcxproj
|
||||
+++ b/PCbuild/_bz2.vcxproj
|
||||
@@ -101,6 +101,8 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Modules\_bz2module.c" />
|
||||
+ </ItemGroup>
|
||||
+ <ItemGroup Condition="false">
|
||||
<ClCompile Include="$(bz2Dir)\blocksort.c" />
|
||||
<ClCompile Include="$(bz2Dir)\bzlib.c" />
|
||||
<ClCompile Include="$(bz2Dir)\compress.c" />
|
||||
@@ -109,7 +111,7 @@
|
||||
<ClCompile Include="$(bz2Dir)\huffman.c" />
|
||||
<ClCompile Include="$(bz2Dir)\randtable.c" />
|
||||
</ItemGroup>
|
||||
- <ItemGroup>
|
||||
+ <ItemGroup Condition="false">
|
||||
<ClInclude Include="$(bz2Dir)\bzlib.h" />
|
||||
<ClInclude Include="$(bz2Dir)\bzlib_private.h" />
|
||||
</ItemGroup>
|
||||
diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj
|
||||
index fe076a6fc5..70cc61dd95 100644
|
||||
--- a/PCbuild/_lzma.vcxproj
|
||||
+++ b/PCbuild/_lzma.vcxproj
|
||||
@@ -94,10 +94,9 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
- <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
+ <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
- <AdditionalDependencies>$(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -111,7 +110,7 @@
|
||||
<Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
- <ProjectReference Include="liblzma.vcxproj">
|
||||
+ <ProjectReference Condition="false" Include="liblzma.vcxproj">
|
||||
<Project>{12728250-16eC-4dc6-94d7-e21dd88947f8}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj
|
||||
index 7e0062692b..6fb3279a20 100644
|
||||
--- a/PCbuild/_sqlite3.vcxproj
|
||||
+++ b/PCbuild/_sqlite3.vcxproj
|
||||
@@ -127,7 +127,7 @@
|
||||
<Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
- <ProjectReference Include="sqlite3.vcxproj">
|
||||
+ <ProjectReference Condition="false" Include="sqlite3.vcxproj">
|
||||
<Project>{a1a295e5-463c-437f-81ca-1f32367685da}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj
|
||||
index 4907f49b66..4dffa202b7 100644
|
||||
--- a/PCbuild/_ssl.vcxproj
|
||||
+++ b/PCbuild/_ssl.vcxproj
|
||||
@@ -99,7 +99,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Modules\_ssl.c" />
|
||||
- <ClCompile Include="$(opensslIncludeDir)\applink.c">
|
||||
+ <ClCompile Condition="false" Include="$(opensslIncludeDir)\applink.c">
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj
|
||||
index b2d9f5d57d..4efb826a05 100644
|
||||
--- a/PCbuild/pyexpat.vcxproj
|
||||
+++ b/PCbuild/pyexpat.vcxproj
|
||||
@@ -89,17 +89,19 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
- <ClCompile>
|
||||
+ <ClCompile Condition="false">
|
||||
<AdditionalIncludeDirectories>$(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
- <ItemGroup>
|
||||
+ <ItemGroup Condition="false">
|
||||
<ClInclude Include="..\Modules\expat\xmlrole.h" />
|
||||
<ClInclude Include="..\Modules\expat\xmltok.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Modules\pyexpat.c" />
|
||||
+ </ItemGroup>
|
||||
+ <ItemGroup Condition="false">
|
||||
<ClCompile Include="..\Modules\expat\xmlparse.c" />
|
||||
<ClCompile Include="..\Modules\expat\xmlrole.c" />
|
||||
<ClCompile Include="..\Modules\expat\xmltok.c" />
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
26
externals/vcpkg/ports/python3/0004-dont-copy-vcruntime.patch
vendored
Executable file
26
externals/vcpkg/ports/python3/0004-dont-copy-vcruntime.patch
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
From 8086c67fa7ada1888a7808cbdc6fe74b62abe5b1 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Wed, 9 Sep 2020 16:12:49 -0400
|
||||
Subject: [PATCH 4/6] dont copy vcruntime
|
||||
|
||||
VCRUNTIME140.dll should not be redistributed, ever.
|
||||
---
|
||||
PCbuild/pythoncore.vcxproj | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
||||
index 5f30a35eb3..3cf21ba39c 100644
|
||||
--- a/PCbuild/pythoncore.vcxproj
|
||||
+++ b/PCbuild/pythoncore.vcxproj
|
||||
@@ -565,7 +565,7 @@
|
||||
<Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">
|
||||
<!-- bpo-38597: When we switch to another VCRuntime DLL, include vcruntime140.dll as well -->
|
||||
<Warning Text="A copy of vcruntime140.dll is also required" Condition="!$(VCToolsRedistVersion.StartsWith(`14.`))" />
|
||||
- <Copy SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
|
||||
+ <Copy Condition="false" SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
|
||||
</Target>
|
||||
<Target Name="_CleanVCRuntime" AfterTargets="Clean">
|
||||
<Delete Files="@(VCRuntimeDLL->'$(OutDir)%(Filename)%(Extension)')" />
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
60
externals/vcpkg/ports/python3/0005-only-build-required-projects.patch
vendored
Executable file
60
externals/vcpkg/ports/python3/0005-only-build-required-projects.patch
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
From 6492277e39dbe7dd77d32fdc9ae4b989213ef3c6 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Wed, 9 Sep 2020 20:15:58 -0400
|
||||
Subject: [PATCH 5/6] only build required projects
|
||||
|
||||
strips out tests and unsupported externals (eg tkinter).
|
||||
---
|
||||
PCbuild/_ssl.vcxproj | 2 +-
|
||||
PCbuild/pcbuild.proj | 14 +++++++-------
|
||||
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj
|
||||
index 4dffa202b7..e661cb6fb6 100644
|
||||
--- a/PCbuild/_ssl.vcxproj
|
||||
+++ b/PCbuild/_ssl.vcxproj
|
||||
@@ -111,7 +111,7 @@
|
||||
<Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
- <ProjectReference Include="_socket.vcxproj">
|
||||
+ <ProjectReference Condition="false" Include="_socket.vcxproj">
|
||||
<Project>{86937f53-c189-40ef-8ce8-8759d8e7d480}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
|
||||
index 4d416c589e..ede9868a8f 100644
|
||||
--- a/PCbuild/pcbuild.proj
|
||||
+++ b/PCbuild/pcbuild.proj
|
||||
@@ -45,21 +45,21 @@
|
||||
<BuildInParallel>false</BuildInParallel>
|
||||
</Projects>
|
||||
<!-- python3.dll -->
|
||||
- <Projects Include="python3dll.vcxproj" />
|
||||
+ <Projects Include="python3dll.vcxproj" Condition="false" />
|
||||
<!-- py[w].exe -->
|
||||
- <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" />
|
||||
+ <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" Condition="false" />
|
||||
<!-- pyshellext.dll -->
|
||||
- <Projects Include="pyshellext.vcxproj" />
|
||||
+ <Projects Include="pyshellext.vcxproj" Condition="false" />
|
||||
<!-- Extension modules -->
|
||||
<ExtensionModules Include="_asyncio;_zoneinfo;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;_queue;select;unicodedata;winsound;_uuid" />
|
||||
<ExtensionModules Include="_ctypes" Condition="$(IncludeCTypes)" />
|
||||
<!-- Extension modules that require external sources -->
|
||||
<ExternalModules Include="_bz2;_lzma;_sqlite3" />
|
||||
<!-- venv launchers -->
|
||||
- <Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" />
|
||||
- <!-- _ssl will build _socket as well, which may cause conflicts in parallel builds -->
|
||||
- <ExtensionModules Include="_socket" Condition="!$(IncludeSSL) or !$(IncludeExternals)" />
|
||||
- <ExternalModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
|
||||
+ <Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" Condition="false" />
|
||||
+ <!-- _ssl will NOT build _socket as well -->
|
||||
+ <ExtensionModules Include="_socket" Condition="true" />
|
||||
+ <ExternalModules Include="_ssl;_hashlib" Condition="true" />
|
||||
<ExternalModules Include="_tkinter" Condition="$(IncludeTkinter) and $(Platform) != 'ARM' and $(Platform) != 'ARM64'" />
|
||||
<ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
|
||||
<Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
187
externals/vcpkg/ports/python3/0006-restore-support-for-windows-7.patch
vendored
Executable file
187
externals/vcpkg/ports/python3/0006-restore-support-for-windows-7.patch
vendored
Executable file
@@ -0,0 +1,187 @@
|
||||
From e30a560527d17ae81685dd11d3268bc982af2048 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Tue, 16 Feb 2021 18:03:07 -0500
|
||||
Subject: [PATCH 7/7] restore support for windows 7
|
||||
|
||||
this backports the windows 7 compatible fix for bpo-39401 from gh-18234,
|
||||
originally authored by Steve Dower, and removes explicit dependencies on
|
||||
pathcch.
|
||||
|
||||
The same mechanism is applied to fix posixmodule.c
|
||||
---
|
||||
index 25ddc82..ff51042 100644
|
||||
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
|
||||
--- a/Modules/posixmodule.c
|
||||
+++ b/Modules/posixmodule.c
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
|
||||
# include <windows.h>
|
||||
-# include <pathcch.h>
|
||||
+# include <Shlwapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef __VXWORKS__
|
||||
@@ -4410,6 +4410,10 @@ os__getvolumepathname_impl(PyObject *module, path_t *path)
|
||||
return result;
|
||||
}
|
||||
|
||||
+static int _PathCchSkipRoot_Initialized = 0;
|
||||
+typedef HRESULT (__stdcall *PPathCchSkipRoot) (PCWSTR pszPath, PCWSTR *ppszRootEnd);
|
||||
+static PPathCchSkipRoot _PathCchSkipRoot;
|
||||
+
|
||||
|
||||
/*[clinic input]
|
||||
os._path_splitroot
|
||||
@@ -4428,6 +4432,19 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
|
||||
PyObject *result = NULL;
|
||||
HRESULT ret;
|
||||
|
||||
+ if (_PathCchSkipRoot_Initialized == 0) {
|
||||
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
|
||||
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
+
|
||||
+ if (pathapi) {
|
||||
+ _PathCchSkipRoot = (PPathCchSkipRoot)GetProcAddress(pathapi, "PathCchSkipRoot");
|
||||
+ } else {
|
||||
+ _PathCchSkipRoot = NULL;
|
||||
+ }
|
||||
+
|
||||
+ _PathCchSkipRoot_Initialized = 1;
|
||||
+ }
|
||||
+
|
||||
buffer = (wchar_t*)PyMem_Malloc(sizeof(wchar_t) * (wcslen(path->wide) + 1));
|
||||
if (!buffer) {
|
||||
return NULL;
|
||||
@@ -4438,7 +4455,14 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
|
||||
}
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
- ret = PathCchSkipRoot(buffer, &end);
|
||||
+ if (_PathCchSkipRoot) {
|
||||
+ ret = _PathCchSkipRoot(buffer, &end);
|
||||
+ } else {
|
||||
+ end = PathSkipRootW(buffer);
|
||||
+ if (!end) {
|
||||
+ ret = E_FAIL;
|
||||
+ }
|
||||
+ }
|
||||
Py_END_ALLOW_THREADS
|
||||
if (FAILED(ret)) {
|
||||
result = Py_BuildValue("sO", "", path->object);
|
||||
diff --git a/PC/getpathp.c b/PC/getpathp.c
|
||||
index 53da3a6..3d58bbf 100644
|
||||
--- a/PC/getpathp.c
|
||||
+++ b/PC/getpathp.c
|
||||
@@ -90,7 +90,7 @@
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
-#include <pathcch.h>
|
||||
+#include <Shlwapi.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
@@ -249,14 +249,43 @@ ismodule(wchar_t *filename, int update_filename)
|
||||
stuff as fits will be appended.
|
||||
*/
|
||||
|
||||
+
|
||||
+static int _PathCchCombineEx_Initialized = 0;
|
||||
+typedef HRESULT(__stdcall *PPathCchCombineEx) (PWSTR pszPathOut, size_t cchPathOut,
|
||||
+ PCWSTR pszPathIn, PCWSTR pszMore,
|
||||
+ unsigned long dwFlags);
|
||||
+static PPathCchCombineEx _PathCchCombineEx;
|
||||
+
|
||||
static void
|
||||
join(wchar_t *buffer, const wchar_t *stuff)
|
||||
{
|
||||
- if (FAILED(PathCchCombineEx(buffer, MAXPATHLEN+1, buffer, stuff, 0))) {
|
||||
- Py_FatalError("buffer overflow in getpathp.c's join()");
|
||||
+ if (_PathCchCombineEx_Initialized == 0) {
|
||||
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
|
||||
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
+ if (pathapi) {
|
||||
+ _PathCchCombineEx = (PPathCchCombineEx)GetProcAddress(pathapi, "PathCchCombineEx");
|
||||
+ }
|
||||
+ else {
|
||||
+ _PathCchCombineEx = NULL;
|
||||
+ }
|
||||
+ _PathCchCombineEx_Initialized = 1;
|
||||
+ }
|
||||
+ if (_PathCchCombineEx) {
|
||||
+ if (FAILED(_PathCchCombineEx(buffer, MAXPATHLEN+1, buffer, stuff, 0))) {
|
||||
+ Py_FatalError("buffer overflow in getpathp.c's join()");
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (!PathCombineW(buffer, buffer, stuff)) {
|
||||
+ Py_FatalError("buffer overflow in getpathp.c's join()");
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
+static int _PathCchCanonicalizeEx_Initialized = 0;
|
||||
+typedef HRESULT(__stdcall *PPathCchCanonicalizeEx) (PWSTR pszPathOut, size_t cchPathOut,
|
||||
+ PCWSTR pszPathIn, unsigned long dwFlags);
|
||||
+static PPathCchCanonicalizeEx _PathCchCanonicalizeEx;
|
||||
+
|
||||
/* Call PathCchCanonicalizeEx(path): remove navigation elements such as "."
|
||||
and ".." to produce a direct, well-formed path. */
|
||||
static PyStatus
|
||||
@@ -267,8 +296,26 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
|
||||
return _PyStatus_NO_MEMORY();
|
||||
}
|
||||
|
||||
- if (FAILED(PathCchCanonicalizeEx(buffer, MAXPATHLEN + 1, path, 0))) {
|
||||
- return INIT_ERR_BUFFER_OVERFLOW();
|
||||
+ if (_PathCchCanonicalizeEx_Initialized == 0) {
|
||||
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
|
||||
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
+ if (pathapi) {
|
||||
+ _PathCchCanonicalizeEx = (PPathCchCanonicalizeEx)GetProcAddress(pathapi, "PathCchCanonicalizeEx");
|
||||
+ }
|
||||
+ else {
|
||||
+ _PathCchCanonicalizeEx = NULL;
|
||||
+ }
|
||||
+ _PathCchCanonicalizeEx_Initialized = 1;
|
||||
+ }
|
||||
+ if (_PathCchCanonicalizeEx) {
|
||||
+ if (FAILED(_PathCchCanonicalizeEx(buffer, MAXPATHLEN + 1, path, 0))) {
|
||||
+ return INIT_ERR_BUFFER_OVERFLOW();
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ if (!PathCanonicalizeW(buffer, path)) {
|
||||
+ return INIT_ERR_BUFFER_OVERFLOW();
|
||||
+ }
|
||||
}
|
||||
return _PyStatus_OK();
|
||||
}
|
||||
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
|
||||
index d7d3cf0..6e9c090 100644
|
||||
--- a/PC/pyconfig.h
|
||||
+++ b/PC/pyconfig.h
|
||||
@@ -136,8 +136,8 @@ WIN32 is still required for the locale module.
|
||||
|
||||
/* set the version macros for the windows headers */
|
||||
/* Python 3.9+ requires Windows 8 or greater */
|
||||
-#define Py_WINVER 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
-#define Py_NTDDI NTDDI_WIN8
|
||||
+#define Py_WINVER 0x0601 /* _WIN32_WINNT_WIN7 */
|
||||
+#define Py_NTDDI NTDDI_WIN7
|
||||
|
||||
/* We only set these values when building Python - we don't want to force
|
||||
these values on extensions, as that will affect the prototypes and
|
||||
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
||||
index c39ba3e1a9..0ef3a05fb6 100644
|
||||
--- a/PCbuild/pythoncore.vcxproj
|
||||
+++ b/PCbuild/pythoncore.vcxproj
|
||||
@@ -106,7 +106,7 @@
|
||||
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
- <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
+ <AdditionalDependencies>version.lib;ws2_32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
30
externals/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch
vendored
Executable file
30
externals/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
From 0a72b7061ed79c5d6d37b41a5b1610e32fb371a4 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 21:04:21 -0400
|
||||
Subject: [PATCH] workaround windows 11 sdk rc compiler error
|
||||
|
||||
winnt.h was changed to error if the `SYSTEM_CACHE_ALIGNMENT` cannot be
|
||||
determined. when the RC compiler is invoked, this seems to fail where
|
||||
previous SDKs silently set the ARM value.
|
||||
---
|
||||
PC/python_ver_rc.h | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/PC/python_ver_rc.h b/PC/python_ver_rc.h
|
||||
index 90fc6ba1a1..e313a5138e 100644
|
||||
--- a/PC/python_ver_rc.h
|
||||
+++ b/PC/python_ver_rc.h
|
||||
@@ -1,3 +1,10 @@
|
||||
+// Temporarily workaround bug in Windows SDK 10.0.22000.0 winnt.h
|
||||
+#ifdef RC_INVOKED
|
||||
+# ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
|
||||
+# define SYSTEM_CACHE_ALIGNMENT_SIZE 64
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
// Resource script for Python core DLL.
|
||||
// Currently only holds version information.
|
||||
//
|
||||
--
|
||||
2.33.0.windows.1
|
||||
|
16
externals/vcpkg/ports/python3/0009-python.pc.patch
vendored
Executable file
16
externals/vcpkg/ports/python3/0009-python.pc.patch
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
--- a/Misc/python.pc.in 2022-01-14 05:23:10.299912709 +0000
|
||||
+++ b/Misc/python.pc.in 2022-01-14 05:23:15.908022446 +0000
|
||||
@@ -10,4 +10,4 @@
|
||||
Version: @VERSION@
|
||||
Libs.private: @LIBS@
|
||||
Libs:
|
||||
-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
|
||||
+Cflags: -I${includedir}/python@VERSION@
|
||||
--- a/Misc/python-embed.pc.in 2022-01-14 05:22:57.043653570 +0000
|
||||
+++ b/Misc/python-embed.pc.in 2022-01-14 05:23:04.603801315 +0000
|
||||
@@ -10,4 +10,4 @@
|
||||
Version: @VERSION@
|
||||
Libs.private: @LIBS@
|
||||
Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
|
||||
-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
|
||||
+Cflags: -I${includedir}/python@VERSION@
|
19
externals/vcpkg/ports/python3/0010-bz2d.patch
vendored
Executable file
19
externals/vcpkg/ports/python3/0010-bz2d.patch
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 43e807f20..df4d43d3d 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -1741,6 +1741,14 @@ def detect_compress_exts(self):
|
||||
self.add(Extension('_bz2', ['_bz2module.c'],
|
||||
libraries=['bz2'],
|
||||
extra_link_args=bz2_extra_link_args))
|
||||
+ elif (self.compiler.find_library_file(self.lib_dirs, 'bz2d')):
|
||||
+ if MACOS:
|
||||
+ bz2_extra_link_args = ('-Wl,-search_paths_first',)
|
||||
+ else:
|
||||
+ bz2_extra_link_args = ()
|
||||
+ self.add(Extension('_bz2', ['_bz2module.c'],
|
||||
+ libraries=['bz2d'],
|
||||
+ extra_link_args=bz2_extra_link_args))
|
||||
else:
|
||||
self.missing.append('_bz2')
|
||||
|
11
externals/vcpkg/ports/python3/0010-ensurepip.patch
vendored
Executable file
11
externals/vcpkg/ports/python3/0010-ensurepip.patch
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
--- a/Lib/ensurepip/__init__.py 2021-10-05 00:40:46.000000000 +0700
|
||||
+++ b/Lib/ensurepip/__init__.py 2022-01-11 15:22:54.001498300 +0700
|
||||
@@ -86,6 +86,8 @@
|
||||
code = f"""
|
||||
import runpy
|
||||
import sys
|
||||
+import os
|
||||
+sys.executable = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path = {additional_paths or []} + sys.path
|
||||
sys.argv[1:] = {args}
|
||||
runpy.run_module("pip", run_name="__main__", alter_sys=True)
|
14
externals/vcpkg/ports/python3/openssl.props.in
vendored
Executable file
14
externals/vcpkg/ports/python3/openssl.props.in
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies>Crypt32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Release|true'">
|
||||
${CRYPTO_RELEASE};${SSL_RELEASE};%(AdditionalDependencies)
|
||||
</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Debug|true'">
|
||||
${CRYPTO_DEBUG};${SSL_DEBUG};%(AdditionalDependencies)
|
||||
</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
295
externals/vcpkg/ports/python3/portfile.cmake
vendored
Executable file
295
externals/vcpkg/ports/python3/portfile.cmake
vendored
Executable file
@@ -0,0 +1,295 @@
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.")
|
||||
set(VCPKG_LIBRARY_LINKAGE static)
|
||||
endif()
|
||||
|
||||
set(PYTHON_VERSION_MAJOR 3)
|
||||
set(PYTHON_VERSION_MINOR 10)
|
||||
set(PYTHON_VERSION_PATCH 2)
|
||||
set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH})
|
||||
|
||||
set(PATCHES
|
||||
0002-use-vcpkg-zlib.patch
|
||||
0003-devendor-external-dependencies.patch
|
||||
0004-dont-copy-vcruntime.patch
|
||||
0005-only-build-required-projects.patch
|
||||
0009-python.pc.patch
|
||||
0010-bz2d.patch
|
||||
)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
list(PREPEND PATCHES 0001-static-library.patch)
|
||||
endif()
|
||||
|
||||
# Python 3.9 removed support for Windows 7. This patch re-adds support for Windows 7 and is therefore
|
||||
# required to build this port on Windows 7 itself due to Python using itself in its own build system.
|
||||
if("deprecated-win7-support" IN_LIST FEATURES)
|
||||
list(APPEND PATCHES 0006-restore-support-for-windows-7.patch)
|
||||
message(WARNING "Windows 7 support is deprecated and may be removed at any time.")
|
||||
elseif(VCPKG_TARGET_IS_WINDOWS AND CMAKE_SYSTEM_VERSION EQUAL 6.1)
|
||||
message(FATAL_ERROR "python3 requires the feature deprecated-win7-support when building on Windows 7.")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PYTHON_ALLOW_EXTENSIONS)
|
||||
# The Windows 11 SDK has a problem that causes it to error on the resource files, so we patch that.
|
||||
vcpkg_get_windows_sdk(WINSDK_VERSION)
|
||||
if("${WINSDK_VERSION}" VERSION_GREATER_EQUAL "10.0.22000")
|
||||
list(APPEND PATCHES "0007-workaround-windows-11-sdk-rc-compiler-error.patch")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO python/cpython
|
||||
REF v${PYTHON_VERSION}
|
||||
SHA512 14f0d1847d4361fa075adbe4dbf7339fb62be91d5419cf506abdf46b36dc5273564792d35e5a5e0608a8fa877a870152a593743c3b70a98c739d5bd028be9e18
|
||||
HEAD_REF master
|
||||
PATCHES ${PATCHES}
|
||||
)
|
||||
|
||||
vcpkg_replace_string("${SOURCE_PATH}/Makefile.pre.in" "$(INSTALL) -d -m $(DIRMODE)" "$(MKDIR_P)")
|
||||
|
||||
function(make_python_pkgconfig)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 arg "" "FILE;INSTALL_ROOT;EXEC_PREFIX;INCLUDEDIR;ABIFLAGS" "")
|
||||
|
||||
set(prefix "${CURRENT_PACKAGES_DIR}")
|
||||
set(libdir [[${prefix}/lib]])
|
||||
set(exec_prefix ${arg_EXEC_PREFIX})
|
||||
set(includedir ${arg_INCLUDEDIR})
|
||||
set(VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
|
||||
set(ABIFLAGS ${arg_ABIFLAGS})
|
||||
|
||||
string(REPLACE "python" "python-${VERSION}" out_file ${arg_FILE})
|
||||
set(out_full_path "${arg_INSTALL_ROOT}/lib/pkgconfig/${out_file}")
|
||||
configure_file("${SOURCE_PATH}/Misc/${arg_FILE}.in" ${out_full_path} @ONLY)
|
||||
|
||||
file(READ ${out_full_path} pkgconfig_file)
|
||||
string(REPLACE "-lpython${VERSION}" "-lpython${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}" pkgconfig_file "${pkgconfig_file}")
|
||||
file(WRITE ${out_full_path} "${pkgconfig_file}")
|
||||
endfunction()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
|
||||
# Due to the way Python handles C extension modules on Windows, a static python core cannot
|
||||
# load extension modules.
|
||||
if(PYTHON_ALLOW_EXTENSIONS)
|
||||
find_library(BZ2_RELEASE NAMES bz2 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(BZ2_DEBUG NAMES bz2d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(CRYPTO_RELEASE NAMES libcrypto PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(CRYPTO_DEBUG NAMES libcrypto PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(EXPAT_RELEASE NAMES libexpat libexpatMD PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(EXPAT_DEBUG NAMES libexpatd libexpatdMD PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(FFI_RELEASE NAMES libffi PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(FFI_DEBUG NAMES libffi PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(LZMA_RELEASE NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(LZMA_DEBUG NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(SQLITE_RELEASE NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(SQLITE_DEBUG NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(SSL_RELEASE NAMES libssl PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(SSL_DEBUG NAMES libssl PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
else()
|
||||
message(STATUS "WARNING: Static builds of Python will not have C extension modules available.")
|
||||
endif()
|
||||
find_library(ZLIB_RELEASE NAMES zlib PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(ZLIB_DEBUG NAMES zlib zlibd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
|
||||
configure_file("${SOURCE_PATH}/PC/pyconfig.h" "${SOURCE_PATH}/PC/pyconfig.h")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/python_vcpkg.props.in" "${SOURCE_PATH}/PCbuild/python_vcpkg.props")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.props.in" "${SOURCE_PATH}/PCbuild/openssl.props")
|
||||
file(WRITE "${SOURCE_PATH}/PCbuild/libffi.props"
|
||||
"<?xml version='1.0' encoding='utf-8'?>
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' />"
|
||||
)
|
||||
|
||||
if(PYTHON_ALLOW_EXTENSIONS)
|
||||
set(OPTIONS
|
||||
"/p:IncludeExtensions=true"
|
||||
"/p:IncludeExternals=true"
|
||||
"/p:IncludeCTypes=true"
|
||||
"/p:IncludeSSL=true"
|
||||
"/p:IncludeTkinter=false"
|
||||
"/p:IncludeTests=false"
|
||||
"/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/PCbuild/python_vcpkg.props"
|
||||
)
|
||||
else()
|
||||
set(OPTIONS
|
||||
"/p:IncludeExtensions=false"
|
||||
"/p:IncludeExternals=false"
|
||||
"/p:IncludeTests=false"
|
||||
"/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/PCbuild/python_vcpkg.props"
|
||||
)
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_UWP)
|
||||
list(APPEND OPTIONS "/p:IncludeUwp=true")
|
||||
else()
|
||||
list(APPEND OPTIONS "/p:IncludeUwp=false")
|
||||
endif()
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
list(APPEND OPTIONS "/p:_VcpkgPythonLinkage=DynamicLibrary")
|
||||
else()
|
||||
list(APPEND OPTIONS "/p:_VcpkgPythonLinkage=StaticLibrary")
|
||||
endif()
|
||||
|
||||
# _freeze_importlib.exe is run as part of the build process, so make sure the required dynamic libs are available.
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/bin")
|
||||
endif()
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/debug/bin")
|
||||
endif()
|
||||
|
||||
vcpkg_install_msbuild(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
PROJECT_SUBPATH "PCbuild/pcbuild.proj"
|
||||
OPTIONS ${OPTIONS}
|
||||
LICENSE_SUBPATH "LICENSE"
|
||||
TARGET_PLATFORM_VERSION "${WINSDK_VERSION}"
|
||||
SKIP_CLEAN
|
||||
)
|
||||
|
||||
# The extension modules must be placed in the DLLs directory, so we can't use vcpkg_copy_tools()
|
||||
if(PYTHON_ALLOW_EXTENSIONS)
|
||||
file(GLOB_RECURSE PYTHON_EXTENSIONS "${CURRENT_BUILDTREES_DIR}/*.pyd")
|
||||
list(FILTER PYTHON_EXTENSIONS EXCLUDE REGEX [[.*_d\.pyd]])
|
||||
file(COPY ${PYTHON_EXTENSIONS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs")
|
||||
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs")
|
||||
file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll")
|
||||
endif()
|
||||
|
||||
file(COPY "${SOURCE_PATH}/Include/" "${SOURCE_PATH}/PC/pyconfig.h"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
|
||||
FILES_MATCHING PATTERN *.h
|
||||
)
|
||||
file(COPY "${SOURCE_PATH}/Lib" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
||||
|
||||
# Remove any extension libraries and other unversioned binaries that could conflict with the python2 port.
|
||||
# You don't need to link against these anyway.
|
||||
file(GLOB PYTHON_LIBS
|
||||
"${CURRENT_PACKAGES_DIR}/lib/*.lib"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/lib/*.lib"
|
||||
)
|
||||
list(FILTER PYTHON_LIBS EXCLUDE REGEX [[python[0-9]*(_d)?\.lib$]])
|
||||
file(GLOB PYTHON_INSTALLERS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wininst-*.exe")
|
||||
file(REMOVE ${PYTHON_LIBS} ${PYTHON_INSTALLERS})
|
||||
|
||||
# pkg-config files
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
make_python_pkgconfig(FILE python.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
|
||||
EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
|
||||
make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
|
||||
EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
make_python_pkgconfig(FILE python.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
|
||||
EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
|
||||
make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
|
||||
EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
|
||||
endif()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
vcpkg_clean_msbuild()
|
||||
|
||||
# Remove static library belonging to executable
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
if (EXISTS "${CURRENT_PACKAGES_DIR}/lib/python.lib")
|
||||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/python.lib"
|
||||
"${CURRENT_PACKAGES_DIR}/lib/manual-link/python.lib")
|
||||
endif()
|
||||
if (EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/python_d.lib")
|
||||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/python_d.lib"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/python_d.lib")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(OPTIONS
|
||||
"--with-openssl=${CURRENT_INSTALLED_DIR}"
|
||||
"--without-ensurepip"
|
||||
"--with-suffix="
|
||||
"--with-system-expat"
|
||||
"--without-readline"
|
||||
"--disable-test-modules"
|
||||
)
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
list(APPEND OPTIONS "LIBS=-liconv -lintl")
|
||||
endif()
|
||||
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS ${OPTIONS}
|
||||
OPTIONS_DEBUG "--with-pydebug"
|
||||
)
|
||||
vcpkg_install_make(ADD_BIN_TO_PATH INSTALL_TARGET altinstall)
|
||||
|
||||
file(COPY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
||||
|
||||
# Makefiles, c files, __pycache__, and other junk.
|
||||
file(GLOB PYTHON_LIB_DIRS LIST_DIRECTORIES true
|
||||
"${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*")
|
||||
list(FILTER PYTHON_LIB_DIRS INCLUDE REGEX [[config-[0-9].*.*]])
|
||||
file(REMOVE_RECURSE ${PYTHON_LIB_DIRS})
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}d")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man1")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright")
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/usage" usage)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(PYTHON_ALLOW_EXTENSIONS)
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/usage.win" usage_extra)
|
||||
else()
|
||||
set(usage_extra "")
|
||||
endif()
|
||||
else()
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/usage.unix" usage_extra)
|
||||
endif()
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" "${usage}\n${usage_extra}")
|
||||
|
||||
function(_generate_finder)
|
||||
cmake_parse_arguments(PythonFinder "NO_OVERRIDE" "DIRECTORY;PREFIX" "" ${ARGN})
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/share/${PythonFinder_DIRECTORY}/vcpkg-cmake-wrapper.cmake"
|
||||
@ONLY
|
||||
)
|
||||
endfunction()
|
||||
|
||||
message(STATUS "Installing cmake wrappers")
|
||||
_generate_finder(DIRECTORY "python" PREFIX "Python")
|
||||
_generate_finder(DIRECTORY "python3" PREFIX "Python3")
|
||||
_generate_finder(DIRECTORY "pythoninterp" PREFIX "PYTHON" NO_OVERRIDE)
|
||||
|
||||
if (NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
function(replace_dirs_in_config_file python_config_file)
|
||||
vcpkg_replace_string("${python_config_file}" "${CURRENT_INSTALLED_DIR}" "' + _base + '")
|
||||
vcpkg_replace_string("${python_config_file}" "${CURRENT_PACKAGES_DIR}" "' + _base + '")
|
||||
vcpkg_replace_string("${python_config_file}" "${CURRENT_BUILDTREES_DIR}" "not/existing")
|
||||
endfunction()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
file(GLOB python_config_files "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata*")
|
||||
list(POP_FRONT python_config_files python_config_file)
|
||||
vcpkg_replace_string("${python_config_file}" "# system configuration generated and used by the sysconfig module" "# system configuration generated and used by the sysconfig module\nimport os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))\n")
|
||||
replace_dirs_in_config_file("${python_config_file}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(GLOB python_config_files "${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata*")
|
||||
list(POP_FRONT python_config_files python_config_file)
|
||||
vcpkg_replace_string("${python_config_file}" "# system configuration generated and used by the sysconfig module" "# system configuration generated and used by the sysconfig module\nimport os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))\n")
|
||||
replace_dirs_in_config_file("${python_config_file}")
|
||||
endif()
|
||||
endif()
|
41
externals/vcpkg/ports/python3/python_vcpkg.props.in
vendored
Executable file
41
externals/vcpkg/ports/python3/python_vcpkg.props.in
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<CLCompile>
|
||||
<!-- Use vcpkg ports instead of vendored externals -->
|
||||
<PreprocessorDefinitions>_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="${VCPKG_LIBRARY_LINKAGE} == 'static'">XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
%(AdditionalIncludeDirectories);${CURRENT_INSTALLED_DIR}/include
|
||||
</AdditionalIncludeDirectories>
|
||||
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|Debug'">MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|Release'">MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|Debug'">MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|Release'">MultiThreadedDLL</RuntimeLibrary>
|
||||
</CLCompile>
|
||||
<Link>
|
||||
<!-- Required Libs -->
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Release'">
|
||||
${ZLIB_RELEASE};%(AdditionalDependencies)
|
||||
</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">
|
||||
${ZLIB_DEBUG};%(AdditionalDependencies)
|
||||
</AdditionalDependencies>
|
||||
|
||||
<!-- Extension modules -->
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Release|true'">
|
||||
${BZ2_RELEASE};${EXPAT_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE_RELEASE};%(AdditionalDependencies)
|
||||
</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Debug|true'">
|
||||
${BZ2_DEBUG};${EXPAT_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE_DEBUG};%(AdditionalDependencies)
|
||||
</AdditionalDependencies>
|
||||
</Link>
|
||||
|
||||
<Lib>
|
||||
<!-- Required to prevent linker errors on Visual Studio 2017 with static CRT -->
|
||||
<TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x86'">MachineX86</TargetMachine>
|
||||
<TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x64'">MachineX64</TargetMachine>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
4
externals/vcpkg/ports/python3/usage
vendored
Executable file
4
externals/vcpkg/ports/python3/usage
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
The package python3 is compatible with built-in CMake targets:
|
||||
|
||||
find_package(Python3 COMPONENTS Development REQUIRED)
|
||||
target_link_libraries(main PRIVATE Python3::Python)
|
9
externals/vcpkg/ports/python3/usage.unix
vendored
Executable file
9
externals/vcpkg/ports/python3/usage.unix
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
The package python3 provides a python interpreter that supports virtual environments:
|
||||
|
||||
$ tools/python3/python3.10 -m venv /path/to/venv
|
||||
$ export VIRTUAL_ENV=/path/to/venv
|
||||
$ export PATH=/path/to/venv/bin:$PATH
|
||||
$ export -n PYTHONHOME
|
||||
$ unset PYTHONHOME
|
||||
|
||||
See https://docs.python.org/3/library/venv.html for more details.
|
8
externals/vcpkg/ports/python3/usage.win
vendored
Executable file
8
externals/vcpkg/ports/python3/usage.win
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
The package python3 provides a python interpreter that supports virtual environments:
|
||||
|
||||
>tools\python3\python3.10 -m venv c:\path\to\venv
|
||||
>set VIRTUAL_ENV=c:\path\to\venv
|
||||
>set PATH=c:\path\to\venv\bin;%PATH%
|
||||
>set PYTHONHOME=
|
||||
|
||||
See https://docs.python.org/3/library/venv.html for more details.
|
120
externals/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake
vendored
Executable file
120
externals/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake
vendored
Executable file
@@ -0,0 +1,120 @@
|
||||
# For very old ports whose upstream do not properly set the minimum CMake version.
|
||||
cmake_policy(SET CMP0012 NEW)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
|
||||
# This prevents the port's python.exe from overriding the Python fetched by
|
||||
# vcpkg_find_acquire_program(PYTHON3) and prevents the vcpkg toolchain from
|
||||
# stomping on FindPython's default functionality.
|
||||
list(REMOVE_ITEM CMAKE_PROGRAM_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3")
|
||||
if(@PythonFinder_NO_OVERRIDE@)
|
||||
_find_package(${ARGS})
|
||||
return()
|
||||
endif()
|
||||
|
||||
# CMake's FindPython's separation of concerns is very muddy. We only want to force vcpkg's Python
|
||||
# if the consumer is using the development component. What we don't want to do is break detection
|
||||
# of the system Python, which may have certain packages the user expects. But - if the user is
|
||||
# embedding Python or using both the development and interpreter components, then we need the
|
||||
# interpreter matching vcpkg's Python libraries. Note that the "Development" component implies
|
||||
# both "Development.Module" and "Development.Embed"
|
||||
if("Development" IN_LIST ARGS OR "Development.Embed" IN_LIST ARGS)
|
||||
set(_PythonFinder_WantInterp TRUE)
|
||||
set(_PythonFinder_WantLibs TRUE)
|
||||
elseif("Development.Module" IN_LIST ARGS)
|
||||
if("Interpreter" IN_LIST ARGS)
|
||||
set(_PythonFinder_WantInterp TRUE)
|
||||
endif()
|
||||
set(_PythonFinder_WantLibs TRUE)
|
||||
endif()
|
||||
|
||||
if(_PythonFinder_WantLibs)
|
||||
find_path(
|
||||
@PythonFinder_PREFIX@_INCLUDE_DIR
|
||||
NAMES "Python.h"
|
||||
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include"
|
||||
PATH_SUFFIXES "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# Don't set the public facing hint or the finder will be unable to detect the debug library.
|
||||
# Internally, it uses the same value with an underscore prepended.
|
||||
find_library(
|
||||
_@PythonFinder_PREFIX@_LIBRARY_RELEASE
|
||||
NAMES
|
||||
"python@PYTHON_VERSION_MAJOR@@PYTHON_VERSION_MINOR@"
|
||||
"python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
|
||||
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_library(
|
||||
_@PythonFinder_PREFIX@_LIBRARY_DEBUG
|
||||
NAMES
|
||||
"python@PYTHON_VERSION_MAJOR@@PYTHON_VERSION_MINOR@_d"
|
||||
"python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@d"
|
||||
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(_PythonFinder_WantInterp)
|
||||
find_program(
|
||||
@PythonFinder_PREFIX@_EXECUTABLE
|
||||
NAMES "python" "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
|
||||
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
|
||||
_find_package(${ARGS})
|
||||
|
||||
if(@VCPKG_LIBRARY_LINKAGE@ STREQUAL static)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
# Python for Windows embeds the zlib module into the core, so we have to link against it.
|
||||
# This is a separate extension module on Unix-like platforms.
|
||||
if(WIN32)
|
||||
find_dependency(ZLIB)
|
||||
if(TARGET @PythonFinder_PREFIX@::Python)
|
||||
set_property(TARGET @PythonFinder_PREFIX@::Python APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
endif()
|
||||
if(TARGET @PythonFinder_PREFIX@::Module)
|
||||
set_property(TARGET @PythonFinder_PREFIX@::Module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
endif()
|
||||
if(DEFINED @PythonFinder_PREFIX@_LIBRARIES)
|
||||
list(APPEND @PythonFinder_PREFIX@_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
find_dependency(Iconv)
|
||||
find_dependency(Intl)
|
||||
if(TARGET @PythonFinder_PREFIX@::Python)
|
||||
get_target_property(_PYTHON_INTERFACE_LIBS @PythonFinder_PREFIX@::Python INTERFACE_LINK_LIBRARIES)
|
||||
list(REMOVE_ITEM _PYTHON_INTERFACE_LIBS "-liconv" "-lintl")
|
||||
list(APPEND _PYTHON_INTERFACE_LIBS
|
||||
Iconv::Iconv
|
||||
"$<IF:$<CONFIG:Debug>,${Intl_LIBRARY_DEBUG},${Intl_LIBRARY_RELEASE}>"
|
||||
)
|
||||
set_property(TARGET @PythonFinder_PREFIX@::Python PROPERTY INTERFACE_LINK_LIBRARIES ${_PYTHON_INTERFACE_LIBS})
|
||||
unset(_PYTHON_INTERFACE_LIBS)
|
||||
endif()
|
||||
if(TARGET @PythonFinder_PREFIX@::Module)
|
||||
get_target_property(_PYTHON_INTERFACE_LIBS @PythonFinder_PREFIX@::Module INTERFACE_LINK_LIBRARIES)
|
||||
list(REMOVE_ITEM _PYTHON_INTERFACE_LIBS "-liconv" "-lintl")
|
||||
list(APPEND _PYTHON_INTERFACE_LIBS
|
||||
Iconv::Iconv
|
||||
"$<IF:$<CONFIG:Debug>,${Intl_LIBRARY_DEBUG},${Intl_LIBRARY_RELEASE}>"
|
||||
)
|
||||
set_property(TARGET @PythonFinder_PREFIX@::Module PROPERTY INTERFACE_LINK_LIBRARIES ${_PYTHON_INTERFACE_LIBS})
|
||||
unset(_PYTHON_INTERFACE_LIBS)
|
||||
endif()
|
||||
if(DEFINED @PythonFinder_PREFIX@_LIBRARIES)
|
||||
list(APPEND @PythonFinder_PREFIX@_LIBRARIES "-framework CoreFoundation" ${Iconv_LIBRARIES} ${Intl_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
_find_package(${ARGS})
|
||||
endif()
|
||||
|
||||
unset(_PythonFinder_WantInterp)
|
||||
unset(_PythonFinder_WantLibs)
|
50
externals/vcpkg/ports/python3/vcpkg.json
vendored
Executable file
50
externals/vcpkg/ports/python3/vcpkg.json
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "python3",
|
||||
"version": "3.10.2",
|
||||
"port-version": 2,
|
||||
"description": "The Python programming language",
|
||||
"homepage": "https://github.com/python/cpython",
|
||||
"license": "Python-2.0",
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "bzip2",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
"expat",
|
||||
{
|
||||
"name": "gettext",
|
||||
"platform": "osx"
|
||||
},
|
||||
{
|
||||
"name": "libffi",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
{
|
||||
"name": "libiconv",
|
||||
"platform": "osx"
|
||||
},
|
||||
{
|
||||
"name": "liblzma",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
{
|
||||
"name": "openssl",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
{
|
||||
"name": "python3",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "sqlite3",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
"zlib"
|
||||
],
|
||||
"features": {
|
||||
"deprecated-win7-support": {
|
||||
"description": "Deprecated support for the Windows 7 platform -- may be removed at any time."
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user