@@ -1124,26 +1124,27 @@ def do_custom_build(self):
1124
1124
subprocess .check_call (["make" ], env = env , cwd = src_path )
1125
1125
else :
1126
1126
# compilation on windows
1127
+ shutil .rmtree (str (Path (src_path , "objs" )), ignore_errors = True )
1127
1128
FREETYPE_BUILD_CMD = r"""
1128
1129
call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" ^
1129
1130
/Release /{xXX} /xp
1130
1131
call "{vcvarsall}" {xXX}
1131
1132
set MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
1132
1133
%MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
1133
- /t:Clean;Build /p:Configuration="{config} ";Platform={WinXX}
1134
+ /t:Clean;Build /p:Configuration="Release ";Platform={WinXX}
1134
1135
"""
1135
- from setup_external_compile import prepare_build_cmd , X64 , xXX
1136
+ import distutils . msvc9compiler as msvc
1136
1137
# Note: freetype has no build profile for 2014, so we don't bother...
1137
1138
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 () )],
1147
1148
shell = True , cwd = src_path )
1148
1149
# Move to the corresponding Unix build path.
1149
1150
Path (src_path , "objs/.libs" ).mkdir ()
0 commit comments