From 9f36c087f1de7c4ffcdb16c06b3c65826b6b55cb Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Mon, 16 Jun 2014 21:35:20 +0000 Subject: [PATCH] Makes it possible to prevent some third party libraries (jsoncpp and openssl) from being linked. This makes it possible to link webrtc with external implementations of those libraries in case the project depending on webrtc requires another version of those libraries. BUG=3379 R=wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17699005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6455 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/base/base.gyp | 70 +++++++++++++++++++++++++++++++++------- webrtc/build/common.gypi | 6 ++++ 2 files changed, 64 insertions(+), 12 deletions(-) diff --git a/webrtc/base/base.gyp b/webrtc/base/base.gyp index 5cb1fd9bfe..d8972277d4 100644 --- a/webrtc/base/base.gyp +++ b/webrtc/base/base.gyp @@ -452,8 +452,22 @@ ], }, }, { - 'dependencies': [ - '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp', + 'conditions': [ + ['external_libraries==0', { + 'dependencies': [ + '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp', + ], + }, { + 'include_dirs': [ + '<(json_root)', + ], + 'defines': [ + # When defined changes the include path for json.h to where it + # is expected to be when building json outside of the standalone + # build. + 'WEBRTC_EXTERNAL', + ], + }], ], 'sources!': [ '../overrides/webrtc/base/basictypes.h', @@ -474,8 +488,16 @@ 'HAVE_OPENSSL_SSL_H', ], }, - 'dependencies': [ - '<(DEPTH)/third_party/openssl/openssl.gyp:openssl', + 'conditions': [ + ['external_libraries==0', { + 'dependencies': [ + '<(DEPTH)/third_party/openssl/openssl.gyp:openssl', + ], + }, { + 'include_dirs': [ + '<(ssl_root)', + ], + }], ], }, { 'defines': [ @@ -533,8 +555,16 @@ ], }, }, - 'dependencies': [ - '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl', + 'conditions': [ + ['external_libraries==0', { + 'dependencies': [ + '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl', + ] + }, { + 'include_dirs': [ + '<(ssl_root)', + ], + }], ], }], ['OS=="linux"', { @@ -693,15 +723,31 @@ ], }], ['OS == "mac" or OS == "ios" or OS == "win"', { - 'dependencies': [ - '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl', - '<(DEPTH)/third_party/nss/nss.gyp:nspr', - '<(DEPTH)/third_party/nss/nss.gyp:nss', + 'conditions': [ + ['external_libraries==0', { + 'dependencies': [ + '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl', + '<(DEPTH)/third_party/nss/nss.gyp:nspr', + '<(DEPTH)/third_party/nss/nss.gyp:nss', + ], + }, { + 'include_dirs': [ + '<(ssl_root)', + ], + }], ], }], ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', { - 'dependencies': [ - '<(DEPTH)/build/linux/system.gyp:ssl', + 'conditions': [ + ['external_libraries==0', { + 'dependencies': [ + '<(DEPTH)/build/linux/system.gyp:ssl', + ], + }, { + 'include_dirs': [ + '<(ssl_root)', + ], + }], ], }], ], diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index da96c1d3c1..5625c33255 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -54,6 +54,12 @@ 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)', 'include_opus%': '<(include_opus)', 'rbe_components_path%': '<(rbe_components_path)', + 'external_libraries%': '0', + 'json_root%': '<(DEPTH)/third_party/jsoncpp/source/include/', + # openssl needs to be defined or gyp will complain. Is is only used when + # when providing external libraries so just use current directory as a + # placeholder. + 'ssl_root%': '.', # The Chromium common.gypi we use treats all gyp files without # chromium_code==1 as third party code. This disables many of the