Replace linux-specific code in test scripts.
[pdfium.git] / pdfium.gyp
index 02ab629..d22375f 100644 (file)
@@ -1,30 +1,29 @@
 {
   'variables': {
     'pdf_use_skia%': 0,
+    'conditions': [
+      ['OS=="linux"', {
+        'bundle_freetype%': 0,
+      }, {  # On Android there's no system FreeType. On Windows and Mac, only a
+            # few methods are used from it.
+        'bundle_freetype%': 1,
+      }],    
+    ],
   },
   'target_defaults': {
     'defines' : [
-      'FOXIT_CHROME_BUILD',
-      '_FXFT_VERSION_=2501',
       '_FPDFSDK_LIB',
       '_NO_GDIPLUS_',  # workaround text rendering issues on Windows
+      'OPJ_STATIC',
+    ],
+    'include_dirs': [
+      'third_party/freetype/include',
     ],
     'conditions': [
       ['pdf_use_skia==1', {
         'defines': ['_SKIA_SUPPORT_'],
       }],
-      # pdfium uses exceptions. Override the default exceptions-off setting
-      # from chromium.
-      # TODO: Instead, change pdfium to not use exceptions, and remove this.
-      ['OS=="mac"', {
-        'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', },
-      }],
-      ['OS=="win"', {
-        'msvs_settings': { 'VCCLCompilerTool': { 'ExceptionHandling': '1', }, },
-        'defines!': [ '_HAS_EXCEPTIONS=0', ],
-      }],
       ['OS=="linux"', {
-        'cflags!': [ '-fno-exceptions', ],
         'conditions': [
           ['target_arch=="x64"', {
             'defines' : [ '_FX_CPU_=_FX_X64_', ],
@@ -45,7 +44,8 @@
       'target_name': 'pdfium',
       'type': 'static_library',
       'dependencies': [
-        'safemath',
+        'third_party/third_party.gyp:bigint',
+        'third_party/third_party.gyp:pdfium_base',
         'fdrm',
         'fpdfdoc',
         'fpdfapi',
@@ -64,7 +64,6 @@
         'fpdfsdk/include/fpdfdoc.h',
         'fpdfsdk/include/fpdfedit.h',
         'fpdfsdk/include/fpdfformfill.h',
-        'fpdfsdk/include/fpdfoom.h',
         'fpdfsdk/include/fpdftext.h',
         'fpdfsdk/include/fpdfview.h',
         'fpdfsdk/include/fpdf_dataavail.h',
@@ -82,7 +81,6 @@
         'fpdfsdk/src/fpdfeditimg.cpp',
         'fpdfsdk/src/fpdfeditpage.cpp',
         'fpdfsdk/src/fpdfformfill.cpp',
-        'fpdfsdk/src/fpdfoom.cpp',
         'fpdfsdk/src/fpdfppo.cpp',
         'fpdfsdk/src/fpdfsave.cpp',
         'fpdfsdk/src/fpdftext.cpp',
             'fpdfsdk/src/fpdfsdkdll.rc',
           ],
         }],
+        ['bundle_freetype==1', {
+          'dependencies': [
+            'third_party/third_party.gyp:freetype',
+          ],
+        }, {
+          'link_settings': {
+            'libraries': [
+              '-lfreetype',
+            ],
+          },
+        }],
       ],
       'all_dependent_settings': {
         'msvs_settings': {
       },
     },
     {
-      'target_name': 'safemath',
-      'type': 'none',
-      'sources': [
-        'third_party/logging.h',
-        'third_party/macros.h',
-        'third_party/template_util.h',
-        'third_party/numerics/safe_conversions.h',
-        'third_party/numerics/safe_conversions_impl.h',
-        'third_party/numerics/safe_math.h',
-        'third_party/numerics/safe_math_impl.h',
-      ],
-    },
-    {
       'target_name': 'fdrm',
       'type': 'static_library',
       'ldflags': [ '-L<(PRODUCT_DIR)',],
         'core/src/fpdfapi/fpdf_font/fpdf_font.cpp',
         'core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp',
         'core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp',
-        'core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp',
         'core/src/fpdfapi/fpdf_font/ttgsubtable.cpp',
         'core/src/fpdfapi/fpdf_font/ttgsubtable.h',
         'core/src/fpdfapi/fpdf_page/fpdf_page.cpp',
         'core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp',
         'core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp',
         'core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp',
-        'core/src/fpdfapi/fpdf_page/fpdf_page_parser_new.cpp',
         'core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp',
         'core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp',
         'core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp',
       'include_dirs': [
       ],
       'ldflags': [ '-L<(PRODUCT_DIR)',],
+      'msvs_settings': {
+        'VCCLCompilerTool': {
+          # Unresolved warnings in fx_codec_jpx_opj.cpp
+          # https://code.google.com/p/pdfium/issues/detail?id=100
+          'WarnAsError': 'false',
+        },
+      },
       'sources': [
         'core/include/fxcodec/fx_codec.h',
         'core/include/fxcodec/fx_codec_def.h',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_pi.c',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_raw.c',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_t1.c',
-        'core/src/fxcodec/fx_libopenjpeg/src/fx_t1_generate_luts.c',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_t2.c',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_tcd.c',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_tgt.c',
         'core/include/fxcrt/fx_ucd.h',
         'core/include/fxcrt/fx_xml.h',
         'core/src/fxcrt/extension.h',
+        'core/src/fxcrt/fx_safe_types.h',
         'core/src/fxcrt/fxcrt_platforms.cpp',
         'core/src/fxcrt/fxcrt_platforms.h',
         'core/src/fxcrt/fxcrt_posix.cpp',
         'core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c',
         'core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c',
         'core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c',
-        'core/src/fxge/fx_freetype/include/fxft_cffobjs.h',
-        'core/src/fxge/fx_freetype/include/fxft_cfftypes.h',
-        'core/src/fxge/fx_freetype/include/fxft_freetype.h',
-        'core/src/fxge/fx_freetype/include/fxft_ft2build.h',
-        'core/src/fxge/fx_freetype/include/fxft_ftmm.h',
-        'core/src/fxge/fx_freetype/include/fxft_ftobjs.h',
-        'core/src/fxge/fx_freetype/include/fxft_ftotval.h',
-        'core/src/fxge/fx_freetype/include/fxft_ftoutln.h',
-        'core/src/fxge/fx_freetype/include/fxft_ftstream.h',
-        'core/src/fxge/fx_freetype/include/fxft_tttables.h',
-        'core/src/fxge/fx_freetype/include/fxft_tttypes.h',
-        'core/src/fxge/fx_freetype/src/fxft_cff.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftbase.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftbitmap.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftglyph.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftinit.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftlcdfil.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftmm.c',
-        'core/src/fxge/fx_freetype/src/fxft_ftsystem.c',
-        'core/src/fxge/fx_freetype/src/fxft_psaux.c',
-        'core/src/fxge/fx_freetype/src/fxft_pshinter.c',
-        'core/src/fxge/fx_freetype/src/fxft_psmodule.c',
-        'core/src/fxge/fx_freetype/src/fxft_raster.c',
-        'core/src/fxge/fx_freetype/src/fxft_sfnt.c',
-        'core/src/fxge/fx_freetype/src/fxft_smooth.c',
-        'core/src/fxge/fx_freetype/src/fxft_truetype.c',
-        'core/src/fxge/fx_freetype/src/fxft_type1.c',
-        'core/src/fxge/fx_freetype/src/fxft_type1cid.c',
+        'core/src/fxge/freetype/fx_freetype.c',
         'core/src/fxge/ge/fx_ge.cpp',
         'core/src/fxge/ge/fx_ge_device.cpp',
         'core/src/fxge/ge/fx_ge_font.cpp',
         }],
         ['OS=="win"', {
           'defines!': [
-            'NOMINMAX',
             'WIN32_LEAN_AND_MEAN'
           ],
           'sources': [
     {
       'target_name': 'javascript',
       'type': 'static_library',
-        'include_dirs': [
-          '<(DEPTH)/v8',
-          '<(DEPTH)/v8/include',
-        ],
+      'include_dirs': [
+        '<(DEPTH)/v8',
+        '<(DEPTH)/v8/include',
+      ],
       'dependencies': [
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
-        '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
       ],
       'export_dependent_settings': [
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
         'fpdfsdk/include/javascript/Icon.h',
         'fpdfsdk/include/javascript/IJavaScript.h',
         'fpdfsdk/include/javascript/JavaScript.h',
-        'fpdfsdk/include/javascript/JS_Console.h',
         'fpdfsdk/include/javascript/JS_Context.h',
         'fpdfsdk/include/javascript/JS_Define.h',
         'fpdfsdk/include/javascript/JS_EventHandler.h',
         'fpdfsdk/src/javascript/JS_Value.cpp',
         'fpdfsdk/src/javascript/PublicMethods.cpp',
         'fpdfsdk/src/javascript/report.cpp',
+        'fpdfsdk/src/javascript/resource.cpp',
         'fpdfsdk/src/javascript/util.cpp',
       ],
     },
         'fpdfsdk/src/formfiller/FFL_Utils.cpp',
       ],
     },
+    {
+      'target_name': 'pdfium_unittests',
+      'type': 'executable',
+      'dependencies': [
+        '<(DEPTH)/testing/gtest.gyp:gtest_main',
+        '<(DEPTH)/testing/gtest.gyp:gtest',
+        'pdfium',
+      ],
+      'include_dirs': [
+        '<(DEPTH)'
+      ],
+      'sources': [
+        'core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp',
+        'core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp',
+        'core/src/fxcrt/fx_basic_bstring_unittest.cpp',
+        'core/src/fxcrt/fx_basic_wstring_unittest.cpp',
+        'testing/fx_string_testhelpers.h',
+        'testing/fx_string_testhelpers.cpp',
+      ],
+    },
+    {
+      'target_name': 'pdfium_embeddertests',
+      'type': 'executable',
+      'dependencies': [
+        '<(DEPTH)/testing/gmock.gyp:gmock',
+        '<(DEPTH)/testing/gtest.gyp:gtest',
+        'pdfium',
+      ],
+      'include_dirs': [
+        '<(DEPTH)'
+      ],
+      'sources': [
+        'fpdfsdk/src/fpdf_dataavail_embeddertest.cpp',
+        'fpdfsdk/src/fpdfdoc_embeddertest.cpp',
+        'fpdfsdk/src/fpdfformfill_embeddertest.cpp',
+        'fpdfsdk/src/fpdftext_embeddertest.cpp',
+        'fpdfsdk/src/fpdfview_embeddertest.cpp',
+        'testing/embedder_test.cpp',
+        'testing/embedder_test.h',
+        'testing/embedder_test_mock_delegate.h',
+        'testing/fx_string_testhelpers.cpp',
+        'testing/fx_string_testhelpers.h',
+      ],
+    },
   ],
 }