blob: 23f4d0ca56aff1154cb0720ade310c7cd0dca747 [file] [log] [blame]
Tom Sepez65edf592014-11-13 17:04:15 -08001# 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
Oliver Chang17e920d2015-11-18 09:26:28 -08005import("//build/config/sanitizers/sanitizers.gni")
dsinclair038bf0b2016-04-30 06:00:05 -07006import("../pdfium.gni")
Tom Sepeza8a39e22015-10-12 15:47:07 -07007
Tom Sepez65edf592014-11-13 17:04:15 -08008group("samples") {
Tom Sepezd831dc72015-10-19 16:04:22 -07009 testonly = true
Tom Sepez65edf592014-11-13 17:04:15 -080010 deps = [
Lei Zhang461b6342015-11-06 10:32:28 -080011 ":pdfium_diff",
Cary Clark399be5b2016-03-14 16:51:29 -040012 ":pdfium_test",
Tom Sepez65edf592014-11-13 17:04:15 -080013 ]
14}
15
John Abd-El-Malekca6c0d32015-02-17 13:26:45 -080016config("pdfium_samples_config") {
dsinclair6e162b52017-01-24 11:18:16 -080017 cflags = []
18 ldflags = []
John Abd-El-Malekca6c0d32015-02-17 13:26:45 -080019 defines = [
20 "PNG_PREFIX",
John Abd-El-Malekca6c0d32015-02-17 13:26:45 -080021 "PNG_USE_READ_MACROS",
22 ]
Lei Zhang461b6342015-11-06 10:32:28 -080023 include_dirs = [ ".." ]
Tom Sepez452b4f32015-10-13 09:27:27 -070024 if (pdf_enable_v8) {
Tom Sepezd87b20e2016-03-02 16:55:26 -080025 defines += [ "PDF_ENABLE_V8" ]
Tom Sepez452b4f32015-10-13 09:27:27 -070026 }
Tom Sepeza8a39e22015-10-12 15:47:07 -070027 if (pdf_enable_xfa) {
Tom Sepezd87b20e2016-03-02 16:55:26 -080028 defines += [ "PDF_ENABLE_XFA" ]
Tom Sepeza8a39e22015-10-12 15:47:07 -070029 }
Cary Clark399be5b2016-03-14 16:51:29 -040030 if (pdf_use_skia) {
31 defines += [ "PDF_ENABLE_SKIA" ]
32 }
dan sinclair00d40642017-01-30 19:48:54 -080033 if (is_asan) {
34 defines += [ "PDF_ENABLE_ASAN" ]
35 }
dsinclair6e162b52017-01-24 11:18:16 -080036 if (use_coverage && is_clang) {
37 cflags += [
38 "--coverage",
39 "-g",
40 "-O0",
41 ]
42 ldflags += [ "--coverage" ]
43 }
John Abd-El-Malekca6c0d32015-02-17 13:26:45 -080044}
45
Tom Sepez65edf592014-11-13 17:04:15 -080046executable("pdfium_test") {
Tom Sepezd831dc72015-10-19 16:04:22 -070047 testonly = true
Tom Sepez65edf592014-11-13 17:04:15 -080048 sources = [
Tom Sepezd2e023b2015-12-08 14:36:16 -080049 "image_diff_png.cc",
50 "image_diff_png.h",
Tom Sepezd87b20e2016-03-02 16:55:26 -080051 "pdfium_test.cc",
Tom Sepez65edf592014-11-13 17:04:15 -080052 ]
53 deps = [
dsinclair685bb882016-04-20 07:32:39 -070054 "../:pdfium",
55 "../:test_support",
Oliver Chang17e920d2015-11-18 09:26:28 -080056 "//build/config/sanitizers:deps",
brucedawson15bfe1b2016-04-27 15:28:41 -070057 "//build/win:default_exe_manifest",
Lei Zhang461b6342015-11-06 10:32:28 -080058
59 # Regardless of whether the library ships against system freetype,
60 # always link this binary against the bundled one for consistency
61 # of results across platforms.
dsinclair685bb882016-04-20 07:32:39 -070062 "../third_party:fx_freetype",
John Abd-El-Malekb045ed22015-02-10 09:15:12 -080063 ]
Tom Sepezd2e023b2015-12-08 14:36:16 -080064 if (!pdf_enable_xfa) {
65 deps += [ "../third_party:fx_lpng" ]
66 }
Tom Sepez452b4f32015-10-13 09:27:27 -070067 if (pdf_enable_v8) {
Lei Zhang461b6342015-11-06 10:32:28 -080068 deps += [ "//v8:v8_libplatform" ]
Tom Sepez452b4f32015-10-13 09:27:27 -070069 include_dirs = [
70 "//v8",
71 "//v8/include",
72 ]
Jochen Eisinger7ed503d2015-12-10 14:38:06 +010073 configs += [ "//v8:external_startup_data" ]
Tom Sepez452b4f32015-10-13 09:27:27 -070074 }
caryclarkaf177fe2016-11-16 10:10:03 -080075 if (pdf_use_skia || pdf_use_skia_paths) {
Cary Clark399be5b2016-03-14 16:51:29 -040076 deps += [ "//skia" ]
77 }
John Abd-El-Malekca6c0d32015-02-17 13:26:45 -080078 configs += [ ":pdfium_samples_config" ]
Tom Sepez65edf592014-11-13 17:04:15 -080079}
Tom Sepezaf18cb32015-02-05 15:06:01 -080080
81executable("pdfium_diff") {
Tom Sepezd831dc72015-10-19 16:04:22 -070082 testonly = true
Tom Sepezaf18cb32015-02-05 15:06:01 -080083 sources = [
84 "image_diff.cc",
85 "image_diff_png.cc",
86 "image_diff_png.h",
87 ]
88 deps = [
dsinclair685bb882016-04-20 07:32:39 -070089 "../:pdfium",
Oliver Chang17e920d2015-11-18 09:26:28 -080090 "//build/config/sanitizers:deps",
brucedawson15bfe1b2016-04-27 15:28:41 -070091 "//build/win:default_exe_manifest",
Tom Sepezaf18cb32015-02-05 15:06:01 -080092 ]
Tom Sepezd2e023b2015-12-08 14:36:16 -080093 if (!pdf_enable_xfa) {
94 deps += [ "../third_party:fx_lpng" ]
95 }
Lei Zhang461b6342015-11-06 10:32:28 -080096 configs -= [ "//build/config/compiler:chromium_code" ]
97 configs += [
98 ":pdfium_samples_config",
99 "//build/config/compiler:no_chromium_code",
100 ]
John Abd-El-Malekb045ed22015-02-10 09:15:12 -0800101}