@@ -889,6 +889,19 @@ def hack_project_files(
889
889
pcbuild_proj , b'<Projects2 Include="_freeze_importlib.vcxproj" />' , b""
890
890
)
891
891
892
+ # Switch to the static version of the run-time library.
893
+ if static :
894
+ static_replace_in_file (
895
+ pcbuild_path / "pyproject.props" ,
896
+ b"<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" ,
897
+ b"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" ,
898
+ )
899
+ static_replace_in_file (
900
+ pcbuild_path / "pyproject.props" ,
901
+ b"<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" ,
902
+ b"<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" ,
903
+ )
904
+
892
905
893
906
PYPORT_EXPORT_SEARCH_NEW = b"""
894
907
#if defined(__CYGWIN__)
@@ -1225,6 +1238,9 @@ def build_openssl_for_arch(
1225
1238
{** env , "CFLAGS" : env .get ("CFLAGS" , "" ) + " /FS" ,},
1226
1239
)
1227
1240
1241
+ if "static" in profile :
1242
+ static_replace_in_file (source_root / "Makefile" , b"/MD" , b"/MT" )
1243
+
1228
1244
# exec_and_log(["nmake"], source_root, env)
1229
1245
exec_and_log (
1230
1246
[str (jom_path / "jom" ), "/J" , str (multiprocessing .cpu_count ())],
@@ -1965,8 +1981,10 @@ def build_cpython(
1965
1981
# __declspec(dllexport), even for static distributions.
1966
1982
python_symbol_visibility = "dllexport"
1967
1983
1968
- # We currently always link vcruntime140.dll.
1969
- crt_features = ["vcruntime:140" ]
1984
+ if static :
1985
+ crt_features = ["static" ]
1986
+ else :
1987
+ crt_features = ["vcruntime:140" ]
1970
1988
1971
1989
if "pgo" in profile :
1972
1990
optimizations = "pgo"
0 commit comments