Home | History | Annotate | Download | only in samples
      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("//build/config/sanitizers/sanitizers.gni")
      6 import("../pdfium.gni")
      7 
      8 group("samples") {
      9   testonly = true
     10   deps = [
     11     ":pdfium_diff",
     12     ":pdfium_test",
     13   ]
     14 }
     15 
     16 config("pdfium_samples_config") {
     17   cflags = []
     18   ldflags = []
     19   defines = [
     20     "PNG_PREFIX",
     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   if (pdf_use_skia) {
     31     defines += [ "PDF_ENABLE_SKIA" ]
     32   }
     33   if (is_asan) {
     34     defines += [ "PDF_ENABLE_ASAN" ]
     35   }
     36   if (use_coverage && is_clang) {
     37     cflags += [
     38       "--coverage",
     39       "-g",
     40       "-O0",
     41     ]
     42     ldflags += [ "--coverage" ]
     43   }
     44 }
     45 
     46 executable("pdfium_test") {
     47   testonly = true
     48   sources = [
     49     "image_diff_png.cc",
     50     "image_diff_png.h",
     51     "pdfium_test.cc",
     52   ]
     53   deps = [
     54     "../:pdfium",
     55     "../:test_support",
     56     "//build/config/sanitizers:deps",
     57     "//build/win:default_exe_manifest",
     58 
     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.
     62     "../third_party:fx_freetype",
     63   ]
     64   if (!pdf_enable_xfa) {
     65     deps += [ "../third_party:fx_lpng" ]
     66   }
     67   if (pdf_enable_v8) {
     68     deps += [ "//v8:v8_libplatform" ]
     69     include_dirs = [
     70       "//v8",
     71       "//v8/include",
     72     ]
     73     configs += [ "//v8:external_startup_data" ]
     74   }
     75   if (pdf_use_skia || pdf_use_skia_paths) {
     76     deps += [ "//skia" ]
     77   }
     78   configs += [ ":pdfium_samples_config" ]
     79 }
     80 
     81 executable("pdfium_diff") {
     82   testonly = true
     83   sources = [
     84     "image_diff.cc",
     85     "image_diff_png.cc",
     86     "image_diff_png.h",
     87   ]
     88   deps = [
     89     "../:pdfium",
     90     "//build/config/sanitizers:deps",
     91     "//build/win:default_exe_manifest",
     92   ]
     93   if (!pdf_enable_xfa) {
     94     deps += [ "../third_party:fx_lpng" ]
     95   }
     96   configs -= [ "//build/config/compiler:chromium_code" ]
     97   configs += [
     98     ":pdfium_samples_config",
     99     "//build/config/compiler:no_chromium_code",
    100   ]
    101 }
    102