This repository has been archived by the owner on Jan 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathcommon.gni
118 lines (105 loc) · 3.85 KB
/
common.gni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if (is_ios) {
import("//build/config/ios/ios_sdk.gni")
import("//build/config/ios/rules.gni")
}
import("//build/config/sysroot.gni")
declare_args() {
# Whether to include Sdl*VideoRenderer.
sdl_video = true
# Whether to include SdlAudioRenderer.
sdl_audio = true
# Whether to enable support for hardware decoders.
enable_hardware_decode = true
}
declare_args() {
# Whether to force hardware acceleration for decoding.
force_hardware_decode = enable_hardware_decode && is_ios && !use_ios_simulator
}
# Defines a target that is either a shared library or an iOS framework. This
# can be treated the same as a normal shared library. If this is iOS, this
# target will need to be added to a bundle_data() target so the framework is
# copied to the device.
#
# This takes the same arguments as a shared_library().
template("framework_library") {
if (is_ios) {
ios_framework_bundle("${target_name}_framework") {
forward_variables_from(invoker, "*")
# ios_framework_bundle() requires passing in public_headers and sources.
# If they are not set, just give a dummy value.
if (!defined(public_headers) || public_headers == []) {
public_headers = [ "//shaka/include/shaka/player.h" ]
}
if (!defined(sources) || sources == []) {
sources = public_headers
}
}
# Create a group so dependencies don't need to add the +link.
group(target_name) {
public_deps = [ ":${target_name}_framework+link" ]
}
} else {
shared_library(target_name) {
forward_variables_from(invoker, "*", [ "info_plist_target" ])
# We need to set the install_name of the library so the executable can
# find the dynamic library. When building in component mode, this is done
# for us.
if (is_mac && !is_component_build) {
if (!defined(ldflags)) {
ldflags = []
}
# TODO: See //build/toolchain/mac/BUILD.gn, specifically the
# tool("solink"). This may not work in the general case. Maybe push
# something upstream?
ldflags += [ "-Wl,-install_name,@loader_path/lib${output_name}.dylib"]
}
}
}
}
# Generates a new file with a git patch applied to it.
#
# Fields:
# - input: The path to the source file to patch.
# - patch: The path to the patch to apply.
# - output: The path to where to put the generate file (should start with
# $root_gen_dir).
# - directory: (optional) The directory that is the base of the patch. If not
# given, will use the current directory.
template("patch") {
action(target_name) {
assert(defined(invoker.input), "Must provide 'input' field")
assert(defined(invoker.patch), "Must provide 'patch' field")
assert(defined(invoker.output), "Must provide 'output' field")
forward_variables_from(invoker, "*",
[ "input", "patch", "output", "directory" ])
inputs = [
invoker.input,
invoker.patch,
]
outputs = [ invoker.output ]
if (defined(invoker.directory)) {
_directory = invoker.directory
} else {
_directory = "."
}
args = [
"--patch", rebase_path(invoker.patch, root_build_dir),
"--dir", rebase_path(_directory, root_build_dir),
"--output", rebase_path(invoker.output, root_build_dir),
]
script = "//shaka/tools/patch.py"
}
}