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

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

Issue 2585733002: Add assembly for x86 to OpenH264 encoder (Closed)
Patch Set: Enable Linux for real this time 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) {
39 yasm_assemble("openh264_common_yasm") {
40 include_dirs = openh264_common_include_dirs
41 assert(target_cpu == "x86" || target_cpu == "x64",
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
31 source_set("common") { 105 source_set("common") {
32 sources = openh264_common_sources 106 sources = openh264_common_sources
33 include_dirs = openh264_common_include_dirs 107 include_dirs = openh264_common_include_dirs
34 108
35 configs -= [ "//build/config/compiler:chromium_code" ] 109 configs -= [ "//build/config/compiler:chromium_code" ]
36 configs += [ "//build/config/compiler:no_chromium_code" ] 110 configs += [ "//build/config/compiler:no_chromium_code" ]
37 configs += [ ":config" ] 111 configs += [ ":config" ]
38 deps = [] 112 deps = []
113 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) {
114 defines = [ "X86_ASM" ]
115 deps += [ ":openh264_common_yasm" ]
116 }
39 if (is_android) { 117 if (is_android) {
40 deps += [ 118 deps += [
41 # Defines "android_get/setCpu..." functions. The original OpenH264 build 119 # Defines "android_get/setCpu..." functions. The original OpenH264 build
42 # files replaces these using macros for "wels_..." versions of the same 120 # 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> 121 # functions. We do not have access to these and use the <cpu-features.h>
44 # ones instead. 122 # ones instead.
45 "//third_party/android_tools:cpu_features", 123 "//third_party/android_tools:cpu_features",
46 ] 124 ]
47 } 125 }
48 } 126 }
49 127
50 source_set("processing") { 128 source_set("processing") {
51 sources = openh264_processing_sources 129 sources = openh264_processing_sources
52 include_dirs = openh264_processing_include_dirs 130 include_dirs = openh264_processing_include_dirs
53 131
54 configs -= [ "//build/config/compiler:chromium_code" ] 132 configs -= [ "//build/config/compiler:chromium_code" ]
55 configs += [ "//build/config/compiler:no_chromium_code" ] 133 configs += [ "//build/config/compiler:no_chromium_code" ]
56 configs += [ ":config" ] 134 configs += [ ":config" ]
57 deps = [ 135 deps = [
58 ":common", 136 ":common",
59 ] 137 ]
138 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) {
139 defines = [ "X86_ASM" ]
140 deps += [ ":openh264_processing_yasm" ]
141 }
60 } 142 }
61 143
62 source_set("encoder") { 144 source_set("encoder") {
63 sources = openh264_encoder_sources 145 sources = openh264_encoder_sources
64 include_dirs = openh264_encoder_include_dirs 146 include_dirs = openh264_encoder_include_dirs
65 147
66 configs -= [ "//build/config/compiler:chromium_code" ] 148 configs -= [ "//build/config/compiler:chromium_code" ]
67 configs += [ "//build/config/compiler:no_chromium_code" ] 149 configs += [ "//build/config/compiler:no_chromium_code" ]
68 configs += [ ":config" ] 150 configs += [ ":config" ]
69 151
70 # TODO: Remove after fixing always-true condition 152 # TODO: Remove after fixing always-true condition
71 # third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp:142. 153 # third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp:142.
72 if (is_clang) { 154 if (is_clang) {
73 configs -= [ "//build/config/clang:extra_warnings" ] 155 configs -= [ "//build/config/clang:extra_warnings" ]
74 } 156 }
75 deps = [ 157 deps = [
76 ":common", 158 ":common",
77 ":processing", 159 ":processing",
78 ] 160 ]
161 if ((is_win || is_linux) && (target_cpu == "x86" || target_cpu == "x64")) {
162 defines = [ "X86_ASM" ]
163 deps += [ ":openh264_encoder_yasm" ]
164 }
79 } 165 }
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