Use bundled freetype for the pdfium_test binary.
authorTom Sepez <tsepez@chromium.org>
Thu, 30 Jul 2015 17:29:19 +0000 (10:29 -0700)
committerTom Sepez <tsepez@chromium.org>
Thu, 30 Jul 2015 17:29:19 +0000 (10:29 -0700)
But use platform freetype for library itself according to the rules
for the platform.

This should greatly reduce per-platform diffs in the corpus tests, but
requires that the corpus be rolled at the same time.

When this rolls into chromium, its src/BUILD.gn will need to be updated
to say third_party:fx_freetype instead of third_party:freetype.

R=jam@chromium.org

Review URL: https://codereview.chromium.org/1267493005 .

BUILD.gn
DEPS
pdfium.gyp
samples/BUILD.gn
samples/samples.gyp
third_party/BUILD.gn
third_party/third_party.gyp

index 465c280..6581943 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -131,7 +131,7 @@ static_library("pdfium") {
   }
 
   if (pdfium_bundle_freetype) {
-    deps += [ "third_party:freetype" ]
+    deps += [ "third_party:fx_freetype" ]
   } else {
     libs += [ "freetype" ]
   }
diff --git a/DEPS b/DEPS
index 8f96330..a7a887b 100644 (file)
--- a/DEPS
+++ b/DEPS
@@ -8,7 +8,7 @@ deps = {
     "https://chromium.googlesource.com/chromium/buildtools.git@46ce8cb60364e9e0b21a81136c7debdddfd063a8",
 
   "testing/corpus":
-     "https://pdfium.googlesource.com/pdfium_tests@4b9a1d593e5a101d034a4f1195174a22c179a42d",
+     "https://pdfium.googlesource.com/pdfium_tests@ab8b8db8660253962d8d624a85bf2c53fcf01097",
 
   "testing/gmock":
      "https://chromium.googlesource.com/external/googlemock.git@29763965ab52f24565299976b936d1265cb6a271",
index a3697a3..16d55d3 100644 (file)
         }],
         ['bundle_freetype==1', {
           'dependencies': [
-            'third_party/third_party.gyp:freetype',
+            'third_party/third_party.gyp:fx_freetype',
           ],
         }, {
           'link_settings': {
index 748a2af..6f4518c 100644 (file)
@@ -24,6 +24,10 @@ executable("pdfium_test") {
   ]
   deps = [
     "//third_party/pdfium",
+    # Regardless of whether the library ships against system freetype,
+    # always link this binary against the bundled one for consistency
+    # of results across platforms.
+    "//third_party/pdfium/third_party:fx_freetype",
     "//v8:v8_libplatform",
     ":fx_lpng",
   ]
index 4938ecb..4b6c16b 100644 (file)
       'dependencies': [
         'fx_lpng',
         '../pdfium.gyp:pdfium',
+        # Regardless of whether the library ships against system freetype,
+        # always link this binary against the bundled one for consistency
+        # of results across platforms.
+        '../third_party/third_party.gyp:fx_freetype',
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
       ],
       'sources': [
         'pdfium_test.cc',
         'image_diff_png.cc',
       ],
+      'link_settings': {
+        'libraries!': [
+          '-lfreetype',
+        ],
+      },
     },
     {
       'target_name': 'pdfium_diff',
index 37e30ce..b1c8e26 100644 (file)
@@ -5,7 +5,7 @@
 group("third_party") {
   deps = [
     ":bigint",
-    ":freetype",
+    ":fx_freetype",
     ":pdfium_base",
   ]
 }
@@ -30,7 +30,9 @@ source_set("bigint") {
   ]
 }
 
-source_set("freetype") {
+# Tests may link against this even if the production library doesn't,
+# so it needs to be separate from it.
+static_library("fx_freetype") {
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
index 79368b5..4403f3c 100644 (file)
@@ -30,7 +30,7 @@
       ],
     },
     {
-      'target_name': 'freetype',
+      'target_name': 'fx_freetype',
       'type': 'static_library',
       'defines': [
         'FT2_BUILD_LIBRARY',