# Copyright 2018 The PDFium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("../pdfium.gni")
import("../testing/test.gni")

source_set("fpdfsdk") {
  sources = [
    "cpdfsdk_annot.cpp",
    "cpdfsdk_annot.h",
    "cpdfsdk_annotiteration.cpp",
    "cpdfsdk_annotiteration.h",
    "cpdfsdk_annotiterator.cpp",
    "cpdfsdk_annotiterator.h",
    "cpdfsdk_appstream.cpp",
    "cpdfsdk_appstream.h",
    "cpdfsdk_baannot.cpp",
    "cpdfsdk_baannot.h",
    "cpdfsdk_customaccess.cpp",
    "cpdfsdk_customaccess.h",
    "cpdfsdk_filewriteadapter.cpp",
    "cpdfsdk_filewriteadapter.h",
    "cpdfsdk_formfillenvironment.cpp",
    "cpdfsdk_formfillenvironment.h",
    "cpdfsdk_helpers.cpp",
    "cpdfsdk_helpers.h",
    "cpdfsdk_interactiveform.cpp",
    "cpdfsdk_interactiveform.h",
    "cpdfsdk_pageview.cpp",
    "cpdfsdk_pageview.h",
    "cpdfsdk_pauseadapter.cpp",
    "cpdfsdk_pauseadapter.h",
    "cpdfsdk_renderpage.cpp",
    "cpdfsdk_renderpage.h",
    "cpdfsdk_widget.cpp",
    "cpdfsdk_widget.h",
    "fpdf_annot.cpp",
    "fpdf_attachment.cpp",
    "fpdf_catalog.cpp",
    "fpdf_dataavail.cpp",
    "fpdf_doc.cpp",
    "fpdf_editimg.cpp",
    "fpdf_editpage.cpp",
    "fpdf_editpath.cpp",
    "fpdf_edittext.cpp",
    "fpdf_ext.cpp",
    "fpdf_flatten.cpp",
    "fpdf_formfill.cpp",
    "fpdf_javascript.cpp",
    "fpdf_ppo.cpp",
    "fpdf_progressive.cpp",
    "fpdf_save.cpp",
    "fpdf_searchex.cpp",
    "fpdf_signature.cpp",
    "fpdf_structtree.cpp",
    "fpdf_sysfontinfo.cpp",
    "fpdf_text.cpp",
    "fpdf_thumbnail.cpp",
    "fpdf_transformpage.cpp",
    "fpdf_view.cpp",
  ]

  configs += [
    "../:pdfium_strict_config",
    "../:pdfium_noshorten_config",
  ]
  deps = [
    "../:pdfium_public_headers",
    "../constants",
    "../core/fdrm",
    "../core/fpdfapi/edit",
    "../core/fpdfapi/edit:contentstream_write_utils",
    "../core/fpdfapi/font",
    "../core/fpdfapi/page",
    "../core/fpdfapi/parser",
    "../core/fpdfapi/render",
    "../core/fpdfdoc",
    "../core/fpdftext",
    "../core/fxcodec",
    "../core/fxcrt",
    "../core/fxge",
    "../fxjs",
    "formfiller",
    "pwl",
  ]
  allow_circular_includes_from = [
    "../fxjs",
    "formfiller",
  ]
  visibility = [ "../*" ]

  if (pdf_enable_xfa) {
    deps += [
      "../xfa/fgas/font",
      "../xfa/fxfa",
      "../xfa/fxfa/parser",
      "fpdfxfa",
    ]
    allow_circular_includes_from += [ "fpdfxfa" ]
  }
}

pdfium_unittest_source_set("unittests") {
  sources = [
    "cpdfsdk_helpers_unittest.cpp",
    "fpdf_catalog_unittest.cpp",
    "fpdf_doc_unittest.cpp",
    "fpdf_edit_unittest.cpp",
    "fpdf_view_unittest.cpp",
  ]
  deps = [
    ":fpdfsdk",
    "../:pdfium_public_headers",
    "../constants",
    "../core/fpdfapi/page:unit_test_support",
    "../core/fpdfapi/parser",
    "../core/fpdfapi/parser:unit_test_support",
    "../core/fpdfapi/render",
    "../core/fpdfdoc",
  ]
  pdfium_root_dir = "../"
}

pdfium_embeddertest_source_set("embeddertests") {
  sources = [
    "cpdfsdk_annotiterator_embeddertest.cpp",
    "cpdfsdk_baannot_embeddertest.cpp",
    "fpdf_annot_embeddertest.cpp",
    "fpdf_attachment_embeddertest.cpp",
    "fpdf_catalog_embeddertest.cpp",
    "fpdf_dataavail_embeddertest.cpp",
    "fpdf_doc_embeddertest.cpp",
    "fpdf_edit_embeddertest.cpp",
    "fpdf_editimg_embeddertest.cpp",
    "fpdf_editpage_embeddertest.cpp",
    "fpdf_editpath_embeddertest.cpp",
    "fpdf_ext_embeddertest.cpp",
    "fpdf_flatten_embeddertest.cpp",
    "fpdf_formfill_embeddertest.cpp",
    "fpdf_javascript_embeddertest.cpp",
    "fpdf_ppo_embeddertest.cpp",
    "fpdf_save_embeddertest.cpp",
    "fpdf_searchex_embeddertest.cpp",
    "fpdf_signature_embeddertest.cpp",
    "fpdf_structtree_embeddertest.cpp",
    "fpdf_sysfontinfo_embeddertest.cpp",
    "fpdf_text_embeddertest.cpp",
    "fpdf_thumbnail_embeddertest.cpp",
    "fpdf_transformpage_embeddertest.cpp",
    "fpdf_view_c_api_test.c",
    "fpdf_view_c_api_test.h",
    "fpdf_view_embeddertest.cpp",
  ]
  deps = [
    ":fpdfsdk",
    "../constants",
    "../core/fpdfapi/font",
    "../core/fpdfapi/page",
    "../core/fpdfapi/parser",
    "../core/fxcrt:test_support",
    "../core/fxge",
  ]
  pdfium_root_dir = "../"

  if (pdf_use_skia) {
    deps += [ "//skia" ]
  }
}
