xref: /aosp_15_r20/external/pdfium/samples/BUILD.gn (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1# Copyright 2014 The PDFium Authors
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("../pdfium.gni")
7
8group("samples") {
9  testonly = true
10  deps = [ ":pdfium_test" ]
11}
12
13config("pdfium_samples_config") {
14  cflags = []
15  ldflags = []
16  defines = []
17  include_dirs = [ ".." ]
18  if (pdf_use_skia) {
19    defines += [ "PDF_ENABLE_SKIA" ]
20  }
21  if (is_asan) {
22    defines += [ "PDF_ENABLE_ASAN" ]
23  }
24  if (pdf_use_partition_alloc) {
25    defines += [ "PDF_USE_PARTITION_ALLOC" ]
26  }
27  if (enable_callgrind) {
28    defines += [ "ENABLE_CALLGRIND" ]
29  }
30  if (build_with_chromium) {
31    defines += [ "BUILD_WITH_CHROMIUM" ]
32  }
33}
34
35executable("pdfium_test") {
36  testonly = true
37  sources = [
38    "helpers/dump.cc",
39    "helpers/dump.h",
40    "helpers/event.cc",
41    "helpers/event.h",
42    "helpers/page_renderer.cc",
43    "helpers/page_renderer.h",
44    "helpers/write.cc",
45    "helpers/write.h",
46    "pdfium_test.cc",
47  ]
48
49  # Note: One should write programs that depend on ../:pdfium. Whereas this
50  # sample program does not set a good example, and depends on PDFium internals,
51  # as well as test support code, for convenience.
52  deps = [
53    "../:pdfium_public_headers",
54    "../fpdfsdk",
55    "../testing:test_support",
56    "../testing/image_diff",
57    "../third_party:pdfium_base",
58    "//build/win:default_exe_manifest",
59  ]
60  configs += [ ":pdfium_samples_config" ]
61
62  if (is_win) {
63    sources += [
64      "helpers/win32/com_factory.cc",
65      "helpers/win32/com_factory.h",
66    ]
67  }
68
69  if (pdf_enable_v8) {
70    deps += [
71      "//v8:v8_headers",
72      "//v8:v8_libplatform",
73    ]
74    include_dirs = [ "//v8" ]
75    configs += [ "//v8:external_startup_data" ]
76  }
77  if (pdf_use_skia) {
78    deps += [ "//skia" ]
79    if (build_with_chromium) {
80      sources += [
81        "chromium_support/discardable_memory_allocator.cc",
82        "chromium_support/discardable_memory_allocator.h",
83      ]
84      deps += [ "//base/test:test_support" ]
85    }
86  }
87}
88