diff --git a/BUILD.gn b/BUILD.gn index c3e253a4e8..67c5603364 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -138,6 +138,10 @@ config("common_inherited_config") { cflags = [] ldflags = [] + if (rtc_objc_prefix != "") { + defines += [ "RTC_OBJC_TYPE_PREFIX=${rtc_objc_prefix}" ] + } + if (rtc_dlog_always_on) { defines += [ "DLOG_ALWAYS_ON" ] } diff --git a/sdk/objc/base/RTCMacros.h b/sdk/objc/base/RTCMacros.h index 469e3c93bd..114ced0ea6 100644 --- a/sdk/objc/base/RTCMacros.h +++ b/sdk/objc/base/RTCMacros.h @@ -36,9 +36,10 @@ // WebRTC.framework with their own prefix in case symbol clashing is a // problem. // -// This macro must only be defined here and not on via compiler flag to -// ensure it has a unique value. +// This macro must be defined uniformily across all the translation units. +#ifndef RTC_OBJC_TYPE_PREFIX #define RTC_OBJC_TYPE_PREFIX +#endif // RCT_OBJC_TYPE // diff --git a/sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m b/sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m index 28743a6fc1..56c74971b6 100644 --- a/sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m +++ b/sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m @@ -287,8 +287,8 @@ __block RTC_OBJC_TYPE(RTCPeerConnectionFactory) * factory; __block RTC_OBJC_TYPE(RTCPeerConnection) * pc1; - RTCSessionDescription *rollback = [[RTCSessionDescription alloc] initWithType:RTCSdpTypeRollback - sdp:@""]; + RTC_OBJC_TYPE(RTCSessionDescription) *rollback = + [[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithType:RTCSdpTypeRollback sdp:@""]; @autoreleasepool { factory = [[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init]; diff --git a/tools_webrtc/mb/mb_config.pyl b/tools_webrtc/mb/mb_config.pyl index 19c11748c7..950dbcf6b2 100644 --- a/tools_webrtc/mb/mb_config.pyl +++ b/tools_webrtc/mb/mb_config.pyl @@ -271,7 +271,8 @@ ], 'ios_internal_pure_release_bot_arm64': [ 'ios', 'pure_release_bot', 'arm64', - 'ios_code_signing_identity_description', 'xctest' + 'ios_code_signing_identity_description', 'xctest', + 'rtc_objc_test_prefix', ], 'ios_internal_release_bot_arm64': [ 'ios', 'release_bot', 'arm64', 'ios_code_signing_identity_description', @@ -456,6 +457,9 @@ 'release_bot': { 'mixins': ['pure_release_bot', 'dcheck_always_on'], }, + 'rtc_objc_test_prefix': { + 'gn_args': 'rtc_objc_prefix="RTC_TESTING"', + }, 'rtti': { 'gn_args': 'use_rtti=true', }, diff --git a/webrtc.gni b/webrtc.gni index 8ef21f21b2..4b3ce8635f 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -239,6 +239,11 @@ declare_args() { # "warn": RTC_LOGs a message with LS_WARNING severity if the field trial # hasn't been registered. rtc_strict_field_trials = "" + + # If different from "", symbols exported with RTC_OBJC_EXPORT will be prefixed + # with this string. + # See the definition of RTC_OBJC_TYPE_PREFIX in the code. + rtc_objc_prefix = "" } if (!build_with_mozilla) {