1# Copyright 2014 PDFium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/sanitizers/sanitizers.gni")
6import("//build_overrides/v8.gni")
7import("../pdfium.gni")
8
9group("samples") {
10  testonly = true
11  deps = [
12    ":pdfium_test",
13    ":pdfium_diff",
14  ]
15}
16
17config("pdfium_samples_config") {
18  defines = [
19    "PNG_PREFIX",
20    "PNGPREFIX_H",
21    "PNG_USE_READ_MACROS",
22  ]
23  include_dirs = [ ".." ]
24  if (pdf_enable_v8) {
25    defines += [ "PDF_ENABLE_V8", ]
26  }
27  if (pdf_enable_xfa) {
28    defines += [ "PDF_ENABLE_XFA", ]
29  }
30}
31
32executable("pdfium_test") {
33  testonly = true
34  sources = [
35    "pdfium_test.cc",
36    "image_diff_png.cc",
37    "image_diff_png.h",
38  ]
39  deps = [
40    "//build/config/sanitizers:deps",
41    "//third_party/pdfium:pdfium",
42    "//third_party/pdfium:test_support",
43
44    # Regardless of whether the library ships against system freetype,
45    # always link this binary against the bundled one for consistency
46    # of results across platforms.
47    "//third_party/pdfium/third_party:fx_freetype",
48  ]
49  if (!pdf_enable_xfa) {
50    deps += [ "../third_party:fx_lpng" ]
51  }
52  if (pdf_enable_v8) {
53    deps += [ "//v8:v8_libplatform" ]
54    include_dirs = [
55      "//v8",
56      "//v8/include",
57    ]
58    configs += [ "//v8:external_startup_data" ]
59  }
60  configs += [ ":pdfium_samples_config" ]
61}
62
63executable("pdfium_diff") {
64  testonly = true
65  sources = [
66    "image_diff.cc",
67    "image_diff_png.cc",
68    "image_diff_png.h",
69  ]
70  deps = [
71    "//build/config/sanitizers:deps",
72    "//third_party/pdfium",
73  ]
74  if (!pdf_enable_xfa) {
75    deps += [ "../third_party:fx_lpng" ]
76  }
77  configs -= [ "//build/config/compiler:chromium_code" ]
78  configs += [
79    ":pdfium_samples_config",
80    "//build/config/compiler:no_chromium_code",
81  ]
82}
83