From a0a5b98937de0f0bf90e17011d2cbc8c632cb409 Mon Sep 17 00:00:00 2001 From: mbonadei Date: Mon, 4 Sep 2017 06:49:07 -0700 Subject: [PATCH] Decoupling rtc_base from Obj-C code The goal of this CL is to separate Obj-C/Obj-C++ code from targets which have also C++ code (see https://bugs.chromium.org/p/webrtc/issues/detail?id=7743 for more information). To achieve this we have created 2 targets (rtc_base_objc and rtc_base_generic) and rtc_base will act as a proxy between these targets (this way we can avoid a circular dependency between rtc_base_generic and rtc_base_objc). BUG=webrtc:7743 Review-Url: https://codereview.webrtc.org/3001623003 Cr-Commit-Position: refs/heads/master@{#19661} --- webrtc/rtc_base/BUILD.gn | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/webrtc/rtc_base/BUILD.gn b/webrtc/rtc_base/BUILD.gn index 1914b27439..3cb7766629 100644 --- a/webrtc/rtc_base/BUILD.gn +++ b/webrtc/rtc_base/BUILD.gn @@ -429,7 +429,28 @@ rtc_source_set("rtc_json") { } } -rtc_static_library("rtc_base") { +rtc_source_set("rtc_base") { + public_deps = [ + ":rtc_base_generic", + ] + if (is_ios || is_mac) { + public_deps += [ ":rtc_base_objc" ] + } +} + +if (is_ios || is_mac) { + rtc_source_set("rtc_base_objc") { + sources = [ + "thread_darwin.mm", + ] + deps = [ + ":rtc_base_generic", + ] + visibility = [ ":rtc_base" ] + } +} + +rtc_source_set("rtc_base_generic") { cflags = [] cflags_cc = [] libs = [] @@ -538,6 +559,11 @@ rtc_static_library("rtc_base") { "thread.h", ] + visibility = [ + ":rtc_base", + ":rtc_base_objc", + ] + # TODO(henrike): issue 3307, make rtc_base build with the Chromium default # compiler settings. suppressed_configs += [ "//build/config/compiler:chromium_code" ] @@ -597,10 +623,7 @@ rtc_static_library("rtc_base") { } if (is_ios || is_mac) { - sources += [ - "macifaddrs_converter.cc", - "thread_darwin.mm", - ] + sources += [ "macifaddrs_converter.cc" ] } if (use_x11) {