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