OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/arm.gni") | 5 import("//build/config/arm.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/chrome_build.gni") | 7 import("//build/config/chrome_build.gni") |
8 import("//third_party/libvpx/libvpx_srcs.gni") | 8 import("//third_party/libvpx/libvpx_srcs.gni") |
9 import("//third_party/yasm/yasm_assemble.gni") | 9 import("//third_party/yasm/yasm_assemble.gni") |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 cpu_arch_full = current_cpu | 35 cpu_arch_full = current_cpu |
36 } | 36 } |
37 | 37 |
38 config("libvpx_config") { | 38 config("libvpx_config") { |
39 include_dirs = [ | 39 include_dirs = [ |
40 "//third_party/libvpx/source/config", | 40 "//third_party/libvpx/source/config", |
41 "//third_party/libvpx/source/config/$os_category/$cpu_arch_full", | 41 "//third_party/libvpx/source/config/$os_category/$cpu_arch_full", |
42 "//third_party/libvpx/source/libvpx", | 42 "//third_party/libvpx/source/libvpx", |
43 "$root_gen_dir/third_party/libvpx", # Provides vpx_rtcd.h. | 43 "$root_gen_dir/third_party/libvpx", # Provides vpx_rtcd.h. |
44 ] | 44 ] |
45 if (!is_win) { | 45 } |
46 cflags = [ "-Wno-unused-function", "-Wno-sign-compare" ] | 46 |
| 47 # gn orders flags on a target before flags from configs. The default config |
| 48 # adds -Wall, and these flags have to be after -Wall -- so they need to come |
| 49 # from a config and can't be on the target directly. |
| 50 config("libvpx_warnings") { |
| 51 if (is_clang) { |
| 52 cflags = [ |
| 53 # libvpx heavily relies on implicit enum casting. |
| 54 "-Wno-conversion", |
| 55 # libvpx does `if ((a == b))` in some places. |
| 56 "-Wno-parentheses-equality", |
| 57 # libvpx has many static functions in header, which trigger this warning. |
| 58 "-Wno-unused-function", |
| 59 ] |
47 } | 60 } |
48 } | 61 } |
49 | 62 |
50 # This config is applied to targets that depend on libvpx. | 63 # This config is applied to targets that depend on libvpx. |
51 config("libvpx_external_config") { | 64 config("libvpx_external_config") { |
52 include_dirs = [ | 65 include_dirs = [ |
53 "//third_party/libvpx/source/libvpx", | 66 "//third_party/libvpx/source/libvpx", |
54 ] | 67 ] |
55 } | 68 } |
56 | 69 |
(...skipping 12 matching lines...) Expand all Loading... |
69 "//third_party/libvpx/source/libvpx", | 82 "//third_party/libvpx/source/libvpx", |
70 target_gen_dir | 83 target_gen_dir |
71 ] | 84 ] |
72 } | 85 } |
73 } | 86 } |
74 | 87 |
75 static_library("libvpx_intrinsics_mmx") { | 88 static_library("libvpx_intrinsics_mmx") { |
76 configs += [ ":libvpx_config" ] | 89 configs += [ ":libvpx_config" ] |
77 configs -= [ "//build/config/compiler:chromium_code" ] | 90 configs -= [ "//build/config/compiler:chromium_code" ] |
78 configs += [ "//build/config/compiler:no_chromium_code" ] | 91 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 92 configs += [ ":libvpx_warnings" ] |
79 if (!is_win) { | 93 if (!is_win) { |
80 cflags = [ "-mmmx" ] | 94 cflags = [ "-mmmx" ] |
81 } | 95 } |
82 if (current_cpu == "x86") { | 96 if (current_cpu == "x86") { |
83 sources = libvpx_srcs_x86_mmx | 97 sources = libvpx_srcs_x86_mmx |
84 } else if (current_cpu == "x64") { | 98 } else if (current_cpu == "x64") { |
85 sources = libvpx_srcs_x86_64_mmx | 99 sources = libvpx_srcs_x86_64_mmx |
86 } | 100 } |
87 } | 101 } |
88 | 102 |
89 static_library("libvpx_intrinsics_sse2") { | 103 static_library("libvpx_intrinsics_sse2") { |
90 configs += [ ":libvpx_config" ] | 104 configs += [ ":libvpx_config" ] |
91 configs -= [ "//build/config/compiler:chromium_code" ] | 105 configs -= [ "//build/config/compiler:chromium_code" ] |
92 configs += [ "//build/config/compiler:no_chromium_code" ] | 106 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 107 configs += [ ":libvpx_warnings" ] |
93 if (!is_win || is_clang) { | 108 if (!is_win || is_clang) { |
94 cflags = [ "-msse2" ] | 109 cflags = [ "-msse2" ] |
95 } | 110 } |
96 if (current_cpu == "x86") { | 111 if (current_cpu == "x86") { |
97 sources = libvpx_srcs_x86_sse2 | 112 sources = libvpx_srcs_x86_sse2 |
98 } else if (current_cpu == "x64") { | 113 } else if (current_cpu == "x64") { |
99 sources = libvpx_srcs_x86_64_sse2 | 114 sources = libvpx_srcs_x86_64_sse2 |
100 } | 115 } |
101 } | 116 } |
102 | 117 |
103 static_library("libvpx_intrinsics_ssse3") { | 118 static_library("libvpx_intrinsics_ssse3") { |
104 configs += [ ":libvpx_config" ] | 119 configs += [ ":libvpx_config" ] |
105 configs -= [ "//build/config/compiler:chromium_code" ] | 120 configs -= [ "//build/config/compiler:chromium_code" ] |
106 configs += [ "//build/config/compiler:no_chromium_code" ] | 121 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 122 configs += [ ":libvpx_warnings" ] |
107 if (!is_win || is_clang) { | 123 if (!is_win || is_clang) { |
108 cflags = [ "-mssse3" ] | 124 cflags = [ "-mssse3" ] |
109 } | 125 } |
110 if (current_cpu == "x86") { | 126 if (current_cpu == "x86") { |
111 sources = libvpx_srcs_x86_ssse3 | 127 sources = libvpx_srcs_x86_ssse3 |
112 } else if (current_cpu == "x64") { | 128 } else if (current_cpu == "x64") { |
113 sources = libvpx_srcs_x86_64_ssse3 | 129 sources = libvpx_srcs_x86_64_ssse3 |
114 } | 130 } |
115 } | 131 } |
116 | 132 |
117 static_library("libvpx_intrinsics_sse4_1") { | 133 static_library("libvpx_intrinsics_sse4_1") { |
118 configs += [ ":libvpx_config" ] | 134 configs += [ ":libvpx_config" ] |
119 configs -= [ "//build/config/compiler:chromium_code" ] | 135 configs -= [ "//build/config/compiler:chromium_code" ] |
120 configs += [ "//build/config/compiler:no_chromium_code" ] | 136 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 137 configs += [ ":libvpx_warnings" ] |
121 if (!is_win || is_clang) { | 138 if (!is_win || is_clang) { |
122 cflags = [ "-msse4.1" ] | 139 cflags = [ "-msse4.1" ] |
123 } | 140 } |
124 if (current_cpu == "x86") { | 141 if (current_cpu == "x86") { |
125 sources = libvpx_srcs_x86_sse4_1 | 142 sources = libvpx_srcs_x86_sse4_1 |
126 } else if (current_cpu == "x64") { | 143 } else if (current_cpu == "x64") { |
127 sources = libvpx_srcs_x86_64_sse4_1 | 144 sources = libvpx_srcs_x86_64_sse4_1 |
128 } | 145 } |
129 } | 146 } |
130 | 147 |
131 static_library("libvpx_intrinsics_avx2") { | 148 static_library("libvpx_intrinsics_avx2") { |
132 configs += [ ":libvpx_config" ] | 149 configs += [ ":libvpx_config" ] |
133 configs -= [ "//build/config/compiler:chromium_code" ] | 150 configs -= [ "//build/config/compiler:chromium_code" ] |
134 configs += [ "//build/config/compiler:no_chromium_code" ] | 151 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 152 configs += [ ":libvpx_warnings" ] |
135 if (is_win) { | 153 if (is_win) { |
136 cflags = [ "/arch:AVX2" ] | 154 cflags = [ "/arch:AVX2" ] |
137 } else { | 155 } else { |
138 cflags = [ "-mavx2" ] | 156 cflags = [ "-mavx2" ] |
139 } | 157 } |
140 if (current_cpu == "x86") { | 158 if (current_cpu == "x86") { |
141 sources = libvpx_srcs_x86_avx2 | 159 sources = libvpx_srcs_x86_avx2 |
142 } else if (current_cpu == "x64") { | 160 } else if (current_cpu == "x64") { |
143 sources = libvpx_srcs_x86_64_avx2 | 161 sources = libvpx_srcs_x86_64_avx2 |
144 } | 162 } |
145 } | 163 } |
146 | 164 |
147 if (cpu_arch_full == "arm-neon-cpu-detect") { | 165 if (cpu_arch_full == "arm-neon-cpu-detect") { |
148 static_library("libvpx_intrinsics_neon") { | 166 static_library("libvpx_intrinsics_neon") { |
149 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] | 167 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
150 configs += [ ":libvpx_config" ] | 168 configs += [ ":libvpx_config" ] |
| 169 configs += [ ":libvpx_warnings" ] |
151 cflags = [ "-mfpu=neon" ] | 170 cflags = [ "-mfpu=neon" ] |
152 sources = libvpx_srcs_arm_neon_cpu_detect_neon | 171 sources = libvpx_srcs_arm_neon_cpu_detect_neon |
153 } | 172 } |
154 } | 173 } |
155 | 174 |
156 # Converts ARM assembly files to GAS style. | 175 # Converts ARM assembly files to GAS style. |
157 if (current_cpu == "arm") { | 176 if (current_cpu == "arm") { |
158 action_foreach("convert_arm_assembly") { | 177 action_foreach("convert_arm_assembly") { |
159 script = "//third_party/libvpx/run_perl.py" | 178 script = "//third_party/libvpx/run_perl.py" |
160 if (cpu_arch_full == "arm-neon") { | 179 if (cpu_arch_full == "arm-neon") { |
(...skipping 10 matching lines...) Expand all Loading... |
171 root_build_dir), | 190 root_build_dir), |
172 "-i", "{{source}}", | 191 "-i", "{{source}}", |
173 "-o", rebase_path("$target_gen_dir/{{source_name_part}}.S") | 192 "-o", rebase_path("$target_gen_dir/{{source_name_part}}.S") |
174 ] | 193 ] |
175 } | 194 } |
176 | 195 |
177 static_library("libvpx_assembly_arm") { | 196 static_library("libvpx_assembly_arm") { |
178 sources = get_target_outputs(":convert_arm_assembly") | 197 sources = get_target_outputs(":convert_arm_assembly") |
179 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] | 198 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
180 configs += [ ":libvpx_config" ] | 199 configs += [ ":libvpx_config" ] |
| 200 configs += [ ":libvpx_warnings" ] |
181 if (cpu_arch_full == "arm-neon" || | 201 if (cpu_arch_full == "arm-neon" || |
182 cpu_arch_full == "arm-neon-cpu-detect") { | 202 cpu_arch_full == "arm-neon-cpu-detect") { |
183 cflags = [ "-mfpu=neon" ] | 203 cflags = [ "-mfpu=neon" ] |
184 } | 204 } |
185 deps = [ | 205 deps = [ |
186 ":convert_arm_assembly", | 206 ":convert_arm_assembly", |
187 ] | 207 ] |
188 } | 208 } |
189 } | 209 } |
190 | 210 |
191 # gn orders flags on a target before flags from configs. The default config | |
192 # adds -Wall, and these flags have to be after -Wall -- so they need to come | |
193 # from a config and can't be on the target directly. | |
194 config("libvpx_warnings") { | |
195 if (is_clang) { | |
196 cflags = [ "-Wno-conversion" ] | |
197 } | |
198 } | |
199 | |
200 static_library("libvpx") { | 211 static_library("libvpx") { |
201 if (!is_debug && is_win && is_official_build) { | 212 if (!is_debug && is_win && is_official_build) { |
202 configs -= [ "//build/config/compiler:optimize" ] | 213 configs -= [ "//build/config/compiler:optimize" ] |
203 configs += [ "//build/config/compiler:optimize_max" ] | 214 configs += [ "//build/config/compiler:optimize_max" ] |
204 } | 215 } |
205 | 216 |
206 if (current_cpu == "x86") { | 217 if (current_cpu == "x86") { |
207 sources = libvpx_srcs_x86 | 218 sources = libvpx_srcs_x86 |
208 } else if (current_cpu == "x64") { | 219 } else if (current_cpu == "x64") { |
209 if (is_msan) { | 220 if (is_msan) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 256 } |
246 if (is_android) { | 257 if (is_android) { |
247 deps += [ "//third_party/android_tools:cpu_features" ] | 258 deps += [ "//third_party/android_tools:cpu_features" ] |
248 } | 259 } |
249 if (current_cpu == "arm") { | 260 if (current_cpu == "arm") { |
250 deps += [ ":libvpx_assembly_arm" ] | 261 deps += [ ":libvpx_assembly_arm" ] |
251 } | 262 } |
252 | 263 |
253 public_configs = [ ":libvpx_external_config" ] | 264 public_configs = [ ":libvpx_external_config" ] |
254 } | 265 } |
OLD | NEW |