2021-03-30 01:09:14 +08:00
|
|
|
From 14d91e4f4a9377f47cc4cc33faeeb7c82f64b176 Mon Sep 17 00:00:00 2001
|
2020-11-21 01:44:51 +08:00
|
|
|
From: Adam Johnson <AdamJohnso@gmail.com>
|
|
|
|
Date: Thu, 28 May 2020 17:25:21 -0400
|
2021-03-30 01:09:14 +08:00
|
|
|
Subject: [PATCH 1/7] static library
|
2020-11-21 01:44:51 +08:00
|
|
|
|
|
|
|
builds the pythoncore as a static library instead of a DLL
|
|
|
|
---
|
2021-03-30 01:09:14 +08:00
|
|
|
PC/pyconfig.h | 9 +++++++++
|
|
|
|
PCbuild/pythoncore.vcxproj | 4 ++--
|
|
|
|
2 files changed, 11 insertions(+), 2 deletions(-)
|
2020-11-21 01:44:51 +08:00
|
|
|
|
2020-06-12 13:23:26 +08:00
|
|
|
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
|
2021-03-30 01:09:14 +08:00
|
|
|
index d7d3cf081e..34269f0b75 100644
|
2020-06-12 13:23:26 +08:00
|
|
|
--- a/PC/pyconfig.h
|
|
|
|
+++ b/PC/pyconfig.h
|
2021-03-30 01:09:14 +08:00
|
|
|
@@ -251,6 +251,7 @@ typedef int pid_t;
|
2020-06-12 13:23:26 +08:00
|
|
|
|
|
|
|
/* 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 */
|
2021-03-30 01:09:14 +08:00
|
|
|
@@ -276,6 +277,14 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
2020-06-12 13:23:26 +08:00
|
|
|
# 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")
|
2021-03-30 01:09:14 +08:00
|
|
|
+# if Py_WINVER > 0x0601
|
|
|
|
+# pragma comment(lib, "pathcch.lib")
|
|
|
|
+# endif /* Py_WINVER */
|
2020-06-12 13:23:26 +08:00
|
|
|
#endif /* MS_COREDLL */
|
|
|
|
|
|
|
|
#if defined(MS_WIN64)
|
|
|
|
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
2021-03-30 01:09:14 +08:00
|
|
|
index 2625d0293d..2f8bdaa931 100644
|
2020-06-12 13:23:26 +08:00
|
|
|
--- 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" />
|
2021-03-30 01:09:14 +08:00
|
|
|
@@ -102,7 +102,7 @@
|
2020-06-12 13:23:26 +08:00
|
|
|
<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>
|
2020-11-21 01:44:51 +08:00
|
|
|
--
|
|
|
|
2.28.0.windows.1
|
|
|
|
|