@@ -656,9 +656,15 @@ def do_custom_build(self, env):
656656 else : # compilation on windows
657657 shutil .rmtree (src_path / "objs" , ignore_errors = True )
658658 is_x64 = platform .architecture ()[0 ] == '64bit'
659- msbuild_platform = (
660- 'ARM64' if platform .machine () == 'ARM64' else 'x64' if is_x64 else 'Win32' )
661- base_path = Path ("build/freetype-{}/builds/windows" .format (LOCAL_FREETYPE_VERSION ))
659+ if platform .machine () == 'ARM64' :
660+ msbuild_platform = 'ARM64'
661+ elif is_x64 :
662+ msbuild_platform = 'x64'
663+ else :
664+ msbuild_platform = 'Win32'
665+ base_path = Path (
666+ f"build/freetype-{ LOCAL_FREETYPE_VERSION } /builds/windows"
667+ )
662668 vc = 'vc2010'
663669 sln_path = (
664670 base_path / vc / "freetype.sln"
@@ -702,14 +708,13 @@ def do_custom_build(self, env):
702708 (src_path / "objs" / ".libs" ).mkdir ()
703709 # Be robust against change of FreeType version.
704710 lib_paths = Path (src_path / "objs" ).rglob ('freetype*.lib' )
705- libfreetype_file = None
706- for lib_path in lib_paths :
707- # check if freetype.lib in required platform directory
708- if msbuild_platform in lib_path .resolve ().as_uri ():
709- libfreetype_file = lib_path
710- continue
711- print ("Copying {} to {}" .format (lib_path .resolve (), src_path / "objs/.libs/libfreetype.lib" ))
712- shutil .copy2 (libfreetype_file , src_path / "objs/.libs/libfreetype.lib" )
711+ # Select FreeType library for required platform
712+ lib_path = next (
713+ p for p in lib_paths
714+ if msbuild_platform in p .resolve ().as_uri ()
715+ )
716+ print (f"Copying { lib_path } to { src_path } /objs/.libs/libfreetype.lib" )
717+ shutil .copy2 (lib_path , src_path / "objs/.libs/libfreetype.lib" )
713718
714719
715720class Qhull (SetupPackage ):
0 commit comments