Skip to content

Commit 7544c46

Browse files
authored
Merge pull request #11570 from anntzer/morefreetypewindows
More simplifications to FreeType setup on Windows.
2 parents 7b066c6 + a1a04fa commit 7544c46

File tree

2 files changed

+6
-49
lines changed

2 files changed

+6
-49
lines changed

setup_external_compile.py

+3-42
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,15 @@
1919
- VS 2010, 64 bit -- Windows SDK v7.1
2020
"""
2121

22-
import sys
2322
import platform
24-
import os
25-
import glob
26-
import shutil
27-
import zipfile
28-
import tarfile
2923
import distutils.msvc9compiler as msvc
3024

31-
def fixproj(project_file, bit_target):
32-
"""
33-
:param bit_target: one of 'Win32' or 'x64'
34-
"""
35-
with open(project_file, 'r') as fd:
36-
content = '\n'.join(line.strip() for line in fd if line.strip())
37-
content = content.replace('Win32', bit_target).replace('x64', bit_target)
38-
with open(project_file, 'w') as fd:
39-
fd.write(content)
40-
41-
def tar_extract(tar_file, target):
42-
with tarfile.open(tar_file, 'r:gz') as tgz:
43-
tgz.extractall(target)
44-
45-
def zip_extract(zip_file, target):
46-
with zipfile.ZipFile(zip_file) as zf:
47-
zf.extractall(target)
48-
4925
# Configuration selection & declaration:
50-
DEPSSRC = os.path.join(os.path.dirname(os.path.normpath(__file__)),
51-
'deps_source')
52-
DEPSBUILD = os.path.join(os.path.dirname(os.path.normpath(__file__)), 'build')
5326
X64 = platform.architecture()[0] == '64bit'
54-
PYVER = sys.version_info[:2]
55-
VS2010 = PYVER >= (3, 3)
5627
xXX = 'x64' if X64 else 'x86'
57-
# If not VS2010, then use VS2008
58-
59-
VCVARSALL = None
6028

6129
def prepare_build_cmd(build_cmd, **kwargs):
62-
global VCVARSALL
30+
VCVARSALL = msvc.find_vcvarsall(10.0)
6331
if VCVARSALL == None:
64-
candidate = msvc.find_vcvarsall(10.0 if VS2010 else 9.0)
65-
if candidate == None:
66-
raise RuntimeError('Microsoft VS {} required'
67-
.format('2010' if VS2010 else '2008'))
68-
else:
69-
VCVARSALL = candidate
70-
71-
return build_cmd.format(
72-
vcvarsall=VCVARSALL, xXX=xXX, **kwargs)
32+
raise RuntimeError('Microsoft VS 2010 required')
33+
return build_cmd.format(vcvarsall=VCVARSALL, xXX=xXX, **kwargs)

setupext.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -1132,19 +1132,15 @@ def do_custom_build(self):
11321132
%MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
11331133
/t:Clean;Build /p:Configuration="{config}";Platform={WinXX}
11341134
"""
1135-
from setup_external_compile import fixproj, prepare_build_cmd, VS2010, X64, xXX
1135+
from setup_external_compile import prepare_build_cmd, X64, xXX
11361136
# Note: freetype has no build profile for 2014, so we don't bother...
1137-
vc = 'vc2010' if VS2010 else 'vc2008'
1137+
vc = 'vc2010'
11381138
WinXX = 'x64' if X64 else 'Win32'
1139-
# This is only false for py2.7, even on py3.5...
1140-
if not VS2010:
1141-
fixproj(os.path.join(src_path, 'builds', 'windows', vc, 'freetype.sln'), WinXX)
1142-
fixproj(os.path.join(src_path, 'builds', 'windows', vc, 'freetype.vcproj'), WinXX)
11431139

11441140
cmdfile = os.path.join("build", "build_freetype.cmd")
11451141
with open(cmdfile, 'w') as cmd:
11461142
cmd.write(prepare_build_cmd(FREETYPE_BUILD_CMD, vc20xx=vc, WinXX=WinXX,
1147-
config='Release' if VS2010 else 'LIB Release'))
1143+
config='Release'))
11481144

11491145
shutil.rmtree(str(Path(src_path, "objs")), ignore_errors=True)
11501146
subprocess.check_call([os.path.abspath(cmdfile)],

0 commit comments

Comments
 (0)