From 84659a63de57f0494ab65ad21be2748462e4ad21 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Fri, 28 Jan 2011 02:57:59 +0000 Subject: [PATCH] clang: Make it possible to add a plugin through GYP_DEFINES With this CL, one can run GYP_DEFINES='clang=1 clang_load=/Users/thakis/src/llvm-svn/tools/clang/examples/PrintFunctionNames/libPrintFunctionNames.dylib clang_plugin=print-fns' gclient runhooks and then the normal build will run with the clang example plugin. I'm not sure if this is the best way to run Elliot's plugin, but it's useful for local one-off runs. BUG=none TEST=none Review URL: http://codereview.chromium.org/6355010 git-svn-id: http://src.chromium.org/svn/trunk/src/build@72924 4ff67af0-8c30-449e-8e8b-ad334ec8d88c --- common.gypi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/common.gypi b/common.gypi index 7f16b21c3..6044b5276 100644 --- a/common.gypi +++ b/common.gypi @@ -270,6 +270,15 @@ # won't be necessary. 'clang%': 0, + # These two variables can be set in GYP_DEFINES while running + # |gclient runhooks| to let clang run a plugin in every compilation. + # Only has an effect if 'clang=1' is in GYP_DEFINES as well. + # Example: + # GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_plugin=print-fns' gclient runhooks + + 'clang_load%': '', + 'clang_add_plugin%': '', + # Override whether we should use Breakpad on Linux. I.e. for Chrome bot. 'linux_breakpad%': 0, # And if we want to dump symbols for Breakpad-enabled builds. @@ -1162,6 +1171,12 @@ '-mfpmath=sse', ], }], + ['clang==1 and clang_load!="" and clang_add_plugin!=""', { + 'cflags': [ + '-Xclang', '-load', '-Xclang', '<(clang_load)', + '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)', + ], + }], ['no_strict_aliasing==1', { 'cflags': [ '-fno-strict-aliasing', @@ -1274,6 +1289,12 @@ '-Wno-unnamed-type-template-args', ], }], + ['clang==1 and clang_load!="" and clang_add_plugin!=""', { + 'OTHER_CFLAGS': [ + '-Xclang', '-load', '-Xclang', '<(clang_load)', + '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)', + ], + }], ], }, 'target_conditions': [