| # Copyright 2016 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/jumbo.gni") |
| import("//testing/test.gni") |
| import("pdfium.gni") |
| |
| group("freetype_common") { |
| public_deps = [] |
| if (pdf_bundle_freetype) { |
| public_deps += [ "third_party:fx_freetype" ] |
| } else { |
| public_deps += [ "//build/config/freetype" ] |
| } |
| } |
| |
| config("pdfium_common_config") { |
| cflags = [] |
| ldflags = [] |
| include_dirs = [ "." ] |
| defines = [ |
| "OPJ_STATIC", |
| "PNG_PREFIX", |
| "PNG_USE_READ_MACROS", |
| ] |
| |
| if (pdf_enable_v8) { |
| defines += [ "PDF_ENABLE_V8" ] |
| } |
| |
| if (pdf_enable_click_logging) { |
| defines += [ "PDF_ENABLE_CLICK_LOGGING" ] |
| } |
| |
| if (pdf_enable_xfa) { |
| defines += [ "PDF_ENABLE_XFA" ] |
| if (pdf_enable_xfa_bmp) { |
| defines += [ "PDF_ENABLE_XFA_BMP" ] |
| } |
| if (pdf_enable_xfa_gif) { |
| defines += [ "PDF_ENABLE_XFA_GIF" ] |
| } |
| if (pdf_enable_xfa_png) { |
| defines += [ "PDF_ENABLE_XFA_PNG" ] |
| } |
| if (pdf_enable_xfa_tiff) { |
| defines += [ "PDF_ENABLE_XFA_TIFF" ] |
| } |
| } |
| |
| if (pdf_use_skia) { |
| defines += [ "_SKIA_SUPPORT_" ] |
| } |
| |
| if (pdf_use_skia_paths) { |
| defines += [ "_SKIA_SUPPORT_PATHS_" ] |
| } |
| |
| if (pdf_use_win32_gdi) { |
| defines += [ "PDFIUM_PRINT_TEXT_WITH_GDI" ] |
| } |
| |
| if (is_win) { |
| # Assume UTF-8 by default to avoid code page dependencies. |
| cflags += [ "/utf-8" ] |
| } |
| } |
| |
| config("pdfium_core_config") { |
| cflags = [] |
| configs = [ ":pdfium_common_config" ] |
| defines = [ "V8_DEPRECATION_WARNINGS" ] |
| if (is_clang) { |
| cflags += [ "-Wshadow" ] |
| } |
| if (is_linux) { |
| if (current_cpu == "x64") { |
| defines += [ "_FX_CPU_=_FX_X64_" ] |
| cflags += [ "-fPIC" ] |
| } else if (current_cpu == "x86") { |
| defines += [ "_FX_CPU_=_FX_X86_" ] |
| } |
| } |
| if (is_win) { |
| cflags += [ |
| "/wd4324", |
| "/wd4577", |
| ] |
| } |
| configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| } |
| |
| jumbo_static_library("pdfium") { |
| sources = [ |
| "fpdfsdk/fpdf_annot.cpp", |
| "fpdfsdk/fpdf_attachment.cpp", |
| "fpdfsdk/fpdf_catalog.cpp", |
| "fpdfsdk/fpdf_dataavail.cpp", |
| "fpdfsdk/fpdf_doc.cpp", |
| "fpdfsdk/fpdf_editimg.cpp", |
| "fpdfsdk/fpdf_editpage.cpp", |
| "fpdfsdk/fpdf_editpath.cpp", |
| "fpdfsdk/fpdf_edittext.cpp", |
| "fpdfsdk/fpdf_ext.cpp", |
| "fpdfsdk/fpdf_flatten.cpp", |
| "fpdfsdk/fpdf_formfill.cpp", |
| "fpdfsdk/fpdf_ppo.cpp", |
| "fpdfsdk/fpdf_progressive.cpp", |
| "fpdfsdk/fpdf_save.cpp", |
| "fpdfsdk/fpdf_searchex.cpp", |
| "fpdfsdk/fpdf_structtree.cpp", |
| "fpdfsdk/fpdf_sysfontinfo.cpp", |
| "fpdfsdk/fpdf_text.cpp", |
| "fpdfsdk/fpdf_transformpage.cpp", |
| "fpdfsdk/fpdf_view.cpp", |
| "public/cpp/fpdf_deleters.h", |
| "public/cpp/fpdf_scopers.h", |
| "public/fpdf_annot.h", |
| "public/fpdf_attachment.h", |
| "public/fpdf_catalog.h", |
| "public/fpdf_dataavail.h", |
| "public/fpdf_doc.h", |
| "public/fpdf_edit.h", |
| "public/fpdf_ext.h", |
| "public/fpdf_flatten.h", |
| "public/fpdf_formfill.h", |
| "public/fpdf_fwlevent.h", |
| "public/fpdf_ppo.h", |
| "public/fpdf_progressive.h", |
| "public/fpdf_save.h", |
| "public/fpdf_searchex.h", |
| "public/fpdf_structtree.h", |
| "public/fpdf_sysfontinfo.h", |
| "public/fpdf_text.h", |
| "public/fpdf_transformpage.h", |
| "public/fpdfview.h", |
| ] |
| |
| libs = [] |
| configs += [ ":pdfium_core_config" ] |
| |
| deps = [ |
| "constants", |
| "core/fdrm", |
| "core/fpdfapi", |
| "core/fpdfdoc", |
| "core/fpdftext", |
| "core/fxcodec", |
| "core/fxcrt", |
| "core/fxge", |
| "fpdfsdk", |
| "fpdfsdk/formfiller", |
| "fpdfsdk/pwl", |
| "fxjs", |
| "third_party:pdfium_base", |
| "third_party:skia_shared", |
| ] |
| allow_circular_includes_from = [ |
| "fpdfsdk", |
| "fpdfsdk/formfiller", |
| "fpdfsdk/pwl", |
| ] |
| |
| public_deps = [ |
| "core/fxcrt", |
| ] |
| |
| if (pdf_enable_xfa) { |
| deps += [ |
| "fpdfsdk/fpdfxfa", |
| "xfa/fxfa", |
| "xfa/fxfa/parser", |
| ] |
| allow_circular_includes_from += [ "fpdfsdk/fpdfxfa" ] |
| } |
| |
| if (is_win) { |
| libs += [ |
| "advapi32.lib", |
| "gdi32.lib", |
| "user32.lib", |
| ] |
| } |
| |
| if (is_mac) { |
| libs += [ |
| "AppKit.framework", |
| "CoreFoundation.framework", |
| ] |
| } |
| |
| if (pdf_is_complete_lib) { |
| complete_static_lib = true |
| configs -= [ "//build/config/compiler:thin_archive" ] |
| } |
| } |
| |
| # Targets below this are only visible within this file (and to the |
| # top-level gn_visibility target used to help gn_all build everything). |
| visibility = [ |
| ":*", |
| "//:gn_visibility", |
| ] |
| |
| test("pdfium_unittests") { |
| testonly = true |
| sources = [ |
| "core/fdrm/fx_crypt_unittest.cpp", |
| "core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp", |
| "core/fpdfapi/font/cpdf_cmapparser_unittest.cpp", |
| "core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp", |
| "core/fpdfapi/page/cpdf_devicecs_unittest.cpp", |
| "core/fpdfapi/page/cpdf_pageobjectholder_unittest.cpp", |
| "core/fpdfapi/page/cpdf_psengine_unittest.cpp", |
| "core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp", |
| "core/fpdfapi/page/cpdf_streamparser_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_array_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_cross_ref_avail_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_document_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_indirect_object_holder_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_object_avail_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_object_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_object_walker_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_parser_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_read_validator_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp", |
| "core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp", |
| "core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp", |
| "core/fpdfapi/parser/fpdf_parser_utility_unittest.cpp", |
| "core/fpdfdoc/cpdf_defaultappearance_unittest.cpp", |
| "core/fpdfdoc/cpdf_dest_unittest.cpp", |
| "core/fpdfdoc/cpdf_filespec_unittest.cpp", |
| "core/fpdfdoc/cpdf_formfield_unittest.cpp", |
| "core/fpdfdoc/cpdf_metadata_unittest.cpp", |
| "core/fpdfdoc/cpdf_nametree_unittest.cpp", |
| "core/fpdftext/cpdf_linkextract_unittest.cpp", |
| "core/fxcodec/codec/fx_codec_a85_unittest.cpp", |
| "core/fxcodec/codec/fx_codec_jpx_unittest.cpp", |
| "core/fxcodec/codec/fx_codec_rle_unittest.cpp", |
| "core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp", |
| "core/fxcodec/jbig2/JBig2_Image_unittest.cpp", |
| "core/fxcrt/autorestorer_unittest.cpp", |
| "core/fxcrt/bytestring_unittest.cpp", |
| "core/fxcrt/cfx_bitstream_unittest.cpp", |
| "core/fxcrt/fx_bidi_unittest.cpp", |
| "core/fxcrt/fx_coordinates_unittest.cpp", |
| "core/fxcrt/fx_extension_unittest.cpp", |
| "core/fxcrt/fx_memory_unittest.cpp", |
| "core/fxcrt/fx_number_unittest.cpp", |
| "core/fxcrt/fx_random_unittest.cpp", |
| "core/fxcrt/fx_string_unittest.cpp", |
| "core/fxcrt/fx_system_unittest.cpp", |
| "core/fxcrt/maybe_owned_unittest.cpp", |
| "core/fxcrt/observable_unittest.cpp", |
| "core/fxcrt/pdfium_span_unittest.cpp", |
| "core/fxcrt/retain_ptr_unittest.cpp", |
| "core/fxcrt/shared_copy_on_write_unittest.cpp", |
| "core/fxcrt/string_pool_template_unittest.cpp", |
| "core/fxcrt/unowned_ptr_unittest.cpp", |
| "core/fxcrt/weak_ptr_unittest.cpp", |
| "core/fxcrt/widestring_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmlchardata_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmldocument_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmlelement_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmlnode_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmlparser_unittest.cpp", |
| "core/fxcrt/xml/cfx_xmltext_unittest.cpp", |
| "core/fxge/dib/cfx_dibitmap_unittest.cpp", |
| "core/fxge/dib/cstretchengine_unittest.cpp", |
| "fpdfsdk/fpdf_catalog_unittest.cpp", |
| "fpdfsdk/fpdf_doc_unittest.cpp", |
| "fpdfsdk/fpdf_editimg_unittest.cpp", |
| "testing/pseudo_retainable.h", |
| "testing/unit_test_main.cpp", |
| ] |
| deps = [ |
| ":pdfium", |
| "testing/:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| include_dirs = [] |
| if (pdf_enable_xfa) { |
| sources += [ |
| "core/fxcrt/cfx_seekablemultistream_unittest.cpp", |
| "core/fxcrt/css/cfx_cssdeclaration_unittest.cpp", |
| "core/fxcrt/css/cfx_cssstylesheet_unittest.cpp", |
| "core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp", |
| "fxbarcode/oned/BC_OnedCodaBarWriter_unittest.cpp", |
| "fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp", |
| "fxbarcode/oned/BC_OnedCode39Writer_unittest.cpp", |
| "fxbarcode/oned/BC_OnedEAN13Writer_unittest.cpp", |
| "fxbarcode/oned/BC_OnedEAN8Writer_unittest.cpp", |
| "fxbarcode/oned/BC_OnedUPCAWriter_unittest.cpp", |
| "fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp", |
| "xfa/fde/cfde_texteditengine_unittest.cpp", |
| "xfa/fgas/crt/cfgas_formatstring_unittest.cpp", |
| "xfa/fgas/layout/cfx_rtfbreak_unittest.cpp", |
| "xfa/fgas/layout/cfx_txtbreak_unittest.cpp", |
| "xfa/fwl/cfx_barcode_unittest.cpp", |
| "xfa/fxfa/cxfa_ffbarcode_unittest.cpp", |
| "xfa/fxfa/cxfa_textparser_unittest.cpp", |
| "xfa/fxfa/fm2js/cxfa_fmexpression_unittest.cpp", |
| "xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp", |
| "xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp", |
| "xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp", |
| "xfa/fxfa/parser/cxfa_document_parser_unittest.cpp", |
| "xfa/fxfa/parser/cxfa_localevalue_unittest.cpp", |
| "xfa/fxfa/parser/cxfa_node_unittest.cpp", |
| "xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp", |
| "xfa/fxfa/parser/cxfa_xmllocale_unittest.cpp", |
| "xfa/fxfa/parser/xfa_utils_unittest.cpp", |
| ] |
| if (pdf_enable_xfa_gif) { |
| sources += [ |
| "core/fxcodec/gif/cfx_gifcontext_unittest.cpp", |
| "core/fxcodec/gif/cfx_lzwdecompressor_unittest.cpp", |
| ] |
| } |
| } |
| if (pdf_use_skia || pdf_use_skia_paths) { |
| sources += [ "core/fxge/skia/fx_skia_device_unittest.cpp" ] |
| deps += [ "//skia" ] |
| } |
| if (pdf_enable_v8) { |
| sources += [ |
| "fxjs/cfx_v8_unittest.cpp", |
| "fxjs/cfx_v8_unittest.h", |
| "fxjs/cfxjs_engine_unittest.cpp", |
| "fxjs/cjs_publicmethods_unittest.cpp", |
| "fxjs/cjs_util_unittest.cpp", |
| ] |
| deps += [ "fxjs" ] |
| configs += [ "//v8:external_startup_data" ] |
| } |
| configs += [ ":pdfium_core_config" ] |
| if (is_android) { |
| use_raw_android_executable = true |
| } |
| if (is_clang) { |
| # Suppress no override warning for overridden functions. |
| cflags = [ "-Wno-inconsistent-missing-override" ] |
| } |
| } |
| |
| test("pdfium_embeddertests") { |
| testonly = true |
| sources = [ |
| "core/fpdfapi/edit/cpdf_creator_embeddertest.cpp", |
| "core/fpdfapi/page/cpdf_docpagedata_embeddertest.cpp", |
| "core/fpdfapi/page/cpdf_function_embeddertest.cpp", |
| "core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp", |
| "core/fpdfapi/parser/cpdf_parser_embeddertest.cpp", |
| "core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp", |
| "core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp", |
| "core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp", |
| "core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp", |
| "core/fxcodec/codec/fx_codec_embeddertest.cpp", |
| "core/fxge/fx_ge_text_embeddertest.cpp", |
| "fpdfsdk/cpdfsdk_annotiterator_embeddertest.cpp", |
| "fpdfsdk/fpdf_annot_embeddertest.cpp", |
| "fpdfsdk/fpdf_attachment_embeddertest.cpp", |
| "fpdfsdk/fpdf_dataavail_embeddertest.cpp", |
| "fpdfsdk/fpdf_doc_embeddertest.cpp", |
| "fpdfsdk/fpdf_edit_embeddertest.cpp", |
| "fpdfsdk/fpdf_editpath_embeddertest.cpp", |
| "fpdfsdk/fpdf_ext_embeddertest.cpp", |
| "fpdfsdk/fpdf_flatten_embeddertest.cpp", |
| "fpdfsdk/fpdf_formfill_embeddertest.cpp", |
| "fpdfsdk/fpdf_ppo_embeddertest.cpp", |
| "fpdfsdk/fpdf_save_embeddertest.cpp", |
| "fpdfsdk/fpdf_structtree_embeddertest.cpp", |
| "fpdfsdk/fpdf_text_embeddertest.cpp", |
| "fpdfsdk/fpdf_transformpage_embeddertest.cpp", |
| "fpdfsdk/fpdf_view_c_api_test.c", |
| "fpdfsdk/fpdf_view_c_api_test.h", |
| "fpdfsdk/fpdf_view_embeddertest.cpp", |
| "fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp", |
| "fpdfsdk/pwl/cpwl_edit_embeddertest.cpp", |
| "testing/embedder_test.cpp", |
| "testing/embedder_test.h", |
| "testing/embedder_test_main.cpp", |
| "testing/embedder_test_mock_delegate.h", |
| "testing/embedder_test_timer_handling_delegate.h", |
| "testing/fake_file_access.cpp", |
| "testing/fake_file_access.h", |
| "testing/range_set.cpp", |
| "testing/range_set.h", |
| ] |
| deps = [ |
| ":pdfium", |
| "testing/:test_support", |
| "testing/image_diff", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| include_dirs = [ "testing/gmock/include" ] |
| configs += [ ":pdfium_core_config" ] |
| |
| if (pdf_enable_v8) { |
| sources += [ |
| "fxjs/cfxjs_engine_embeddertest.cpp", |
| "fxjs/cjs_publicmethods_embeddertest.cpp", |
| "testing/js_embedder_test.cpp", |
| "testing/js_embedder_test.h", |
| ] |
| deps += [ "fxjs" ] |
| configs += [ "//v8:external_startup_data" ] |
| } |
| if (pdf_enable_xfa) { |
| sources += [ |
| "fxjs/cfxjse_formcalc_context_embeddertest.cpp", |
| "testing/xfa_js_embedder_test.cpp", |
| "testing/xfa_js_embedder_test.h", |
| "xfa/fwl/cfwl_edit_embeddertest.cpp", |
| "xfa/fxfa/parser/cxfa_document_parser_embeddertest.cpp", |
| ] |
| } |
| if (is_android) { |
| ignore_all_data_deps = true |
| use_raw_android_executable = true |
| } |
| } |
| |
| if (pdf_is_standalone) { |
| jumbo_source_set("samples") { |
| testonly = true |
| deps = [ |
| "//samples", |
| ] |
| } |
| |
| executable("pdfium_diff") { |
| testonly = true |
| sources = [ |
| "testing/image_diff/image_diff.cpp", |
| ] |
| deps = [ |
| ":pdfium", |
| "testing/image_diff", |
| "//build/win:default_exe_manifest", |
| ] |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| configs += [ ":pdfium_core_config" ] |
| } |
| |
| group("fuzzers") { |
| testonly = true |
| deps = [ |
| "//testing/fuzzers", |
| ] |
| } |
| } |
| |
| group("pdfium_all") { |
| testonly = true |
| deps = [ |
| ":pdfium_embeddertests", |
| ":pdfium_unittests", |
| ] |
| if (pdf_is_standalone) { |
| deps += [ |
| ":fuzzers", |
| ":pdfium_diff", |
| ":samples", |
| ] |
| } |
| } |