Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: BUILD.gn

Issue 942153003: Update the libvpx GN build files with the cpu_arch -> current_cpu change. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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("//third_party/libvpx/libvpx_srcs.gni") 7 import("//third_party/libvpx/libvpx_srcs.gni")
8 import("//third_party/yasm/yasm_assemble.gni") 8 import("//third_party/yasm/yasm_assemble.gni")
9 9
10 if (is_posix && !is_mac) { 10 if (is_posix && !is_mac) {
11 os_category = "linux" 11 os_category = "linux"
12 } else { 12 } else {
13 os_category = os 13 os_category = current_os
14 } 14 }
15 15
16 # Sets the architecture name for building libvpx. 16 # Sets the architecture name for building libvpx.
17 if (cpu_arch == "x86") { 17 if (current_cpu == "x86") {
18 cpu_arch_full = "ia32" 18 cpu_arch_full = "ia32"
19 } else if (cpu_arch == "x64") { 19 } else if (current_cpu == "x64") {
20 if (is_msan) { 20 if (is_msan) {
21 cpu_arch_full = "generic" 21 cpu_arch_full = "generic"
22 } else { 22 } else {
23 cpu_arch_full = "x64" 23 cpu_arch_full = "x64"
24 } 24 }
25 } else if (cpu_arch == "arm") { 25 } else if (current_cpu == "arm") {
26 if (arm_use_neon) { 26 if (arm_use_neon) {
27 cpu_arch_full = "arm-neon" 27 cpu_arch_full = "arm-neon"
28 } else if (is_android) { 28 } else if (is_android) {
29 cpu_arch_full = "arm-neon-cpu-detect" 29 cpu_arch_full = "arm-neon-cpu-detect"
30 } else { 30 } else {
31 cpu_arch_full = "arm" 31 cpu_arch_full = "arm"
32 } 32 }
33 } else { 33 } else {
34 cpu_arch_full = cpu_arch 34 cpu_arch_full = current_cpu
35 } 35 }
36 36
37 config("libvpx_config") { 37 config("libvpx_config") {
38 include_dirs = [ 38 include_dirs = [
39 "//third_party/libvpx/source/config", 39 "//third_party/libvpx/source/config",
40 "//third_party/libvpx/source/config/$os_category/$cpu_arch_full", 40 "//third_party/libvpx/source/config/$os_category/$cpu_arch_full",
41 "//third_party/libvpx/source/libvpx", 41 "//third_party/libvpx/source/libvpx",
42 "$root_gen_dir/third_party/libvpx", # Provides vpx_rtcd.h. 42 "$root_gen_dir/third_party/libvpx", # Provides vpx_rtcd.h.
43 ] 43 ]
44 if (!is_win) { 44 if (!is_win) {
45 cflags = [ "-Wno-unused-function", "-Wno-sign-compare" ] 45 cflags = [ "-Wno-unused-function", "-Wno-sign-compare" ]
46 } 46 }
47 } 47 }
48 48
49 # This config is applied to targets that depend on libvpx. 49 # This config is applied to targets that depend on libvpx.
50 config("libvpx_external_config") { 50 config("libvpx_external_config") {
51 include_dirs = [ 51 include_dirs = [
52 "//third_party/libvpx/source/libvpx", 52 "//third_party/libvpx/source/libvpx",
53 ] 53 ]
54 } 54 }
55 55
56 if (cpu_arch == "x86" || cpu_arch == "x64") { 56 if (current_cpu == "x86" || current_cpu == "x64") {
57 yasm_assemble("libvpx_yasm") { 57 yasm_assemble("libvpx_yasm") {
58 if (cpu_arch == "x86") { 58 if (current_cpu == "x86") {
59 sources = libvpx_srcs_x86_assembly 59 sources = libvpx_srcs_x86_assembly
60 } else if (cpu_arch == "x64") { 60 } else if (current_cpu == "x64") {
61 sources = libvpx_srcs_x86_64_assembly 61 sources = libvpx_srcs_x86_64_assembly
62 } 62 }
63 63
64 defines = [ "CHROMIUM" ] 64 defines = [ "CHROMIUM" ]
65 include_dirs = [ 65 include_dirs = [
66 "//third_party/libvpx/source/config/$os_category/$cpu_arch_full", 66 "//third_party/libvpx/source/config/$os_category/$cpu_arch_full",
67 "//third_party/libvpx/source/config", 67 "//third_party/libvpx/source/config",
68 "//third_party/libvpx/source/libvpx", 68 "//third_party/libvpx/source/libvpx",
69 target_gen_dir 69 target_gen_dir
70 ] 70 ]
71 } 71 }
72 } 72 }
73 73
74 static_library("libvpx_intrinsics_mmx") { 74 static_library("libvpx_intrinsics_mmx") {
75 configs += [ ":libvpx_config" ] 75 configs += [ ":libvpx_config" ]
76 configs -= [ "//build/config/compiler:chromium_code" ] 76 configs -= [ "//build/config/compiler:chromium_code" ]
77 configs += [ "//build/config/compiler:no_chromium_code" ] 77 configs += [ "//build/config/compiler:no_chromium_code" ]
78 if (!is_win) { 78 if (!is_win) {
79 cflags = [ "-mmmx" ] 79 cflags = [ "-mmmx" ]
80 } 80 }
81 if (cpu_arch == "x86") { 81 if (current_cpu == "x86") {
82 sources = libvpx_srcs_x86_mmx 82 sources = libvpx_srcs_x86_mmx
83 } else if (cpu_arch == "x64") { 83 } else if (current_cpu == "x64") {
84 sources = libvpx_srcs_x86_64_mmx 84 sources = libvpx_srcs_x86_64_mmx
85 } 85 }
86 } 86 }
87 87
88 static_library("libvpx_intrinsics_sse2") { 88 static_library("libvpx_intrinsics_sse2") {
89 configs += [ ":libvpx_config" ] 89 configs += [ ":libvpx_config" ]
90 configs -= [ "//build/config/compiler:chromium_code" ] 90 configs -= [ "//build/config/compiler:chromium_code" ]
91 configs += [ "//build/config/compiler:no_chromium_code" ] 91 configs += [ "//build/config/compiler:no_chromium_code" ]
92 if (!is_win) { 92 if (!is_win) {
93 cflags = [ "-msse2" ] 93 cflags = [ "-msse2" ]
94 } 94 }
95 if (cpu_arch == "x86") { 95 if (current_cpu == "x86") {
96 sources = libvpx_srcs_x86_sse2 96 sources = libvpx_srcs_x86_sse2
97 } else if (cpu_arch == "x64") { 97 } else if (current_cpu == "x64") {
98 sources = libvpx_srcs_x86_64_sse2 98 sources = libvpx_srcs_x86_64_sse2
99 } 99 }
100 } 100 }
101 101
102 static_library("libvpx_intrinsics_ssse3") { 102 static_library("libvpx_intrinsics_ssse3") {
103 configs += [ ":libvpx_config" ] 103 configs += [ ":libvpx_config" ]
104 configs -= [ "//build/config/compiler:chromium_code" ] 104 configs -= [ "//build/config/compiler:chromium_code" ]
105 configs += [ "//build/config/compiler:no_chromium_code" ] 105 configs += [ "//build/config/compiler:no_chromium_code" ]
106 if (!is_win) { 106 if (!is_win) {
107 cflags = [ "-mssse3" ] 107 cflags = [ "-mssse3" ]
108 } 108 }
109 if (cpu_arch == "x86") { 109 if (current_cpu == "x86") {
110 sources = libvpx_srcs_x86_ssse3 110 sources = libvpx_srcs_x86_ssse3
111 } else if (cpu_arch == "x64") { 111 } else if (current_cpu == "x64") {
112 sources = libvpx_srcs_x86_64_ssse3 112 sources = libvpx_srcs_x86_64_ssse3
113 } 113 }
114 } 114 }
115 115
116 static_library("libvpx_intrinsics_sse4_1") { 116 static_library("libvpx_intrinsics_sse4_1") {
117 configs += [ ":libvpx_config" ] 117 configs += [ ":libvpx_config" ]
118 configs -= [ "//build/config/compiler:chromium_code" ] 118 configs -= [ "//build/config/compiler:chromium_code" ]
119 configs += [ "//build/config/compiler:no_chromium_code" ] 119 configs += [ "//build/config/compiler:no_chromium_code" ]
120 if (!is_win) { 120 if (!is_win) {
121 cflags = [ "-msse4.1" ] 121 cflags = [ "-msse4.1" ]
122 } 122 }
123 if (cpu_arch == "x86") { 123 if (current_cpu == "x86") {
124 sources = libvpx_srcs_x86_sse4_1 124 sources = libvpx_srcs_x86_sse4_1
125 } else if (cpu_arch == "x64") { 125 } else if (current_cpu == "x64") {
126 sources = libvpx_srcs_x86_64_sse4_1 126 sources = libvpx_srcs_x86_64_sse4_1
127 } 127 }
128 } 128 }
129 129
130 static_library("libvpx_intrinsics_avx2") { 130 static_library("libvpx_intrinsics_avx2") {
131 configs += [ ":libvpx_config" ] 131 configs += [ ":libvpx_config" ]
132 configs -= [ "//build/config/compiler:chromium_code" ] 132 configs -= [ "//build/config/compiler:chromium_code" ]
133 configs += [ "//build/config/compiler:no_chromium_code" ] 133 configs += [ "//build/config/compiler:no_chromium_code" ]
134 if (is_win) { 134 if (is_win) {
135 cflags = [ "/arch:AVX2" ] 135 cflags = [ "/arch:AVX2" ]
136 } else { 136 } else {
137 cflags = [ "-mavx2" ] 137 cflags = [ "-mavx2" ]
138 } 138 }
139 if (cpu_arch == "x86") { 139 if (current_cpu == "x86") {
140 sources = libvpx_srcs_x86_avx2 140 sources = libvpx_srcs_x86_avx2
141 } else if (cpu_arch == "x64") { 141 } else if (current_cpu == "x64") {
142 sources = libvpx_srcs_x86_64_avx2 142 sources = libvpx_srcs_x86_64_avx2
143 } 143 }
144 } 144 }
145 145
146 if (cpu_arch_full == "arm-neon-cpu-detect") { 146 if (cpu_arch_full == "arm-neon-cpu-detect") {
147 static_library("libvpx_intrinsics_neon") { 147 static_library("libvpx_intrinsics_neon") {
148 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] 148 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
149 configs += [ ":libvpx_config" ] 149 configs += [ ":libvpx_config" ]
150 cflags = [ "-mfpu=neon" ] 150 cflags = [ "-mfpu=neon" ]
151 sources = libvpx_srcs_arm_neon_cpu_detect_neon 151 sources = libvpx_srcs_arm_neon_cpu_detect_neon
152 } 152 }
153 } 153 }
154 154
155 # Converts ARM assembly files to GAS style. 155 # Converts ARM assembly files to GAS style.
156 if (cpu_arch == "arm") { 156 if (current_cpu == "arm") {
157 action_foreach("convert_arm_assembly") { 157 action_foreach("convert_arm_assembly") {
158 script = "//third_party/libvpx/run_perl.py" 158 script = "//third_party/libvpx/run_perl.py"
159 if (cpu_arch_full == "arm-neon") { 159 if (cpu_arch_full == "arm-neon") {
160 sources = libvpx_srcs_arm_neon_assembly 160 sources = libvpx_srcs_arm_neon_assembly
161 } else if (cpu_arch_full == "arm-neon-cpu-detect") { 161 } else if (cpu_arch_full == "arm-neon-cpu-detect") {
162 sources = libvpx_srcs_arm_neon_cpu_detect_assembly 162 sources = libvpx_srcs_arm_neon_cpu_detect_assembly
163 } else { 163 } else {
164 sources = libvpx_srcs_arm_assembly 164 sources = libvpx_srcs_arm_assembly
165 } 165 }
166 outputs = [ "$target_gen_dir/{{source_name_part}}.S" ] 166 outputs = [ "$target_gen_dir/{{source_name_part}}.S" ]
(...skipping 19 matching lines...) Expand all
186 ] 186 ]
187 } 187 }
188 } 188 }
189 189
190 static_library("libvpx") { 190 static_library("libvpx") {
191 if (!is_debug && is_win && is_official_build) { 191 if (!is_debug && is_win && is_official_build) {
192 configs -= [ "//build/config/compiler:optimize" ] 192 configs -= [ "//build/config/compiler:optimize" ]
193 configs += [ "//build/config/compiler:optimize_max" ] 193 configs += [ "//build/config/compiler:optimize_max" ]
194 } 194 }
195 195
196 if (cpu_arch == "x86") { 196 if (current_cpu == "x86") {
197 sources = libvpx_srcs_x86 197 sources = libvpx_srcs_x86
198 } else if (cpu_arch == "x64") { 198 } else if (current_cpu == "x64") {
199 if (is_msan) { 199 if (is_msan) {
200 sources = libvpx_srcs_generic 200 sources = libvpx_srcs_generic
201 } else { 201 } else {
202 sources = libvpx_srcs_x86_64 202 sources = libvpx_srcs_x86_64
203 } 203 }
204 } else if (cpu_arch == "mipsel") { 204 } else if (current_cpu == "mipsel") {
205 sources = libvpx_srcs_mips 205 sources = libvpx_srcs_mips
206 } else if (cpu_arch == "arm") { 206 } else if (current_cpu == "arm") {
207 if (arm_use_neon) { 207 if (arm_use_neon) {
208 sources = libvpx_srcs_arm_neon 208 sources = libvpx_srcs_arm_neon
209 } else if (is_android) { 209 } else if (is_android) {
210 sources = libvpx_srcs_arm_neon_cpu_detect 210 sources = libvpx_srcs_arm_neon_cpu_detect
211 } else { 211 } else {
212 sources = libvpx_srcs_arm 212 sources = libvpx_srcs_arm
213 } 213 }
214 } else if (cpu_arch == "arm64") { 214 } else if (current_cpu == "arm64") {
215 sources = libvpx_srcs_arm64 215 sources = libvpx_srcs_arm64
216 } 216 }
217 217
218 # gn orders flags on a target before flags from configs. The default config 218 # gn orders flags on a target before flags from configs. The default config
219 # adds -Wall, and these flags have to be after -Wall -- so they need to come 219 # adds -Wall, and these flags have to be after -Wall -- so they need to come
220 # from a config and can't be on the target directly. 220 # from a config and can't be on the target directly.
221 config("libvpx_warnings") { 221 config("libvpx_warnings") {
222 if (is_clang) { 222 if (is_clang) {
223 cflags = [ "-Wno-conversion" ] 223 cflags = [ "-Wno-conversion" ]
224 } 224 }
225 } 225 }
226 226
227 configs += [ ":libvpx_config" ] 227 configs += [ ":libvpx_config" ]
228 configs -= [ "//build/config/compiler:chromium_code" ] 228 configs -= [ "//build/config/compiler:chromium_code" ]
229 configs += [ "//build/config/compiler:no_chromium_code" ] 229 configs += [ "//build/config/compiler:no_chromium_code" ]
230 configs += [ ":libvpx_warnings" ] 230 configs += [ ":libvpx_warnings" ]
231 deps = [] 231 deps = []
232 if (cpu_arch == "x86" || (cpu_arch == "x64" && !is_msan)) { 232 if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) {
233 deps += [ 233 deps += [
234 ":libvpx_yasm", 234 ":libvpx_yasm",
235 ":libvpx_intrinsics_mmx", 235 ":libvpx_intrinsics_mmx",
236 ":libvpx_intrinsics_sse2", 236 ":libvpx_intrinsics_sse2",
237 ":libvpx_intrinsics_ssse3", 237 ":libvpx_intrinsics_ssse3",
238 ":libvpx_intrinsics_sse4_1", 238 ":libvpx_intrinsics_sse4_1",
239 ":libvpx_intrinsics_avx2", 239 ":libvpx_intrinsics_avx2",
240 ] 240 ]
241 } 241 }
242 if (cpu_arch_full == "arm-neon-cpu-detect") { 242 if (cpu_arch_full == "arm-neon-cpu-detect") {
243 deps += [ ":libvpx_intrinsics_neon" ] 243 deps += [ ":libvpx_intrinsics_neon" ]
244 } 244 }
245 if (is_android) { 245 if (is_android) {
246 deps += [ "//third_party/android_tools:cpu_features" ] 246 deps += [ "//third_party/android_tools:cpu_features" ]
247 } 247 }
248 if (cpu_arch == "arm") { 248 if (current_cpu == "arm") {
249 deps += [ ":libvpx_assembly_arm" ] 249 deps += [ ":libvpx_assembly_arm" ]
250 } 250 }
251 251
252 public_configs = [ ":libvpx_external_config" ] 252 public_configs = [ ":libvpx_external_config" ]
253 } 253 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698