From bfd2005224746671bd771927271256f01ef4c437 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 14 Dec 2024 18:40:38 +1100 Subject: [PATCH] Detect zlibstatic.lib when building --- setup.py | 13 +++++++++---- winbuild/build_prepare.py | 9 ++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index eea21fa3407..65cd9a774ee 100644 --- a/setup.py +++ b/setup.py @@ -692,10 +692,15 @@ def build_extensions(self) -> None: if _find_include_file(self, "zlib.h"): if _find_library_file(self, "z"): feature.set("zlib", "z") - elif sys.platform == "win32" and _find_library_file(self, "zlib"): - feature.set("zlib", "zlib") # alternative name - elif sys.platform == "win32" and _find_library_file(self, "zdll"): - feature.set("zlib", "zdll") # dll import library + elif sys.platform == "win32": + for library in ( + "zlib", + "zlibstatic", + "zdll", # dll import library + ): + if _find_library_file(self, library): + feature.set("zlib", library) + break if feature.want("jpeg"): _dbg("Looking for jpeg") diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 5bdb5fafedb..2711ae396e5 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -163,18 +163,13 @@ def cmd_msbuild( "filename": f"zlib-ng-{V['ZLIBNG']}.zip", "dir": f"zlib-ng-{V['ZLIBNG']}", "license": "LICENSE.md", - "patch": { - r"CMakeLists.txt": { - "set_target_properties(zlib PROPERTIES OUTPUT_NAME zlibstatic${{SUFFIX}})": "set_target_properties(zlib PROPERTIES OUTPUT_NAME zlib)", # noqa: E501 - }, - }, "build": [ *cmds_cmake( "zlib", "-DBUILD_SHARED_LIBS:BOOL=OFF", "-DZLIB_COMPAT:BOOL=ON" ), ], "headers": [r"z*.h"], - "libs": [r"zlib.lib"], + "libs": ["zlibstatic.lib"], }, "xz": { "url": f"https://github.com/tukaani-project/xz/releases/download/v{V['XZ']}/FILENAME", @@ -285,7 +280,7 @@ def cmd_msbuild( "": "FT_CONFIG_OPTION_SYSTEM_ZLIB;FT_CONFIG_OPTION_USE_PNG;FT_CONFIG_OPTION_USE_HARFBUZZ;FT_CONFIG_OPTION_USE_BROTLI", # noqa: E501 "": r"{dir_harfbuzz}\src;{inc_dir}", # noqa: E501 "": "{lib_dir}", # noqa: E501 - "": f"zlib.lib;libpng{V['LIBPNG_XY']}.lib;brotlicommon.lib;brotlidec.lib", # noqa: E501 + "": f"zlibstatic.lib;libpng{V['LIBPNG_XY']}.lib;brotlicommon.lib;brotlidec.lib", # noqa: E501 }, r"src/autofit/afshaper.c": { # link against harfbuzz.lib