Freetype clone env for no-SMID single file

Fix freetype build issue for javascript platform.
When disabling optimizations (SMID) in specific freetype, source files,
we need to make sure to copy all other CPPFLAGS, not just override them.
This commit is contained in:
Fabio Alessandrelli 2019-05-01 18:32:17 +02:00
parent 1d9a207dda
commit 4f9408a0f8
1 changed files with 10 additions and 7 deletions

View File

@ -61,13 +61,6 @@ if env['builtin_freetype']:
# Globally too, as freetype is used in scene (see bottom) # Globally too, as freetype is used in scene (see bottom)
env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"']) env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
sfnt = thirdparty_dir + 'src/sfnt/sfnt.c'
if env['platform'] == 'javascript':
# Forcibly undefine this macro so SIMD is not used in this file,
# since currently unsupported in WASM
sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
thirdparty_sources += [sfnt]
env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"]) env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
# Also needed in main env for scene/ # Also needed in main env for scene/
env.Prepend(CPPPATH=[thirdparty_dir + "/include"]) env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
@ -80,6 +73,16 @@ if env['builtin_freetype']:
if env['builtin_libpng']: if env['builtin_libpng']:
env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"]) env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"])
sfnt = thirdparty_dir + 'src/sfnt/sfnt.c'
# Must be done after all CPPFLAGS are being set so we can copy them.
if env['platform'] == 'javascript':
# Forcibly undefine this macro so SIMD is not used in this file,
# since currently unsupported in WASM
tmp_env = env_freetype.Clone()
tmp_env.Append(CPPFLAGS=['-U__OPTIMIZE__'])
sfnt = tmp_env.Object(sfnt)
thirdparty_sources += [sfnt]
env_thirdparty = env_freetype.Clone() env_thirdparty = env_freetype.Clone()
env_thirdparty.disable_warnings() env_thirdparty.disable_warnings()
lib = env_thirdparty.add_library("freetype_builtin", thirdparty_sources) lib = env_thirdparty.add_library("freetype_builtin", thirdparty_sources)