Merge: Create pdfium_unittests binary. [XFA]
[pdfium.git] / pdfium.gyp
index 9f2cd3d..8b0a8b3 100644 (file)
@@ -1,60 +1,45 @@
 {
   'variables': {
-    'win_third_party_warn_as_error': 'false',
     'pdf_use_skia%': 0,
   },
   'target_defaults': {
     'defines' : [
-      'FOXIT_CHROME_BUILD',
-      '_FXFT_VERSION_=2501',
+      'FT2_BUILD_LIBRARY',
       '_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_'],
       }],
       ['OS=="linux"', {
-        'cflags!': [
-          '-fno-exceptions',
-        ],
         'conditions': [
           ['target_arch=="x64"', {
-            'defines' : [
-              '_FX_CPU_=_FX_X64_',
-            ],
-            'cflags': [
-              '-fPIC',
-            ],
+            'defines' : [ '_FX_CPU_=_FX_X64_', ],
+            'cflags': [ '-fPIC', ],
           }],
           ['target_arch=="ia32"', {
-            'defines' : [
-              '_FX_CPU_=_FX_X86_',
-            ],
+            'defines' : [ '_FX_CPU_=_FX_X86_', ],
           }],
         ],
       }],
-      ['OS=="mac"', {
-        'xcode_settings': {
-          'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
-          'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
-        },
-      }],
-      ['clang==1', {
-         'cflags!': [
-           '-Werror',
-         ],
-      }],
     ],
     'msvs_disabled_warnings': [
-      4005, 4018, 4146, 4333, 4345
+      4005, 4018, 4146, 4333, 4345, 4267
     ],
   },
   'targets': [
     {
-      'target_name': 'fpdfsdk',
+      'target_name': 'pdfium',
       'type': 'static_library',
       'dependencies': [
+        'third_party/third_party.gyp:bigint',
+        'third_party/third_party.gyp:freetype',
+        'third_party/third_party.gyp:safemath',
         'fdrm',
         'fpdfdoc',
         'fpdfapi',
         'javascript',
         'jsapi',
         'pdfwindow',
+        'fpdfxfa',
       ],
       'ldflags': [ '-L<(PRODUCT_DIR)',],
       'sources': [
         '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',
@@ -91,7 +76,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',
           ],
         }],
       ],
+      'all_dependent_settings': {
+        'msvs_settings': {
+          'VCLinkerTool': {
+            'AdditionalDependencies': [
+              'advapi32.lib',
+              'gdi32.lib',
+              'user32.lib',
+            ],
+          },
+        },
+        'conditions': [
+          ['OS=="mac"', {
+            'link_settings': {
+              'libraries': [
+                '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
+                '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+              ],
+            },
+          }],
+        ],
+      },
     },
     {
       'target_name': 'fdrm',
         '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',
         'core/include/fxcodec/fx_codec_provider.h',
         'core/src/fxcodec/codec/codec_int.h',
         'core/src/fxcodec/codec/fx_codec.cpp',
+        'core/src/fxcodec/codec/fx_codec_bmp.cpp',
         'core/src/fxcodec/codec/fx_codec_fax.cpp',
         'core/src/fxcodec/codec/fx_codec_flate.cpp',
+        'core/src/fxcodec/codec/fx_codec_gif.cpp',
         'core/src/fxcodec/codec/fx_codec_icc.cpp',
         'core/src/fxcodec/codec/fx_codec_jbig.cpp',
         'core/src/fxcodec/codec/fx_codec_jbig_enc.cpp',
         'core/src/fxcodec/codec/fx_codec_jpeg.cpp',
         'core/src/fxcodec/codec/fx_codec_jpx_opj.cpp',
+        'core/src/fxcodec/codec/fx_codec_png.cpp',
+        'core/src/fxcodec/codec/fx_codec_progress.cpp',
+        'core/src/fxcodec/codec/fx_codec_progress.h',
+        'core/src/fxcodec/codec/fx_codec_tiff.cpp',
         'core/src/fxcodec/fx_libopenjpeg/include/fx_openjpeg.h',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_bio.c',
         'core/src/fxcodec/fx_libopenjpeg/src/fx_cio.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/src/fxcodec/fx_lpng/include/fx_png.h',
+        'core/src/fxcodec/fx_lpng/src/fx_png.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngerror.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngget.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngmem.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngpread.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngread.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngrio.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngrtran.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngrutil.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngset.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngtrans.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngwio.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngwrite.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngwtran.c',
+        'core/src/fxcodec/fx_lpng/src/fx_pngwutil.c',
+        'core/src/fxcodec/fx_tiff/include/fx_tiffiop.h',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_aux.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_close.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_codec.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_color.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_compress.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_dir.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_dirinfo.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_dirread.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_dirwrite.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_dumpmode.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_error.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_extension.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_fax3.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_fax3sm.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_flush.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_getimage.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_jpeg.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_luv.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_lzw.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_next.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_ojpeg.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_open.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_packbits.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_pixarlog.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_predict.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_print.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_read.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_strip.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_swab.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_thunder.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_tile.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_version.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_warning.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_write.c',
+        'core/src/fxcodec/fx_tiff/src/fx_tif_zip.c',
         'core/src/fxcodec/fx_zlib/include/fx_zlib.h',
         'core/src/fxcodec/fx_zlib/src/fx_zlib_adler32.c',
         'core/src/fxcodec/fx_zlib/src/fx_zlib_compress.c',
         'core/src/fxcodec/jbig2/JBig2_Segment.h',
         'core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp',
         'core/src/fxcodec/jbig2/JBig2_SymbolDict.h',
+        'core/src/fxcodec/lbmp/fx_bmp.cpp',
+        'core/src/fxcodec/lbmp/fx_bmp.h',
         'core/src/fxcodec/lcms2/src/fx_cmscam02.c',
         'core/src/fxcodec/lcms2/src/fx_cmscgats.c',
         'core/src/fxcodec/lcms2/src/fx_cmscnvrt.c',
         'core/src/fxcodec/lcms2/src/fx_cmsvirt.c',
         'core/src/fxcodec/lcms2/src/fx_cmswtpnt.c',
         'core/src/fxcodec/lcms2/src/fx_cmsxform.c',
+        'core/src/fxcodec/lgif/fx_gif.cpp',
+        'core/src/fxcodec/lgif/fx_gif.h',
         'core/src/fxcodec/libjpeg/cderror.h',
         'core/src/fxcodec/libjpeg/cdjpeg.h',
         'core/src/fxcodec/libjpeg/fpdfapi_jcapimin.c',
         'core/src/fxcodec/libjpeg/makefile',
         'core/src/fxcodec/libjpeg/transupp.h',
       ],
