blob: 92a43c4a354e4a8ca6ee750111de453207d2a021 [file] [log] [blame]
btolsch9d6900c2018-05-30 18:22:53 -07001# Copyright 2018 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Yuri Wiitalab2d13232019-02-04 18:07:28 -08005import("//build_overrides/build.gni")
btolsch5292c942018-07-26 00:06:22 -07006
Yuri Wiitalab2d13232019-02-04 18:07:28 -08007source_set("platform") {
8 defines = []
9
10 sources = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080011 "api/event_waiter.cc",
12 "api/event_waiter.h",
13 "api/logging.cc",
14 "api/logging.h",
15 "api/network_interface.cc",
16 "api/network_interface.h",
17 "api/socket.h.",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070018 "api/task_runner.h",
19 "api/task_runner_factory.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080020 "api/time.h",
btolsch2f2e7fa2019-03-29 16:48:49 -070021 "base/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080022 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080023
btolsch2f2e7fa2019-03-29 16:48:49 -070024 deps = []
Jordan Bayles9eb09742019-01-15 14:04:52 -080025 public_deps = [
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070026 "../osp_base",
btolsch2f2e7fa2019-03-29 16:48:49 -070027 "../third_party/abseil",
Jordan Bayles9eb09742019-01-15 14:04:52 -080028 ]
btolsch2f2e7fa2019-03-29 16:48:49 -070029 configs += [ "..:root_config_overrides" ]
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070030 allow_circular_includes_from = [ "../osp_base" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080031
32 if (build_with_chromium) {
btolsch2f2e7fa2019-03-29 16:48:49 -070033 deps += [ ":chromium" ]
34 public_deps += [ "//base" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080035 } else { # !build_with_chromium
btolschc92ba2f2019-04-10 11:46:01 -070036 sources += [
btolsch4666ed22019-04-25 15:58:07 -070037 "base/event_loop.cc",
38 "base/event_loop.h",
btolschc92ba2f2019-04-10 11:46:01 -070039 "base/logging.cc",
40 "base/task_runner_factory.cc",
41 "base/task_runner_impl.cc",
42 "base/task_runner_impl.h",
43 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080044
45 if (is_linux) {
46 sources += [ "linux/network_interface.cc" ]
47 } else if (is_mac) {
48 defines += [
49 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
50 "__APPLE_USE_RFC_3542",
51 ]
52 sources += [ "mac/network_interface.cc" ]
53 }
54
55 if (is_posix) {
56 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080057 "posix/event_waiter.cc",
58 "posix/logging.cc",
59 "posix/socket.cc",
60 "posix/socket.h",
61 ]
62 }
63 }
btolsch9d6900c2018-05-30 18:22:53 -070064}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070065
btolsch2f2e7fa2019-03-29 16:48:49 -070066if (build_with_chromium) {
67 source_set("chromium") {
68 sources = [
69 "chromium/logging.cc",
70 ]
71
72 deps = [
73 "../third_party/abseil",
74 "//base",
75 ]
76
77 configs += [ "..:root_config_overrides" ]
78 }
79}
80
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070081source_set("platform_unittests") {
82 testonly = true
83
84 sources = [
85 "api/time_unittest.cc",
86 ]
87
88 # The unit tests in base/ assume the standalone implementation is being used.
89 # Exclude them if an embedder is providing the implementation.
90 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070091 sources += [
92 "base/task_runner_unittest.cc",
93 "base/time_unittest.cc",
94 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070095 }
96
97 deps = [
98 ":platform",
btolsch4666ed22019-04-25 15:58:07 -070099 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700100 ]
btolsch2f2e7fa2019-03-29 16:48:49 -0700101
102 configs += [ "..:root_config_overrides" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700103}