Skip to content

Instantly share code, notes, and snippets.

@Tillsten
Created December 26, 2015 04:55
Show Gist options
  • Select an option

  • Save Tillsten/d0f176667fed7cea17cd to your computer and use it in GitHub Desktop.

Select an option

Save Tillsten/d0f176667fed7cea17cd to your computer and use it in GitHub Desktop.
Freetype build
FREETYPE_BUILD_CMD = """\
@ECHO OFF
REM call "%ProgramFiles%\\Microsoft SDKs\\Windows\\v7.0\\Bin\\SetEnv.Cmd" /Release /{xXX} /xp
call "{vcvarsall}" {xXX}
set BUILDDIR=%FREETYPE%-build
rd /S /Q %BUILDDIR%
set CMAKE="C:\\Program Files (x86)\\CMake\\bin\\cmake.exe"
%CMAKE% -G"NMake Makefiles" -H%FREETYPE% -B%BUILDDIR% -DCMAKE_BUILD_TYPE=Release
cd %BUILDDIR%
nmake -f Makefile
xcopy /Y /E /Q %FREETYPE%\\include %INCLIB%
xcopy /Y /E /Q %FREETYPE%\\include %INCLIB%
copy /Y /B %BUILDDIR%\\*.lib %INCLIB%\\freetype.lib
"""
def build_freetype():
inclib = config_dir()
if not os.path.exists(inclib):
os.mkdir(inclib)
distfile = os.path.join(DEPSSRC, 'ft26.zip')
compfile = os.path.join(inclib, 'freetype.lib')
if os.path.exists(compfile) and os.path.getmtime(distfile) < os.path.getmtime(compfile):
# already built
return
vc = 'vc2010' if VS2010 else 'vc2008'
WinXX = 'x64' if X64 else 'Win32'
#zip_extract(distfile, DEPSBUILD)
ft_dir = os.path.join(DEPSBUILD, 'freetype-2.6')
cmdfile = os.path.join(DEPSBUILD, 'build_freetype.cmd')
with open(cmdfile, 'w') as cmd:
cmd.write(prepare_build_cmd(FREETYPE_BUILD_CMD, vc20xx=vc, WinXX=WinXX, config='Release' if VS2010 else 'LIB Release'))
os.environ['INCLIB'] = inclib
os.environ['FREETYPE'] = ft_dir
os.system(cmdfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment