diff --git a/BUILD.gn b/BUILD.gn index e28485f160..314e7a6165 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -121,6 +121,9 @@ config("common_inherited_config") { if (rtc_enable_symbol_export || is_component_build) { defines = [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ] } + if (rtc_enable_objc_symbol_export) { + defines = [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ] + } if (build_with_mozilla) { defines += [ "WEBRTC_MOZILLA_BUILD" ] diff --git a/sdk/objc/base/RTCMacros.h b/sdk/objc/base/RTCMacros.h index b5a79113b8..469e3c93bd 100644 --- a/sdk/objc/base/RTCMacros.h +++ b/sdk/objc/base/RTCMacros.h @@ -11,13 +11,13 @@ #ifndef SDK_OBJC_BASE_RTCMACROS_H_ #define SDK_OBJC_BASE_RTCMACROS_H_ -#ifdef WEBRTC_ENABLE_SYMBOL_EXPORT +#ifdef WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT #if defined(WEBRTC_LIBRARY_IMPL) #define RTC_OBJC_EXPORT __attribute__((visibility("default"))) #endif -#endif // WEBRTC_ENABLE_SYMBOL_EXPORT +#endif // WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT #ifndef RTC_OBJC_EXPORT #define RTC_OBJC_EXPORT diff --git a/tools_webrtc/ios/build_ios_libs.py b/tools_webrtc/ios/build_ios_libs.py index 3bc88743a7..9ae1a79336 100755 --- a/tools_webrtc/ios/build_ios_libs.py +++ b/tools_webrtc/ios/build_ios_libs.py @@ -183,7 +183,7 @@ def BuildWebRTC(output_dir, target_environment, target_arch, flavor, gn_args.append('enable_ios_bitcode=' + ('true' if use_bitcode else 'false')) gn_args.append('use_goma=' + ('true' if use_goma else 'false')) - gn_args.append('rtc_enable_symbol_export=true') + gn_args.append('rtc_enable_objc_symbol_export=true') args_string = ' '.join(gn_args + extra_gn_args) logging.info('Building WebRTC with args: %s', args_string) diff --git a/webrtc.gni b/webrtc.gni index 184d13db19..8b15e89f21 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -35,10 +35,22 @@ if (is_mac) { import("//build/config/mac/rules.gni") } +# This declare_args is separated from the next one because args declared +# in this one, can be read from the next one (args defined in the same +# declare_args cannot be referenced in that scope). declare_args() { # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h) # expand to code that will manage symbols visibility. rtc_enable_symbol_export = false +} + +declare_args() { + # Setting this to true will make RTC_OBJC_EXPORT expand to code that will + # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported + # if C++ symbols are but setting this arg to true while keeping + # rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT + # annotated symbols. + rtc_enable_objc_symbol_export = rtc_enable_symbol_export # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which # will tell the pre-processor to remove the default definition of symbols @@ -320,9 +332,7 @@ webrtc_root = get_path_info(".", "abspath") # It sets defines, include paths and compilation warnings accordingly, # both for WebRTC stand-alone builds and for the scenario when WebRTC # native code is built as part of Chromium. -rtc_common_configs = [ - webrtc_root + ":common_config", -] +rtc_common_configs = [ webrtc_root + ":common_config" ] if (is_mac || is_ios) { rtc_common_configs += [ "//build/config/compiler:enable_arc" ]