Sync build settings to XFA.
[pdfium.git] / build / standalone.gypi
index 5a65fa5..a70b442 100644 (file)
@@ -8,6 +8,8 @@
   'variables': {
     'component%': 'static_library',
     'clang%': 0,
+    'asan%': 0,
+    'sanitizer_coverage%': 0,
     'msvs_multi_core_compile%': '1',
     'variables': {
       'variables': {
       'host_arch%': '<(host_arch)',
       'target_arch%': '<(target_arch)',
     },
+    'clang_dir%': 'third_party/llvm-build/Release+Asserts',
     # These two are needed by V8.
     'host_arch%': '<(host_arch)',
     'target_arch%': '<(target_arch)',
     'werror%': '-Werror',
     'v8_optimized_debug%': 0,
+    'v8_use_external_startup_data%': 0,
     'icu_gyp_path': '../v8/third_party/icu/icu.gyp',
     'conditions': [
       ['OS == "win"', {
       }, {
         'os_posix%': 1,
       }],
+      ['OS=="linux" or OS=="mac"', {
+        'clang%': 1,
+      }, {
+        'clang%': 0,
+      }],
     ],
   },
   'target_defaults': {
@@ -57,7 +66,7 @@
       'Debug': {
         'cflags': [
           '-g',
-          '-O0',          
+          '-O0',
           '-fdata-sections',
           '-ffunction-sections',
         ],
         'msvs_configuration_platform': 'x64',
       },
     },
-    'defines!': [
-      'DEBUG',
-    ],
     'cflags': [
       '-Wall',
       '-W',
+      '-Wno-missing-field-initializers',
+      # Code might someday be made clean for -Wsign-compare, but for now
+      # this produces too much noise to be useful.
+      '-Wno-sign-compare',
       '-Wno-unused-parameter',
-      '-pthread', '-fno-exceptions',
+      '-pthread',
+      '-fno-exceptions',
       '-fvisibility=hidden',
     ],
     'cflags_cc': [
+      '-std=gnu++0x',
       '-Wnon-virtual-dtor',
       '-fno-rtti',
     ],
     'ldflags': [
       '-pthread',
     ],
+    'defines': [
+      # Don't use deprecated V8 APIs anywhere.
+      'V8_DEPRECATION_WARNINGS',
+    ],
     'msvs_cygwin_dirs': ['<(DEPTH)/v8/third_party/cygwin'],
     'msvs_configuration_attributes': {
       'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
       'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
       'CharacterSet': '1',
     },
+    'msvs_disabled_warnings': [4800, 4996, 4456, 4457, 4458, 4459, 4091],
+    # 4456, 4457, 4458, 4459 are variable shadowing warnings that are new in
+    # VS2015.
+    # C4091: 'typedef ': ignored on left of 'X' when no variable is
+    #                    declared.
+    # This happens in a number of Windows headers with VS 2015.
     'msvs_settings': {
       'VCCLCompilerTool': {
         'MinimalRebuild': 'false',
         'EnableFunctionLevelLinking': 'true',
         'RuntimeTypeInfo': 'false',
         'WarningLevel': '3',
-        'WarnAsError': 'false',
         'DebugInformationFormat': '3',
         'Detect64BitPortabilityProblems': 'false',
         'conditions': [
           }, {
             'ExceptionHandling': '0',
           }],
+          ['target_arch=="x64"', {
+            # 64-bit warnings need to be resolved.
+            # https://code.google.com/p/pdfium/issues/detail?id=101
+            'WarnAsError': 'false',
+          }, {
+            'WarnAsError': 'true',
+          }],
         ],
       },
       'VCLibrarianTool': {
     },
     'xcode_settings': {
       'ALWAYS_SEARCH_USER_PATHS': 'NO',
+      'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11',
       'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
       'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
                                                 # (Equivalent to -fPIC)
         '-Wno-unused-parameter',
       ],
     },
-  },
-  'conditions': [
-    ['component=="shared_library"', {
-      'cflags': [
-        '-fPIC',
-      ],
-    }],
-    ['OS=="win"', {
-      'target_defaults': {
+    'conditions': [
+      ['component=="shared_library"', {
+        'cflags': [
+          '-fPIC',
+        ],
+      }],
+      ['asan==1', {
+        'cflags': [
+          '-fsanitize=address',
+          '-gline-tables-only',
+        ],
+        'ldflags': [
+          '-fsanitize=address',
+        ],
+      }],
+      ['sanitizer_coverage!=0', {
+        'cflags': [
+          '-fsanitize-coverage=<(sanitizer_coverage)',
+        ],
+      }],
+      ['OS=="win"', {
         'defines': [
           'NOMINMAX',
           '_CRT_SECURE_NO_DEPRECATE',
             ],
           }],
         ],
-      },
-    }],  # OS=="win"
-    ['OS=="mac"', {
-      'target_defaults': {
+      }],  # OS=="win"
+      ['OS=="mac"', {
         'target_conditions': [
           ['_type!="static_library"', {
             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
           }],
         ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="mac"
-  ],
+      }],  # OS=="mac"
+      ['v8_use_external_startup_data==1', {
+        'defines': [
+          'V8_USE_EXTERNAL_STARTUP_DATA',
+        ],
+      }],  # v8_use_external_startup_data==1
+    ],
+  },
   'xcode_settings': {
     # See comment in Chromium's common.gypi for why this is needed.
     'SYMROOT': '<(DEPTH)/xcodebuild',
-  }
-}
\ No newline at end of file
+  },
+  'conditions': [
+    ['OS=="linux" or OS=="mac"', {
+      'conditions': [
+        ['clang==1', {
+          'make_global_settings': [
+            ['CC', '<(clang_dir)/bin/clang'],
+            ['CXX', '<(clang_dir)/bin/clang++'],
+          ],
+        }],
+      ],
+    }],  # OS=="linux" or OS=="mac"
+  ],
+}