+      'conditions': [
+        ['os_posix==1', {
+          # core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c does an pointer-to-int
+          # conversion to check that an address is 16-bit aligned (benign).
+          'cflags_c': [ '-Wno-pointer-to-int-cast' ],
+        }],
+      ],
     },
     {
       'target_name': 'fxcrt',
         'core/src/fxcrt/fx_basic_list.cpp',
         'core/src/fxcrt/fx_basic_maps.cpp',
         'core/src/fxcrt/fx_basic_memmgr.cpp',
-        'core/src/fxcrt/fx_basic_memmgr_mini.cpp',
         'core/src/fxcrt/fx_basic_plex.cpp',
         'core/src/fxcrt/fx_basic_utf.cpp',
         'core/src/fxcrt/fx_basic_util.cpp',
         'core/src/fxcrt/fx_unicode.cpp',
         'core/src/fxcrt/fx_xml_composer.cpp',
         'core/src/fxcrt/fx_xml_parser.cpp',
-        'core/src/fxcrt/mem_int.h',
         'core/src/fxcrt/plex.h',
         'core/src/fxcrt/xml_int.h',
       ],
         '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': 'fpdfxfa',
+      'type': 'static_library',
+      'ldflags': [ '-L<(PRODUCT_DIR)',],
+      'dependencies': [
+        'xfa.gyp:xfa',
+      ],
+      'sources': [
+        'fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp',
+        'fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp',
+        'fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp',
+        'fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp',
+        'fpdfsdk/include/fpdfxfa/fpdfxfa_app.h',
+        'fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h',
+        'fpdfsdk/include/fpdfxfa/fpdfxfa_page.h',
+        'fpdfsdk/include/fpdfxfa/fpdfxfa_util.h',
+      ],
+    },
+    {
       'target_name': 'javascript',
       'type': 'static_library',
         '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',
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
       ],
       'include_dirs': [
+        '<(DEPTH)/v8',
         '<(DEPTH)/v8/include',
       ],
       'ldflags': [ '-L<(PRODUCT_DIR)',],
         'fpdfsdk/src/formfiller/FFL_Utils.cpp',
       ],
     },
+    {
+      'target_name': 'pdfium_unittests',
+      'type': 'executable',
+      'dependencies': [
+        '../../base/base.gyp:base_prefs',
+        '../../base/base.gyp:run_all_unittests',
+        '../../testing/gtest.gyp:gtest',
+        'pdfium',
+      ],
+      'include_dirs': [
+        '<(DEPTH)'
+      ],
+      'sources': [
+        'core/src/fxcrt/fx_basic_bstring_unittest.cpp',
+      ],
+    }
   ],
 }