Allow compiling PDFium without V8.
[pdfium.git] / samples / BUILD.gn
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
5 import("../pdfium.gni")
6
7 group("samples") {
8   deps = [
9     ":pdfium_test",
10     ":pdfium_diff",
11   ]
12 }
13
14 config("pdfium_samples_config") {
15   defines = [
16     "PNG_PREFIX",
17     "PNGPREFIX_H",
18     "PNG_USE_READ_MACROS",
19   ]
20   if (pdf_enable_v8) {
21     defines += [
22       "PDF_ENABLE_V8",
23     ]
24   }
25 }
26
27 executable("pdfium_test") {
28   sources = [
29     "image_diff_png.cc",
30     "pdfium_test.cc",
31   ]
32   deps = [
33     "//third_party/pdfium",
34     # Regardless of whether the library ships against system freetype,
35     # always link this binary against the bundled one for consistency
36     # of results across platforms.
37     "//third_party/pdfium/third_party:fx_freetype",
38     ":fx_lpng",
39   ]
40   if (pdf_enable_v8) {
41     deps += [
42       "//v8:v8_libplatform",
43     ]
44     include_dirs = [
45       "//v8",
46       "//v8/include",
47     ]
48   }
49   configs += [ ":pdfium_samples_config" ]
50 }
51
52 executable("pdfium_diff") {
53   sources = [
54     "image_diff.cc",
55     "image_diff_png.cc",
56     "image_diff_png.h",
57   ]
58   deps = [
59     "//third_party/pdfium",
60     ":fx_lpng",
61   ]
62   configs -= [ "//build/config/compiler:chromium_code" ]
63   configs += [
64     ":pdfium_samples_config",
65     "//build/config/compiler:no_chromium_code",
66   ]
67 }
68
69 static_library("fx_lpng") {
70   sources = [
71     "fx_lpng/include/fx_png.h",
72     "fx_lpng/src/fx_png.c",
73     "fx_lpng/src/fx_pngerror.c",
74     "fx_lpng/src/fx_pngget.c",
75     "fx_lpng/src/fx_pngmem.c",
76     "fx_lpng/src/fx_pngpread.c",
77     "fx_lpng/src/fx_pngread.c",
78     "fx_lpng/src/fx_pngrio.c",
79     "fx_lpng/src/fx_pngrtran.c",
80     "fx_lpng/src/fx_pngrutil.c",
81     "fx_lpng/src/fx_pngset.c",
82     "fx_lpng/src/fx_pngtrans.c",
83     "fx_lpng/src/fx_pngwio.c",
84     "fx_lpng/src/fx_pngwrite.c",
85     "fx_lpng/src/fx_pngwtran.c",
86     "fx_lpng/src/fx_pngwutil.c",
87   ]
88   include_dirs = [
89     "../core/src/fxcodec/fx_zlib/include/",
90   ]
91   configs += [ ":pdfium_samples_config" ]
92 }