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

Side by Side Diff: third_party/openh264/BUILD.gn

Issue 2645293002: Reland of Add assembly for x86 to OpenH264 encoder (Closed)
Patch Set: Moved CPU guard from target to surrounding if Created 3 years, 11 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 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 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) && (target_cpu == "x86" || target_cpu == "x64")) {
39 yasm_assemble("openh264_common_yasm") {
40 include_dirs = openh264_common_include_dirs
41 sources = openh264_common_sources_asm_x86
42 if (target_cpu == "x86") {
43 defines = [ "X86_32" ]
44 } else { # x64
45 if (is_mac) {
46 defines = [
47 "PREFIX",
48 "UNIX64",
49 ]
50 } else if (is_win) {
51 defines = [ "WIN64" ]
52 } else if (is_linux) {
53 defines = [ "UNIX64" ]
54 }
55 }
56 }
57
58 yasm_assemble("openh264_processing_yasm") {
59 include_dirs = openh264_processing_include_dirs
60 include_dirs += [ "./src/codec/common/x86" ]
61 sources = openh264_processing_sources_asm_x86
62 if (target_cpu == "x86") {
63 defines = [ "X86_32" ]
64 } else { # x64
65 if (is_mac) {
66 defines = [
67 "PREFIX",
68 "UNIX64",
69 ]
70 } else if (is_win) {
71 defines = [ "WIN64" ]
72 } else if (is_linux) {
73 defines = [ "UNIX64" ]
74 }
75 }
76 }
77
78 yasm_assemble("openh264_encoder_yasm") {
79 include_dirs = openh264_encoder_include_dirs
80 include_dirs += [ "./src/codec/common/x86" ]
81 sources = openh264_encoder_sources_asm_x86
82 if (target_cpu == "x86") {
83 defines = [ "X86_32" ]
84 } else { # x64
85 if (is_mac) {
86 defines = [
87 "PREFIX",
88 "UNIX64",
89 ]
90 } else if (is_win) {
91 defines = [ "WIN64" ]
92 } else if (is_linux) {
93 defines = [ "UNIX64" ]
94 }
95 }
96 }
97 } # if (is_win || is_linux)
98
31 source_set("common") { 99 source_set("common") {
32 sources = openh264_common_sources 100 sources = openh264_common_sources
33 include_dirs = openh264_common_include_dirs 101 include_dirs = openh264_common_include_dirs
34 102
35 configs -= [ "//build/config/compiler:chromium_code" ] 103 configs -= [ "//build/config/compiler:chromium_code" ]
36 configs += [ "//build/config/compiler:no_chromium_code" ] 104 configs += [ "//build/config/compiler:no_chromium_code" ]
37 configs += [ ":config" ] 105 configs += [ ":config" ]
38 deps = [] 106 deps = []
107 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) {
108 defines = [ "X86_ASM" ]
109 deps += [ ":openh264_common_yasm" ]
110 }
39 if (is_android) { 111 if (is_android) {
40 deps += [ 112 deps += [
41 # Defines "android_get/setCpu..." functions. The original OpenH264 build 113 # Defines "android_get/setCpu..." functions. The original OpenH264 build
42 # files replaces these using macros for "wels_..." versions of the same 114 # 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> 115 # functions. We do not have access to these and use the <cpu-features.h>
44 # ones instead. 116 # ones instead.
45 "//third_party/android_tools:cpu_features", 117 "//third_party/android_tools:cpu_features",
46 ] 118 ]
47 } 119 }
48 } 120 }
49 121
50 source_set("processing") { 122 source_set("processing") {
51 sources = openh264_processing_sources 123 sources = openh264_processing_sources
52 include_dirs = openh264_processing_include_dirs 124 include_dirs = openh264_processing_include_dirs
53 125
54 configs -= [ "//build/config/compiler:chromium_code" ] 126 configs -= [ "//build/config/compiler:chromium_code" ]
55 configs += [ "//build/config/compiler:no_chromium_code" ] 127 configs += [ "//build/config/compiler:no_chromium_code" ]
56 configs += [ ":config" ] 128 configs += [ ":config" ]
57 deps = [ 129 deps = [
58 ":common", 130 ":common",
59 ] 131 ]
132 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) {
133 defines = [ "X86_ASM" ]
134 deps += [ ":openh264_processing_yasm" ]
135 }
60 } 136 }
61 137
62 source_set("encoder") { 138 source_set("encoder") {
63 sources = openh264_encoder_sources 139 sources = openh264_encoder_sources
64 include_dirs = openh264_encoder_include_dirs 140 include_dirs = openh264_encoder_include_dirs
65 141
66 configs -= [ "//build/config/compiler:chromium_code" ] 142 configs -= [ "//build/config/compiler:chromium_code" ]
67 configs += [ "//build/config/compiler:no_chromium_code" ] 143 configs += [ "//build/config/compiler:no_chromium_code" ]
68 configs += [ ":config" ] 144 configs += [ ":config" ]
69 145
70 # TODO: Remove after fixing always-true condition 146 # TODO: Remove after fixing always-true condition
71 # third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp:142. 147 # third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp:142.
72 if (is_clang) { 148 if (is_clang) {
73 configs -= [ "//build/config/clang:extra_warnings" ] 149 configs -= [ "//build/config/clang:extra_warnings" ]
74 } 150 }
75 deps = [ 151 deps = [
76 ":common", 152 ":common",
77 ":processing", 153 ":processing",
78 ] 154 ]
155 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) {
156 defines = [ "X86_ASM" ]
157 deps += [ ":openh264_encoder_yasm" ]
158 }
79 } 159 }
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