Sync build settings to XFA.
[pdfium.git] / build / standalone.gypi
index 87fe344..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': {
@@ -37,6 +39,7 @@
       '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)',
       }, {
         'os_posix%': 1,
       }],
+      ['OS=="linux" or OS=="mac"', {
+        'clang%': 1,
+      }, {
+        'clang%': 0,
+      }],
     ],
   },
   'target_defaults': {
     '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',
     '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)',
         '-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"
-    ['v8_use_external_startup_data==1', {
-      'target_defaults': {
+      }],  # OS=="mac"
+      ['v8_use_external_startup_data==1', {
         'defines': [
           'V8_USE_EXTERNAL_STARTUP_DATA',
         ],
-      },
-    }],  # v8_use_external_startup_data==1
-  ],
+      }],  # 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"
+  ],
+}