summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2015-10-21 13:19:28 -0700
committerOliver Chang <ochang@chromium.org>2015-10-21 13:19:28 -0700
commit3b2ab45f0a883046a7c457e8435b5a9b2c1c4156 (patch)
tree15af4f698106a1e87da4e9caad66e9db5e53ae8e
parentd0b794a102d1f37131c8f56c27f4a5fc9234a879 (diff)
downloadpdfium-3b2ab45f0a883046a7c457e8435b5a9b2c1c4156.tar.xz
(Reland) Switch builds to clang by default for Linux and OS X.
Also adds support for ASan and sanitizer coverage. BUG=pdfium:1,pdfium:171 R=thakis@chromium.org, thestig@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/5478df43a8970257e9644ae6f57a6fe7513029c6 Review URL: https://codereview.chromium.org/1406843002 .
-rw-r--r--.gitignore3
-rw-r--r--DEPS9
-rw-r--r--build/standalone.gypi36
3 files changed, 47 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 3014ed6fa7..cbd1e7da4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,9 @@
/testing/corpus
/testing/gmock
/testing/gtest
+/third_party/llvm
+/third_party/llvm-build
+/tools/clang
/v8
/xcodebuild
Makefile
diff --git a/DEPS b/DEPS
index 455150d093..220f0c6b42 100644
--- a/DEPS
+++ b/DEPS
@@ -16,6 +16,9 @@ deps = {
"testing/gtest":
"https://chromium.googlesource.com/external/googletest.git@8245545b6dc9c4703e6496d1efd19e975ad2b038",
+ "tools/clang":
+ "https://chromium.googlesource.com/chromium/src/tools/clang",
+
"v8":
"https://chromium.googlesource.com/v8/v8.git@2607e2b06b0be40a4c3f762c1a666a389dc28a99",
@@ -76,4 +79,10 @@ hooks = [
'-s', 'pdfium/buildtools/linux64/clang-format.sha1',
],
},
+ {
+ # Pull clang if needed or requested via GYP_DEFINES.
+ 'name': 'clang',
+ 'pattern': '.',
+ 'action': ['python', 'pdfium/tools/clang/scripts/update.py', '--if-needed'],
+ },
]
diff --git a/build/standalone.gypi b/build/standalone.gypi
index 507368dc25..a70b442bee 100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -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)',
@@ -50,6 +53,11 @@
}, {
'os_posix%': 1,
}],
+ ['OS=="linux" or OS=="mac"', {
+ 'clang%': 1,
+ }, {
+ 'clang%': 0,
+ }],
],
},
'target_defaults': {
@@ -249,6 +257,20 @@
'-fPIC',
],
}],
+ ['asan==1', {
+ 'cflags': [
+ '-fsanitize=address',
+ '-gline-tables-only',
+ ],
+ 'ldflags': [
+ '-fsanitize=address',
+ ],
+ }],
+ ['sanitizer_coverage!=0', {
+ 'cflags': [
+ '-fsanitize-coverage=<(sanitizer_coverage)',
+ ],
+ }],
['OS=="win"', {
'defines': [
'NOMINMAX',
@@ -280,5 +302,17 @@
'xcode_settings': {
# See comment in Chromium's common.gypi for why this is needed.
'SYMROOT': '<(DEPTH)/xcodebuild',
- }
+ },
+ '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"
+ ],
}