Use system FreeType on Linux.
[pdfium.git] / pdfium.gyp
index 9b8fb05..8b13321 100644 (file)
@@ -1,21 +1,37 @@
 {
   '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' : [
-      '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_'],
       }],
+      ['bundle_freetype==1', {
+        'include_dirs': [
+          'third_party/freetype/include',
+        ],
+        'defines' : [
+          'FT2_BUILD_LIBRARY',
+        ],
+      }, {
+        'include_dirs' : [
+          '/usr/include/freetype2',
+        ],
+      }],
       ['OS=="linux"', {
         'conditions': [
           ['target_arch=="x64"', {
@@ -38,7 +54,6 @@
       'type': 'static_library',
       'dependencies': [
         'third_party/third_party.gyp:bigint',
-        'third_party/third_party.gyp:freetype',
         'third_party/third_party.gyp:safemath',
         'fdrm',
         'fpdfdoc',
             'fpdfsdk/src/fpdfsdkdll.rc',
           ],
         }],
+        ['bundle_freetype==1', {
+          'dependencies': [
+            'third_party/third_party.gyp:freetype',
+          ],
+        }, {
+          'link_settings': {
+            'libraries': [
+              '-lfreetype',
+            ],
+          },
+        }],
       ],
       'all_dependent_settings': {
         'msvs_settings': {
       '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',
       'target_name': 'pdfium_unittests',
       'type': 'executable',
       'dependencies': [
-        '../../base/base.gyp:base',
-        '../../base/base.gyp:run_all_unittests',
-        '../../base/base.gyp:test_support_base',
-        '../../testing/gtest.gyp:gtest',
+        '<(DEPTH)/testing/gtest.gyp:gtest_main',
+        '<(DEPTH)/testing/gtest.gyp:gtest',
         'pdfium',
       ],
       'include_dirs': [
         '<(DEPTH)'
       ],
       'sources': [
+        'testing/fx_string_testhelpers.h',
+        'testing/fx_string_testhelpers.cpp',
         'core/src/fxcrt/fx_basic_bstring_unittest.cpp',
+        'core/src/fxcrt/fx_basic_wstring_unittest.cpp',
+      ],
+    },
+    {
+      'target_name': 'pdfium_embeddertests',
+      'type': 'executable',
+      'dependencies': [
+        '<(DEPTH)/testing/gtest.gyp:gtest',
+        'pdfium',
+      ],
+      'include_dirs': [
+        '<(DEPTH)'
       ],
-    }
+      'sources': [
+        'fpdfsdk/src/fpdf_dataavail_embeddertest.cpp',
+        'fpdfsdk/src/fpdfdoc_embeddertest.cpp',
+        'fpdfsdk/src/fpdftext_embeddertest.cpp',
+        'fpdfsdk/src/fpdfview_embeddertest.cpp',
+        'testing/embedder_test.cpp',
+        'testing/embedder_test.h',
+        'testing/fx_string_testhelpers.cpp',
+        'testing/fx_string_testhelpers.h',
+      ],
+    },
   ],
 }