blob: f92c5a553ada092b18f2e80976ec486b6f8bfa4c [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") {
Yuri Wiitalab2d13232019-02-04 18:07:28 -08008 sources = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -08009 "api/event_waiter.cc",
10 "api/event_waiter.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080011 "api/logging.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070012 "api/logging_util.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080013 "api/network_interface.cc",
14 "api/network_interface.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070015 "api/task_runner.h",
16 "api/task_runner_factory.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080017 "api/time.h",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070018 "api/tls_socket.h",
19 "api/tls_socket_creds.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070020 "api/udp_socket.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
24 public_deps = [
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070025 "../osp_base",
btolsch2f2e7fa2019-03-29 16:48:49 -070026 "../third_party/abseil",
Jordan Bayles9eb09742019-01-15 14:04:52 -080027 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070028
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070029 allow_circular_includes_from = [ "../osp_base" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070030
Jordan Baylesa80724b2019-05-02 17:17:26 -070031 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080032
Jordan Baylesa80724b2019-05-02 17:17:26 -070033 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070034 sources += [
btolsch4666ed22019-04-25 15:58:07 -070035 "base/event_loop.cc",
36 "base/event_loop.h",
btolschc92ba2f2019-04-10 11:46:01 -070037 "base/task_runner_factory.cc",
38 "base/task_runner_impl.cc",
39 "base/task_runner_impl.h",
40 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080041
42 if (is_linux) {
43 sources += [ "linux/network_interface.cc" ]
44 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070045 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080046 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
47 "__APPLE_USE_RFC_3542",
48 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070049
Yuri Wiitalab2d13232019-02-04 18:07:28 -080050 sources += [ "mac/network_interface.cc" ]
51 }
52
53 if (is_posix) {
54 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080055 "posix/event_waiter.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070056 "posix/udp_socket.cc",
57 "posix/udp_socket.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080058 ]
59 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070060
61 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070062 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070063 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080064 }
btolsch9d6900c2018-05-30 18:22:53 -070065}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070066
Jordan Baylesaa021ce2019-05-29 13:57:44 -070067source_set("test") {
68 testonly = true
69 sources = [
70 "test/fake_clock.cc",
71 "test/fake_clock.h",
72 ]
73
74 deps = [
75 ":platform",
76 ]
77}
78
Jordan Bayles9ade4152019-05-08 17:03:24 -070079source_set("default_logger") {
80 sources = [
81 "base/logging.cc",
82 ]
83
84 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070085 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070086 }
87
88 configs += [ "../build:allow_build_from_embedder" ]
89
90 deps = [
91 "../osp_base",
92 "../third_party/abseil",
93 ]
94}
95
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070096source_set("platform_unittests") {
97 testonly = true
98
99 sources = [
100 "api/time_unittest.cc",
101 ]
102
103 # The unit tests in base/ assume the standalone implementation is being used.
104 # Exclude them if an embedder is providing the implementation.
105 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700106 sources += [
107 "base/task_runner_unittest.cc",
108 "base/time_unittest.cc",
109 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700110 }
111
112 deps = [
113 ":platform",
btolsch4666ed22019-04-25 15:58:07 -0700114 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700115 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700116
117 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700118}