Add USE_SSE flag to allow build-time choise of SSE instructions for libimagequant

This commit is contained in:
Daniel Patterson 2015-05-20 21:08:11 -07:00
parent 2e765e8e96
commit 5970301a3c
2 changed files with 14 additions and 4 deletions

View file

@ -412,6 +412,7 @@ opts.AddVariables(
BoolVariable('NIK2IMG', 'Compile and install a utility to generate render a map to an image', 'True'),
BoolVariable('COLOR_PRINT', 'Print build status information in color', 'True'),
BoolVariable('BIGINT', 'Compile support for 64-bit integers in mapnik::value', 'True'),
EnumVariable('USE_SSE', 'Enable support for SSE vector instructions','yes',['yes','no','platform_default'])
)
# variables to pickle after successful configure step

View file

@ -346,11 +346,20 @@ source += Split(
""")
# libimagequant
lib_env.Append(CFLAGS = "-O3 -fno-math-errno -funroll-loops -fomit-frame-pointer -std=c99 -msse -mfpmath=sse")
# As of GCC 4.5, 387 fp math is significantly slower in C99 mode without this.
# Note: CPUs without SSE2 use 387 for doubles, even when SSE fp math is set.
if 'gcc' in env['CC']:
lib_env.Append(CFLAGS = "-O3 -fno-math-errno -funroll-loops -fomit-frame-pointer -std=c99")
if env["USE_SSE"] == "yes":
lib_env.Append(CFLAGS="-msse -mfpmath=sse")
# As of GCC 4.5, 387 fp math is significantly slower in C99 mode without this.
# Note: CPUs without SSE2 use 387 for doubles, even when SSE fp math is set.
if 'gcc' in env['CC']:
lib_env.Append(CFLAGS='-fexcess-prevision=fast')
elif env["USE_SSE"] == "no":
lib_env.Append(CFLAGS="-mno-sse")
elif env["USE_SSE"] == "platform_default":
# Let compiler decide
None
source += glob.glob("../deps/pngquant/" + "*.c")
if env['RUNTIME_LINK'] == "static":