blob: 2c1fafbaeff78efc4ddc2943c57abc86368b190a [file] [log] [blame]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +00001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +00009# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
10
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000011import("//build/config/crypto.gni")
12import("//build/config/linux/pkg_config.gni")
13import("build/webrtc.gni")
14
15# Contains the defines and includes in common.gypi that are duplicated both as
16# target_defaults and direct_dependent_settings.
17config("common_inherited_config") {
18 defines = []
19 if (build_with_mozilla) {
20 defines += [ "WEBRTC_MOZILLA_BUILD" ]
21 }
22 if (build_with_chromium) {
23 defines = [
24 "WEBRTC_CHROMIUM_BUILD",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000025 ]
26 include_dirs = [
27 # overrides must be included first as that is the mechanism for
28 # selecting the override headers in Chromium.
29 "overrides",
30 # Allow includes to be prefixed with webrtc/ in case it is not an
31 # immediate subdirectory of the top-level.
32 "..",
33 ]
34 }
35 if (is_posix) {
36 defines += [ "WEBRTC_POSIX" ]
37 }
38 if (is_ios) {
39 defines += [
40 "WEBRTC_MAC",
41 "WEBRTC_IOS",
42 ]
43 }
44 if (is_linux) {
45 defines += [ "WEBRTC_LINUX" ]
46 }
47 if (is_mac) {
48 defines += [ "WEBRTC_MAC" ]
49 }
50 if (is_win) {
51 defines += [ "WEBRTC_WIN" ]
52 }
53 if (is_android) {
54 defines += [
55 "WEBRTC_LINUX",
56 "WEBRTC_ANDROID",
57 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000058 }
59}
60
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000061if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +000062 pkg_config("dbus-glib") {
63 packages = [ "dbus-glib-1" ]
64 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000065}
66
67config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:49 +000068 cflags = []
69 cflags_cc = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000070 if (rtc_restrict_logging) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000071 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
72 }
73
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000074 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000075 defines += [ "HAVE_DBUS_GLIB" ]
76 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
77 # is still not found even if the execution of
78 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
79 # dirs on Linux.
80 all_dependent_configs = [ "dbus-glib" ]
81 }
82
brettw@chromium.org9fe11012014-09-09 19:15:33 +000083 if (build_with_chromium) {
84 defines += [ "LOGGING_INSIDE_WEBRTC" ]
85 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000086 if (is_posix) {
87 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
88 # for targets that can handle it. For Android/arm64 right now
89 # there will be an "enumeral and non-enumeral type in conditional
90 # expression" warning in android_tools/ndk_experimental"s version
91 # of stlport.
92 # See: https://code.google.com/p/chromium/issues/detail?id=379699
kjellander@webrtc.org72273912015-02-23 19:08:31 +000093 if (current_cpu != "arm64" || !is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000094 cflags = [
95 "-Wextra",
96 # We need to repeat some flags from Chromium"s common.gypi
97 # here that get overridden by -Wextra.
98 "-Wno-unused-parameter",
99 "-Wno-missing-field-initializers",
100 "-Wno-strict-overflow",
101 ]
102 cflags_cc = [
103 "-Wnon-virtual-dtor",
104 # This is enabled for clang; enable for gcc as well.
105 "-Woverloaded-virtual",
106 ]
107 }
108 }
109
110 if (is_clang) {
111 cflags += [ "-Wthread-safety" ]
112 }
113 }
114
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000115 if (current_cpu == "arm64") {
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000116 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000117 # TODO(zhongwei) Defining an unique WEBRTC_NEON and
118 # distinguishing ARMv7 NEON and ARM64 NEON by
119 # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better.
120
121 # This macro is used to distinguish ARMv7 NEON and ARM64 NEON
122 defines += [ "WEBRTC_ARCH_ARM64_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000123 }
124
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000125 if (current_cpu == "arm") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000126 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000127 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000128 defines += [ "WEBRTC_ARCH_ARM_V7" ]
129 if (arm_use_neon) {
130 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000131 } else if (is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000132 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
133 }
134 }
135 }
136
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000137 if (current_cpu == "mipsel") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000138 defines += [ "MIPS32_LE" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000139 if (mips_float_abi == "hard") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000140 defines += [ "MIPS_FPU_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000141 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56 +0000142 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000143 defines += [ "MIPS32_R2_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000144 }
145 if (mips_dsp_rev == 1) {
146 defines += [ "MIPS_DSP_R1_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000147 } else if (mips_dsp_rev == 2) {
148 defines += [
149 "MIPS_DSP_R1_LE",
150 "MIPS_DSP_R2_LE",
151 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000152 }
153 }
154
155 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
156 # default warnings set in build/config/compiler/BUILD.gn.
157
158 if (is_android && is_clang) {
159 # The Android NDK doesn"t provide optimized versions of these
160 # functions. Ensure they are disabled for all compilers.
161 cflags += [
162 "-fno-builtin-cos",
163 "-fno-builtin-sin",
164 "-fno-builtin-cosf",
165 "-fno-builtin-sinf",
166 ]
167 }
168}
169
kjellander@webrtc.org14ea50a2014-11-12 07:56:21 +0000170source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000171 sources = [
172 "call.h",
173 "config.h",
174 "experiments.h",
175 "frame_callback.h",
176 "transport.h",
177 ]
178
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000179 configs += [ ":common_config" ]
180 public_configs = [ ":common_inherited_config"]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000181
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000182 deps = [
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000183 ":webrtc_common",
kjellander@webrtc.orgc429b822015-01-21 20:22:33 +0000184 "base:rtc_base",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000185 "common_audio",
186 "common_video",
187 "modules/audio_coding",
188 "modules/audio_conference_mixer",
189 "modules/audio_device",
190 "modules/audio_processing",
191 "modules/bitrate_controller",
192 "modules/desktop_capture",
193 "modules/media_file",
194 "modules/rtp_rtcp",
195 "modules/utility",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000196 "modules/video_coding",
197 "modules/video_processing",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000198 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000199 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000200 "video",
201 "video_engine",
202 "voice_engine",
203 ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000204
205 if (build_with_chromium) {
206 deps += [
207 "modules/video_capture",
208 "modules/video_render",
209 ]
210 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000211}
212
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000213if (!build_with_chromium) {
214 executable("webrtc_tests") {
215 testonly = true
216 deps = [
217 ":webrtc",
218 "modules/video_render:video_render_internal_impl",
219 "modules/video_capture:video_capture_internal_impl",
220 "test",
221 ]
222 }
223}
224
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000225source_set("webrtc_common") {
226 sources = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000227 "common_types.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000228 "common_types.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000229 "config.h",
230 "config.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000231 "engine_configurations.h",
232 "typedefs.h",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000233 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000234
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000235 configs += [ ":common_config" ]
236 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000237}
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000238
239source_set("gtest_prod") {
240 sources = [
241 "test/testsupport/gtest_prod_util.h",
242 ]
243}