Skip to content

Commit 44f0c9a

Browse files
committed
enable PNG encoding on Windows for DLL builds
Windows builds a shared library (DLL) which requires all symbols to be resolved at link time. The serialization code references SkPngEncoder::Encode, so we must enable PNG encoding (and zlib dependency) for Windows DLL builds. libpng will be statically linked into skia.dll from Skia's third_party directory, keeping the DLL self-contained. Linux/Mac continue to use static libraries with PNG disabled.
1 parent c1d02ba commit 44f0c9a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

build_skia.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,31 @@
3434
"skia_use_icu=false",
3535
"skia_use_libjpeg_turbo_encode=false",
3636
"skia_use_libjpeg_turbo_decode=false",
37-
"skia_use_libpng_encode=false",
38-
"skia_use_libpng_decode=false",
3937
"skia_use_libwebp_encode=false",
4038
"skia_use_libwebp_decode=false",
4139
"skia_use_piex=false",
4240
"skia_use_xps=false",
43-
"skia_use_zlib=false",
4441
"skia_enable_spirv_validation=false",
4542
"skia_use_lua=false",
4643
"skia_use_wuffs=false",
4744
]
45+
46+
if sys.platform == "win32":
47+
# On Windows, we build a shared library (DLL) which requires all symbols to be
48+
# resolved at link time. PNG encoder is referenced by serialization code, so we
49+
# must enable PNG encoding (and zlib which PNG depends on) for Windows DLL builds.
50+
SKIA_BUILD_ARGS.extend([
51+
"skia_use_libpng_encode=true",
52+
"skia_use_libpng_decode=true",
53+
"skia_use_zlib=true",
54+
])
55+
else:
56+
SKIA_BUILD_ARGS.extend([
57+
"skia_use_libpng_encode=false",
58+
"skia_use_libpng_decode=false",
59+
"skia_use_zlib=false",
60+
])
61+
4862
if sys.platform != "win32":
4963
# On Linux, I need this flag otherwise I get undefined symbol upon importing;
5064
# on Windows, defining this flag creates other linker issues (SkFontMgr being

0 commit comments

Comments
 (0)