Fix component build when Skia is enabled SkFontMgr_custom_empty_factory.cpp should not be the default factory as that precludes use of platform-specific versions. For macOS this highlighted a link time issue with component builds, as it competed with SkFontMgr_mac_ct_factory.cpp. Begin cleanup by removing SkFontMgr_custom_empty_factory.cpp as a common source dependency. At a minimum it is not needed for Android. For macOS this results in the need to explicitly note the Apple freameworks needed by Skia. Also remove the duplicate source definition for Android factory which has been included for all platforms. This cleanup also shows that Windows and Linux/ChromeOS builds are dependent upon the custom empty font manager files. Once the builds are adjusted it reveals that the embedder test hashes were generated based upon usage of SkFontMgr_custom_empty_factory. In the case of macOS this means that SkFontMgr_mac_ct_factory is not actually being used. Similar test hash behavior is also noticed for Windows, that SkFontMgr_win_dw_factory is not being used to get the embedder test hashes. Do not change the tests to use the platform-specific variations at this time, and instead just do the minimum to enable Pdfium to do a component build with Skia. Bug: pdfium:1830 Change-Id: I63610255bda020d8e25e8f17fd7198deedb5704d Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93378 Commit-Queue: Alan Screen <awscreen@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/skia/BUILD.gn b/skia/BUILD.gn index 173f8c7..e3fb3cd 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn
@@ -191,7 +191,6 @@ "//third_party/skia/src/fonts/SkFontMgr_indirect.cpp", "//third_party/skia/src/fonts/SkRemotableFontMgr.cpp", "//third_party/skia/src/images/SkImageEncoder.cpp", - "//third_party/skia/src/ports/SkFontMgr_android_factory.cpp", "//third_party/skia/src/ports/SkGlobalInitialization_default.cpp", "//third_party/skia/src/ports/SkImageGenerator_none.cpp", "//third_party/skia/src/ports/SkOSFile_stdio.cpp", @@ -200,9 +199,6 @@ #pdfium "//third_party/skia/src/ports/SkDiscardableMemory_none.cpp", - "//third_party/skia/src/ports/SkFontMgr_custom.cpp", - "//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp", - "//third_party/skia/src/ports/SkFontMgr_custom_empty_factory.cpp", "//third_party/skia/src/ports/SkMemory_malloc.cpp", ] @@ -266,6 +262,13 @@ if (is_win) { sources += [ "//third_party/skia/src/ports/SkFontHost_win.cpp", + + # TODO(crbug.com/pdfium/1830) Consider using SkFontMgr_win_dw_factory + # instead of SkFontMgr_custom_empty (which is what the embedder test + # hashes are based upon). + "//third_party/skia/src/ports/SkFontMgr_custom.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom_empty_factory.cpp", "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp", "//third_party/skia/src/ports/SkOSFile_win.cpp", "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp", @@ -280,16 +283,25 @@ ] } + frameworks = [] if (is_apple) { sources += [ - "//third_party/skia/include/ports/SkFontMgr_mac_ct.h", - "//third_party/skia/src/ports/SkFontMgr_mac_ct.cpp", - "//third_party/skia/src/ports/SkFontMgr_mac_ct_factory.cpp", + # TODO(crbug.com/pdfium/1830) Consider using SkFontMgr_mac_ct instead of + # SkFontMgr_custom_empty (which is what the embedder test hashes are + # based upon). + "//third_party/skia/src/ports/SkFontMgr_custom.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom_empty_factory.cpp", "//third_party/skia/src/ports/SkScalerContext_mac_ct.cpp", "//third_party/skia/src/ports/SkScalerContext_mac_ct.h", "//third_party/skia/src/ports/SkTypeface_mac_ct.cpp", "//third_party/skia/src/ports/SkTypeface_mac_ct.h", ] + frameworks += [ + "CoreFoundation.framework", + "CoreGraphics.framework", + "CoreText.framework", + ] } if (is_linux || is_chromeos) { @@ -298,6 +310,9 @@ "//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp", "//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp", "//third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp", + "//third_party/skia/src/ports/SkFontMgr_custom_empty_factory.cpp", ] } @@ -307,6 +322,7 @@ # require these files, since PDFium does not perform Android emulation. # Note that this requires expat. "//third_party/skia/src/ports/SkFontMgr_android.cpp", + "//third_party/skia/src/ports/SkFontMgr_android_factory.cpp", "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp", ] } @@ -355,7 +371,7 @@ } if (is_ios) { - frameworks = [ "ImageIO.framework" ] + frameworks += [ "ImageIO.framework" ] sources += [ "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp" ] }