Add build test for sfntly and remove unneccessary compiler flags on windows

This commit is contained in:
Kovid Goyal 2012-10-30 17:30:03 +05:30
parent 8a08e13f73
commit 8cf35971ae
3 changed files with 18 additions and 2 deletions

View File

@ -45,9 +45,9 @@ class SfntlyBuilderMixin(object):
if iswindows:
self.sfntly_cflags += [
'-D_UNICODE', '-DUNICODE',
] + shlex.split('/Zi /nologo /W4 /WX /O2 /Ob2 /Oy /GF /Gm- /MT /GS /Gy '
'/fp:precise /Zc:wchar_t /Zc:forScope /GR-')
] + shlex.split('/W4 /WX /Gm- /Gy /GR-')
else:
# Possibly add -fno-inline (slower, but more robust)
self.sfntly_cflags += [
'-Werror',
'-fno-exceptions',
@ -59,6 +59,11 @@ class SfntlyBuilderMixin(object):
def __call__(self, obj_dir, compiler, linker, builder, cflags, ldflags):
self.sfntly_build_dir = os.path.join(obj_dir, 'sfntly')
if '/Ox' in cflags:
cflags.remove('/Ox')
if '-O3' in cflags:
cflags.remove('-O3')
cflags.insert(0, '/O2' if iswindows else '-O2')
groups = []
all_headers = set()

View File

@ -37,6 +37,11 @@ def test_freetype():
test()
print ('FreeType OK!')
def test_sfntly():
from calibre.utils.fonts.subset import test
test()
print ('sfntly OK!')
def test_winutil():
from calibre.devices.scanner import win_pnp_drives
matches = win_pnp_drives.scanner()
@ -115,6 +120,7 @@ def test():
test_plugins()
test_lxml()
test_freetype()
test_sfntly()
test_sqlite()
test_qt()
test_imaging()

View File

@ -93,6 +93,11 @@ def test_mem():
for i in xrange(3): gc.collect()
print ('Leaked memory per call:', (memory() - start_mem)/calls*1024, 'KB')
def test():
raw = P('fonts/liberation/LiberationSerif-Regular.ttf', data=True)
sf, old_stats, new_stats = subset(raw, set(('a', 'b', 'c')), ())
if len(sf) > 0.3 * len(raw):
raise Exception('Subsetting failed')
def main(args):
import sys, time