mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 09:19:00 +08:00
c6928dfb9e
* [python3] Update to 3.11.3 * Force set PythonForBuild on windows * Set LD_LIBRARY_PATH on unix * Always use vcpkg_find_acquire_program(PYTHON3) on windows * Remove LD_LIBRARY_PATH shenanigans * [vtk] Parse python version from include folder * Fix static builds on windows * Pass --with-build-python on unix * [omniorb] Fix python version in patch * Resurrect rpath patch * [python3] fix usage * [gobject-introspection] don't hardcode python version * Update vcpkg_find_aquire_program(PYTHON3) This is also required for gobject-introspection * [paraview] don't hardcode python version * [vtk-dicom] don't hardcode python version * Update python in vcpkgTools.xml * Fix host arch detection in vcpkg_find_acquire_program(PYTHON3) * [libpq] Don't hardcode python version * [shiva] Don't pass python variables * [vcpkg-get-python-packages] Delete unused file, update hardcoded python version * [python3] update to 3.11.4 * [omniorb] Use PREPEND in vcpkg_add_to_path So that python from vcpkg is picked before system python * libpq quickfix * re-fix libpq * fix vcpkg-get-python-packages * Make windows 7 patch compatible with unix builds * Copy pyd files to bin Also fixes copying files that do not belong to current build tree * Fix static builds * Speculatively fix osx regression * Fix omniorb on unix * [gobject-introspection] fix windows builds * [vtk] Update vendored copy of mpi4py for python 3.11 support * [mdl-sdk] Fix python * [gobject-introspection] fix the fix of a fix... * Update versions * Undo changes in gobject-introspection and vcpkg_find_aquire_program(PYTHON3) --------- Co-authored-by: root <root@DESKTOP-UIPL9V8>
154 lines
6.2 KiB
Diff
154 lines
6.2 KiB
Diff
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/Modules/getpath.c b/Modules/getpath.c
|
|
index d7d3cf081e..34269f0b75 100644
|
|
--- a/Modules/getpath.c
|
|
+++ b/Modules/getpath.c
|
|
@@ -801,10 +801,12 @@ static int
|
|
library_to_dict(PyObject *dict, const char *key)
|
|
{
|
|
#ifdef MS_WINDOWS
|
|
+#ifdef Py_ENABLE_SHARED
|
|
extern HMODULE PyWin_DLLhModule;
|
|
if (PyWin_DLLhModule) {
|
|
return winmodule_to_dict(dict, key, PyWin_DLLhModule);
|
|
}
|
|
+#endif
|
|
#elif defined(WITH_NEXT_FRAMEWORK)
|
|
static char modPath[MAXPATHLEN + 1];
|
|
static int modPathInitialized = -1;
|
|
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,9 @@ 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 */
|
|
+#ifndef Py_NO_ENABLE_SHARED
|
|
+#define Py_NO_ENABLE_SHARED
|
|
+#endif
|
|
#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,15 @@ 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")
|
|
+# pragma comment(lib, "bcrypt.lib")
|
|
+# if Py_WINVER > 0x0601
|
|
+# pragma comment(lib, "pathcch.lib")
|
|
+# endif /* Py_WINVER */
|
|
#endif /* MS_COREDLL */
|
|
|
|
#if defined(MS_WIN64)
|
|
diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
|
|
index 70c336a9d3..ba797e8afd 100644
|
|
--- a/PCbuild/pcbuild.proj
|
|
+++ b/PCbuild/pcbuild.proj
|
|
@@ -45,7 +45,7 @@
|
|
<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" Condition="false" />
|
|
<!-- pyshellext.dll -->
|
|
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/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
|
index 2625d0293d..2f8bdaa931 100644
|
|
--- a/PCbuild/_freeze_module.vcxproj
|
|
+++ b/PCbuild/_freeze_module.vcxproj
|
|
@@ -88,7 +88,7 @@
|
|
<PropertyGroup Label="UserMacros" />
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
- <PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
+ <PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<Optimization>Disabled</Optimization>
|
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
|
</ClCompile>
|
|
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
|
|
index ac49f7867a..f3583345ff 100644
|
|
--- a/Python/dynload_win.c
|
|
+++ b/Python/dynload_win.c
|
|
@@ -163,6 +163,7 @@ static char *GetPythonImport (HINSTANCE hModule)
|
|
return NULL;
|
|
}
|
|
|
|
+#ifdef Py_ENABLE_SHARED
|
|
/* Load python3.dll before loading any extension module that might refer
|
|
to it. That way, we can be sure that always the python3.dll corresponding
|
|
to this python DLL is loaded, not a python3.dll that might be on the path
|
|
@@ -216,6 +217,7 @@ _Py_CheckPython3(void)
|
|
return hPython3 != NULL;
|
|
#undef MAXPATHLEN
|
|
}
|
|
+#endif /* Py_ENABLE_SHARED */
|
|
|
|
dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
|
const char *shortname,
|
|
@@ -224,7 +226,9 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
|
dl_funcptr p;
|
|
char funcname[258], *import_python;
|
|
|
|
+#ifdef Py_ENABLE_SHARED
|
|
_Py_CheckPython3();
|
|
+#endif /* Py_ENABLE_SHARED */
|
|
|
|
#if USE_UNICODE_WCHAR_CACHE
|
|
const wchar_t *wpathname = _PyUnicode_AsUnicode(pathname);
|
|
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
|
|
|