OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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("//third_party/openh264/openh264_args.gni") | 5 import("//third_party/openh264/openh264_args.gni") |
6 import("//third_party/openh264/openh264_sources.gni") | 6 import("//third_party/openh264/openh264_sources.gni") |
7 import("//third_party/yasm/yasm_assemble.gni") | |
8 | 7 |
9 # Config shared by all openh264 targets. | 8 # Config shared by all openh264 targets. |
10 config("config") { | 9 config("config") { |
11 cflags = [] | 10 cflags = [] |
12 defines = [] | 11 defines = [] |
13 | 12 |
14 # GCC and clang flags. MSVS (is_win && !is_clang) does not use cflags. | 13 # GCC and clang flags. MSVS (is_win && !is_clang) does not use cflags. |
15 if (!is_win || is_clang) { | 14 if (!is_win || is_clang) { |
16 cflags += [ | 15 cflags += [ |
17 "-Wno-format", | 16 "-Wno-format", |
18 "-Wno-header-hygiene", | 17 "-Wno-header-hygiene", |
19 "-Wno-unused-function", | 18 "-Wno-unused-function", |
20 "-Wno-unused-value", | 19 "-Wno-unused-value", |
21 ] | 20 ] |
22 } | 21 } |
23 | 22 |
24 # Platform-specific defines. | 23 # Platform-specific defines. |
25 if (is_android) { | 24 if (is_android) { |
26 # Android NDK is necessary for its cpufeatures and this define is what | 25 # Android NDK is necessary for its cpufeatures and this define is what |
27 # OpenH264 code uses to check if it should be used. | 26 # OpenH264 code uses to check if it should be used. |
28 defines += [ "ANDROID_NDK" ] | 27 defines += [ "ANDROID_NDK" ] |
29 } | 28 } |
30 } | 29 } |
31 | 30 |
32 # YASM assembly is only checked to be working on Windows and Linux. | |
33 # Mac is known to fail certain tests when building, but actual assembly | |
34 # is believed to work. | |
35 # | |
36 # This IF statement will make the targets visible only on specific builds, | |
37 # which will lead to failures on other platforms if accidentally invoked. | |
38 if (is_win || is_linux) { | |
39 yasm_assemble("openh264_common_yasm") { | |
40 include_dirs = openh264_common_include_dirs | |
41 assert(target_cpu == "x86" || target_cpu == "x64", | |
kjellander_chromium
2017/01/23 07:28:25
This assertion fails for the linux_arm bot when We
| |
42 "Assembly not defined for this CPU") | |
43 sources = openh264_common_sources_asm_x86 | |
44 if (target_cpu == "x86") { | |
45 defines = [ "X86_32" ] | |
46 } else { # x64 | |
47 if (is_mac) { | |
48 defines = [ | |
49 "PREFIX", | |
50 "UNIX64", | |
51 ] | |
52 } else if (is_win) { | |
53 defines = [ "WIN64" ] | |
54 } else if (is_linux) { | |
55 defines = [ "UNIX64" ] | |
56 } | |
57 } | |
58 } | |
59 | |
60 yasm_assemble("openh264_processing_yasm") { | |
61 include_dirs = openh264_processing_include_dirs | |
62 include_dirs += [ "./src/codec/common/x86" ] | |
63 assert(target_cpu == "x86" || target_cpu == "x64", | |
64 "Assembly not defined for this CPU") | |
65 sources = openh264_processing_sources_asm_x86 | |
66 if (target_cpu == "x86") { | |
67 defines = [ "X86_32" ] | |
68 } else { # x64 | |
69 if (is_mac) { | |
70 defines = [ | |
71 "PREFIX", | |
72 "UNIX64", | |
73 ] | |
74 } else if (is_win) { | |
75 defines = [ "WIN64" ] | |
76 } else if (is_linux) { | |
77 defines = [ "UNIX64" ] | |
78 } | |
79 } | |
80 } | |
81 | |
82 yasm_assemble("openh264_encoder_yasm") { | |
83 include_dirs = openh264_encoder_include_dirs | |
84 include_dirs += [ "./src/codec/common/x86" ] | |
85 assert(target_cpu == "x86" || target_cpu == "x64", | |
86 "Assembly not defined for this CPU") | |
87 sources = openh264_encoder_sources_asm_x86 | |
88 if (target_cpu == "x86") { | |
89 defines = [ "X86_32" ] | |
90 } else { # x64 | |
91 if (is_mac) { | |
92 defines = [ | |
93 "PREFIX", | |
94 "UNIX64", | |
95 ] | |
96 } else if (is_win) { | |
97 defines = [ "WIN64" ] | |
98 } else if (is_linux) { | |
99 defines = [ "UNIX64" ] | |
100 } | |
101 } | |
102 } | |
103 } # if (is_win || is_linux) | |
104 | |
105 source_set("common") { | 31 source_set("common") { |
106 sources = openh264_common_sources | 32 sources = openh264_common_sources |
107 include_dirs = openh264_common_include_dirs | 33 include_dirs = openh264_common_include_dirs |
108 | 34 |
109 configs -= [ "//build/config/compiler:chromium_code" ] | 35 configs -= [ "//build/config/compiler:chromium_code" ] |
110 configs += [ "//build/config/compiler:no_chromium_code" ] | 36 configs += [ "//build/config/compiler:no_chromium_code" ] |
111 configs += [ ":config" ] | 37 configs += [ ":config" ] |
112 deps = [] | 38 deps = [] |
113 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) { | |
114 defines = [ "X86_ASM" ] | |
115 deps += [ ":openh264_common_yasm" ] | |
116 } | |
117 if (is_android) { | 39 if (is_android) { |
118 deps += [ | 40 deps += [ |
119 # Defines "android_get/setCpu..." functions. The original OpenH264 build | 41 # Defines "android_get/setCpu..." functions. The original OpenH264 build |
120 # files replaces these using macros for "wels_..." versions of the same | 42 # files replaces these using macros for "wels_..." versions of the same |
121 # functions. We do not have access to these and use the <cpu-features.h> | 43 # functions. We do not have access to these and use the <cpu-features.h> |
122 # ones instead. | 44 # ones instead. |
123 "//third_party/android_tools:cpu_features", | 45 "//third_party/android_tools:cpu_features", |
124 ] | 46 ] |
125 } | 47 } |
126 } | 48 } |
127 | 49 |
128 source_set("processing") { | 50 source_set("processing") { |
129 sources = openh264_processing_sources | 51 sources = openh264_processing_sources |
130 include_dirs = openh264_processing_include_dirs | 52 include_dirs = openh264_processing_include_dirs |
131 | 53 |
132 configs -= [ "//build/config/compiler:chromium_code" ] | 54 configs -= [ "//build/config/compiler:chromium_code" ] |
133 configs += [ "//build/config/compiler:no_chromium_code" ] | 55 configs += [ "//build/config/compiler:no_chromium_code" ] |
134 configs += [ ":config" ] | 56 configs += [ ":config" ] |
135 deps = [ | 57 deps = [ |
136 ":common", | 58 ":common", |
137 ] | 59 ] |
138 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) { | |
139 defines = [ "X86_ASM" ] | |
140 deps += [ ":openh264_processing_yasm" ] | |
141 } | |
142 } | 60 } |
143 | 61 |
144 source_set("encoder") { | 62 source_set("encoder") { |
145 sources = openh264_encoder_sources | 63 sources = openh264_encoder_sources |
146 include_dirs = openh264_encoder_include_dirs | 64 include_dirs = openh264_encoder_include_dirs |
147 | 65 |
148 configs -= [ "//build/config/compiler:chromium_code" ] | 66 configs -= [ "//build/config/compiler:chromium_code" ] |
149 configs += [ "//build/config/compiler:no_chromium_code" ] | 67 configs += [ "//build/config/compiler:no_chromium_code" ] |
150 configs += [ ":config" ] | 68 configs += [ ":config" ] |
151 | 69 |
152 # TODO: Remove after fixing always-true condition | 70 # TODO: Remove after fixing always-true condition |
153 # third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp:142. | 71 # third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp:142. |
154 if (is_clang) { | 72 if (is_clang) { |
155 configs -= [ "//build/config/clang:extra_warnings" ] | 73 configs -= [ "//build/config/clang:extra_warnings" ] |
156 } | 74 } |
157 deps = [ | 75 deps = [ |
158 ":common", | 76 ":common", |
159 ":processing", | 77 ":processing", |
160 ] | 78 ] |
161 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) { | |
162 defines = [ "X86_ASM" ] | |
163 deps += [ ":openh264_encoder_yasm" ] | |
164 } | |
165 } | 79 } |
OLD | NEW |