Merge GN templates for iOS and MacOS framework creation
The two GN templates are nearly identical, so merge them to reduce maintenance. Bug: webrtc:13949 Change-Id: I5f53ade5f9d09ce6f23a6cb29c9d39df4485a237 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258380 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com> Cr-Commit-Position: refs/heads/main@{#36495}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
145fdbf3b2
commit
26b23b8fcc
@ -1244,7 +1244,7 @@ if (is_ios || is_mac) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_ios) {
|
if (is_ios) {
|
||||||
ios_framework_bundle_with_umbrella_header("framework_objc") {
|
apple_framework_bundle_with_umbrella_header("framework_objc") {
|
||||||
info_plist = "objc/Info.plist"
|
info_plist = "objc/Info.plist"
|
||||||
output_name = "WebRTC"
|
output_name = "WebRTC"
|
||||||
|
|
||||||
@ -1381,7 +1381,7 @@ if (is_ios || is_mac) {
|
|||||||
"CoreMedia.framework",
|
"CoreMedia.framework",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [
|
configs = [
|
||||||
"..:common_objc",
|
"..:common_objc",
|
||||||
":used_from_extension",
|
":used_from_extension",
|
||||||
]
|
]
|
||||||
@ -1397,7 +1397,7 @@ if (is_ios || is_mac) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
mac_framework_bundle_with_umbrella_header("mac_framework_objc") {
|
apple_framework_bundle_with_umbrella_header("mac_framework_objc") {
|
||||||
info_plist = "objc/Info.plist"
|
info_plist = "objc/Info.plist"
|
||||||
output_name = "WebRTC"
|
output_name = "WebRTC"
|
||||||
|
|
||||||
|
153
webrtc.gni
153
webrtc.gni
@ -960,14 +960,13 @@ template("rtc_shared_library") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ios) {
|
if (is_mac || is_ios) {
|
||||||
# TODO: Generate module.modulemap file to enable use in Swift
|
template("apple_framework_bundle_with_umbrella_header") {
|
||||||
# projects. See "mac_framework_bundle_with_umbrella_header".
|
|
||||||
template("ios_framework_bundle_with_umbrella_header") {
|
|
||||||
forward_variables_from(invoker, [ "output_name" ])
|
forward_variables_from(invoker, [ "output_name" ])
|
||||||
this_target_name = target_name
|
this_target_name = target_name
|
||||||
umbrella_header_path =
|
umbrella_header_path =
|
||||||
"$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
|
"$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
|
||||||
|
modulemap_path = "$target_gen_dir/Modules/module.modulemap"
|
||||||
|
|
||||||
action_foreach("create_bracket_include_headers_$target_name") {
|
action_foreach("create_bracket_include_headers_$target_name") {
|
||||||
script = "//tools_webrtc/apple/copy_framework_header.py"
|
script = "//tools_webrtc/apple/copy_framework_header.py"
|
||||||
@ -985,102 +984,63 @@ if (is_ios) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
ios_framework_bundle(target_name) {
|
if (is_mac) {
|
||||||
forward_variables_from(invoker, "*", [ "public_headers" ])
|
mac_framework_bundle(target_name) {
|
||||||
public_headers = get_target_outputs(
|
forward_variables_from(invoker, "*", [ "configs" ])
|
||||||
":create_bracket_include_headers_$this_target_name")
|
if (defined(invoker.configs)) {
|
||||||
deps += [
|
configs += invoker.configs
|
||||||
":copy_umbrella_header_$target_name",
|
}
|
||||||
":create_bracket_include_headers_$target_name",
|
|
||||||
]
|
framework_version = "A"
|
||||||
|
framework_contents = [
|
||||||
|
"Headers",
|
||||||
|
"Modules",
|
||||||
|
"Resources",
|
||||||
|
]
|
||||||
|
|
||||||
|
ldflags = [
|
||||||
|
"-all_load",
|
||||||
|
"-install_name",
|
||||||
|
"@rpath/$output_name.framework/$output_name",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps += [
|
||||||
|
":copy_framework_headers_$this_target_name",
|
||||||
|
":copy_modulemap_$this_target_name",
|
||||||
|
":copy_umbrella_header_$this_target_name",
|
||||||
|
":create_bracket_include_headers_$this_target_name",
|
||||||
|
":modulemap_$this_target_name",
|
||||||
|
":umbrella_header_$this_target_name",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_ios) {
|
||||||
|
ios_framework_bundle(target_name) {
|
||||||
|
forward_variables_from(invoker,
|
||||||
|
"*",
|
||||||
|
[
|
||||||
|
"configs",
|
||||||
|
"public_headers",
|
||||||
|
])
|
||||||
|
if (defined(invoker.configs)) {
|
||||||
|
configs += invoker.configs
|
||||||
|
}
|
||||||
|
public_headers = get_target_outputs(
|
||||||
|
":create_bracket_include_headers_$this_target_name")
|
||||||
|
|
||||||
|
deps += [
|
||||||
|
":copy_umbrella_header_$this_target_name",
|
||||||
|
":create_bracket_include_headers_$this_target_name",
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
action("umbrella_header_$target_name") {
|
if (is_mac || target_environment == "catalyst") {
|
||||||
public_headers = get_target_outputs(
|
|
||||||
":create_bracket_include_headers_$this_target_name")
|
|
||||||
|
|
||||||
script = "//tools_webrtc/ios/generate_umbrella_header.py"
|
|
||||||
|
|
||||||
outputs = [ umbrella_header_path ]
|
|
||||||
args = [
|
|
||||||
"--out",
|
|
||||||
rebase_path(umbrella_header_path, root_build_dir),
|
|
||||||
"--sources",
|
|
||||||
] + public_headers
|
|
||||||
deps = [ ":create_bracket_include_headers_$this_target_name" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target_environment == "catalyst") {
|
|
||||||
# Catalyst frameworks use the same layout as regular Mac frameworks.
|
# Catalyst frameworks use the same layout as regular Mac frameworks.
|
||||||
headers_dir = "Versions/A/Headers"
|
headers_dir = "Versions/A/Headers"
|
||||||
} else {
|
} else {
|
||||||
headers_dir = "Headers"
|
headers_dir = "Headers"
|
||||||
}
|
}
|
||||||
copy("copy_umbrella_header_$target_name") {
|
|
||||||
sources = [ umbrella_header_path ]
|
|
||||||
outputs =
|
|
||||||
[ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]
|
|
||||||
|
|
||||||
deps = [ ":umbrella_header_$target_name" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set_defaults("ios_framework_bundle_with_umbrella_header") {
|
|
||||||
configs = default_shared_library_configs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_mac) {
|
|
||||||
template("mac_framework_bundle_with_umbrella_header") {
|
|
||||||
forward_variables_from(invoker, [ "output_name" ])
|
|
||||||
this_target_name = target_name
|
|
||||||
umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
|
|
||||||
modulemap_path = "$target_gen_dir/Modules/module.modulemap"
|
|
||||||
|
|
||||||
mac_framework_bundle(target_name) {
|
|
||||||
forward_variables_from(invoker, "*", [ "configs" ])
|
|
||||||
if (defined(invoker.configs)) {
|
|
||||||
configs += invoker.configs
|
|
||||||
}
|
|
||||||
|
|
||||||
framework_version = "A"
|
|
||||||
framework_contents = [
|
|
||||||
"Headers",
|
|
||||||
"Modules",
|
|
||||||
"Resources",
|
|
||||||
]
|
|
||||||
|
|
||||||
ldflags = [
|
|
||||||
"-all_load",
|
|
||||||
"-install_name",
|
|
||||||
"@rpath/$output_name.framework/$output_name",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps += [
|
|
||||||
":copy_framework_headers_$this_target_name",
|
|
||||||
":copy_modulemap_$this_target_name",
|
|
||||||
":copy_umbrella_header_$this_target_name",
|
|
||||||
":create_bracket_include_headers_$this_target_name",
|
|
||||||
":modulemap_$this_target_name",
|
|
||||||
":umbrella_header_$this_target_name",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
action_foreach("create_bracket_include_headers_$this_target_name") {
|
|
||||||
script = "//tools_webrtc/apple/copy_framework_header.py"
|
|
||||||
sources = invoker.sources
|
|
||||||
output_name = invoker.output_name
|
|
||||||
outputs = [
|
|
||||||
"$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
|
|
||||||
]
|
|
||||||
args = [
|
|
||||||
"--input",
|
|
||||||
"{{source}}",
|
|
||||||
"--output",
|
|
||||||
rebase_path(target_gen_dir, root_build_dir) +
|
|
||||||
"/$output_name.framework/WebRTC/{{source_file_part}}",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
bundle_data("copy_framework_headers_$this_target_name") {
|
bundle_data("copy_framework_headers_$this_target_name") {
|
||||||
sources = get_target_outputs(
|
sources = get_target_outputs(
|
||||||
@ -1122,11 +1082,12 @@ if (is_mac) {
|
|||||||
deps = [ ":create_bracket_include_headers_$this_target_name" ]
|
deps = [ ":create_bracket_include_headers_$this_target_name" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle_data("copy_umbrella_header_$this_target_name") {
|
copy("copy_umbrella_header_$target_name") {
|
||||||
sources = [ umbrella_header_path ]
|
sources = [ umbrella_header_path ]
|
||||||
outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
|
outputs =
|
||||||
|
[ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]
|
||||||
|
|
||||||
deps = [ ":umbrella_header_$this_target_name" ]
|
deps = [ ":umbrella_header_$target_name" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user