@@ -1124,26 +1124,27 @@ def do_custom_build(self):
11241124 subprocess .check_call (["make" ], env = env , cwd = src_path )
11251125 else :
11261126 # compilation on windows
1127+ shutil .rmtree (str (Path (src_path , "objs" )), ignore_errors = True )
11271128 FREETYPE_BUILD_CMD = r"""
11281129call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" ^
11291130 /Release /{xXX} /xp
11301131call "{vcvarsall}" {xXX}
11311132set MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
11321133%MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
1133- /t:Clean;Build /p:Configuration="{config} ";Platform={WinXX}
1134+ /t:Clean;Build /p:Configuration="Release ";Platform={WinXX}
11341135"""
1135- from setup_external_compile import prepare_build_cmd , X64 , xXX
1136+ import distutils . msvc9compiler as msvc
11361137 # Note: freetype has no build profile for 2014, so we don't bother...
11371138 vc = 'vc2010'
1138- WinXX = 'x64' if X64 else 'Win32'
1139-
1140- cmdfile = os . path . join ( "build" , "build_freetype.cmd" )
1141- with open ( cmdfile , 'w' ) as cmd :
1142- cmd . write ( prepare_build_cmd ( FREETYPE_BUILD_CMD , vc20xx = vc , WinXX = WinXX ,
1143- config = 'Release' ) )
1144-
1145- shutil . rmtree ( str ( Path ( src_path , "objs" )), ignore_errors = True )
1146- subprocess .check_call ([os . path . abspath (cmdfile )],
1139+ WinXX = 'x64' if platform . architecture ()[ 0 ] == '64bit' else 'Win32'
1140+ xXX = 'x64' if platform . architecture ()[ 0 ] == '64bit' else 'x86'
1141+ vcvarsall = msvc . find_vcvarsall ( 10.0 )
1142+ if vcvarsall is None :
1143+ raise RuntimeError ( 'Microsoft VS 2010 required' )
1144+ cmdfile = Path ( "build/build_freetype.cmd" )
1145+ cmdfile . write_text ( FREETYPE_BUILD_CMD . format (
1146+ vc20xx = vc , WinXX = WinXX , xXX = xXX , vcvarsall = vcvarsall ) )
1147+ subprocess .check_call ([str (cmdfile . resolve () )],
11471148 shell = True , cwd = src_path )
11481149 # Move to the corresponding Unix build path.
11491150 Path (src_path , "objs/.libs" ).mkdir ()
0 commit comments