summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-07 14:52:12 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-07 14:52:12 -0500
commit09ca162bb06543d914758db7e6387c250cef8a1b (patch)
treec8ab7f387abff293138093507d69fe355342e7ff
parent18571cd4c53c72f8da72ee984c6b0a31beae6c64 (diff)
downloadpdfium-09ca162bb06543d914758db7e6387c250cef8a1b.tar.xz
Reland "Add option to GYP to use chromium clang plugins."
This reverts commit 5ad8474335798295a9c502999324635845d28ff7. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1772713002 .
-rw-r--r--pdfium.gyp38
1 files changed, 38 insertions, 0 deletions
diff --git a/pdfium.gyp b/pdfium.gyp
index 88bcc028c4..c0462a4189 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -6,6 +6,12 @@
'variables': {
# TODO(thakis): Enable this, pdfium:29
#'chromium_code': 1,
+
+ 'variables': {
+ 'clang_use_pdfium_plugins%': 0,
+ },
+ 'clang_use_pdfium_plugins%': '<(clang_use_pdfium_plugins)',
+
'pdf_use_skia%': 0,
'pdf_enable_v8%': 1,
'pdf_enable_xfa%': 0, # Set to 1 by standalone.gypi in a standalone build.
@@ -16,6 +22,33 @@
# few methods are used from it.
'bundle_freetype%': 1,
}],
+ ['clang_use_pdfium_plugins==1', {
+ 'variables': {
+ 'conditions': [
+ ['OS!="win"', {
+ 'variables': {
+ 'conditions': [
+ ['OS=="mac" or OS=="ios"', {
+ 'clang_lib_path%': '<!(cd <(DEPTH) && pwd -P)/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib',
+ }, { # OS != "mac" or OS != "ios"
+ 'clang_lib_path%': '<!(cd <(DEPTH) && pwd -P)/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so',
+ }],
+ ],
+ },
+ 'clang_dynlib_flags%': '-Xclang -load -Xclang <(clang_lib_path) ',
+ }, { # OS == "win"
+ # On Windows, the plugin is built directly into clang, so there's
+ # no need to load it dynamically.
+ 'clang_dynlib_flags%': '',
+ }],
+ ],
+ 'clang_plugin_args%': '-Xclang -plugin-arg-find-bad-constructs -Xclang check-templates '
+ '-Xclang -plugin-arg-find-bad-constructs -Xclang follow-macro-expansion ',
+ },
+ 'clang_pdfium_plugins_flags%':
+ '<(clang_dynlib_flags)'
+ '-Xclang -add-plugin -Xclang find-bad-constructs <(clang_plugin_args)',
+ }],
],
},
'target_defaults': {
@@ -54,6 +87,11 @@
}],
],
}],
+ ['clang==1 and clang_use_pdfium_plugins==1', {
+ 'cflags': [
+ '<@(clang_pdfium_plugins_flags)',
+ ],
+ }],
],
'msvs_disabled_warnings': [
4005, 4018, 4146, 4333, 4345, 4267,