blob: 8d04731ea1fa316809503defdb708b1690814fd5 [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",
btolsch4051e722019-06-07 16:15:17 -070015 "api/network_runner.cc",
16 "api/network_runner.h",
17 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070018 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080019 "api/time.h",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070020 "api/tls_socket.h",
21 "api/tls_socket_creds.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070022 "api/udp_socket.h",
btolsch4051e722019-06-07 16:15:17 -070023 "api/upd_callbacks.h",
Jordan Baylesb9262f42019-05-30 14:10:02 -070024 "base/ssl_context.cc",
25 "base/ssl_context.h",
btolsch2f2e7fa2019-03-29 16:48:49 -070026 "base/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080027 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080028
29 public_deps = [
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070030 "../osp_base",
btolsch2f2e7fa2019-03-29 16:48:49 -070031 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070032 "../third_party/boringssl",
Jordan Bayles9eb09742019-01-15 14:04:52 -080033 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070034
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070035 allow_circular_includes_from = [ "../osp_base" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070036
Jordan Baylesa80724b2019-05-02 17:17:26 -070037 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080038
Jordan Baylesa80724b2019-05-02 17:17:26 -070039 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070040 sources += [
btolsch4666ed22019-04-25 15:58:07 -070041 "base/event_loop.cc",
42 "base/event_loop.h",
btolschc92ba2f2019-04-10 11:46:01 -070043 "base/task_runner_impl.cc",
44 "base/task_runner_impl.h",
45 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080046
47 if (is_linux) {
48 sources += [ "linux/network_interface.cc" ]
49 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070050 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080051 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
52 "__APPLE_USE_RFC_3542",
53 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070054
Yuri Wiitalab2d13232019-02-04 18:07:28 -080055 sources += [ "mac/network_interface.cc" ]
56 }
57
58 if (is_posix) {
59 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080060 "posix/event_waiter.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070061 "posix/udp_socket.cc",
62 "posix/udp_socket.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080063 ]
64 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070065
66 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070067 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070068 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080069 }
btolsch9d6900c2018-05-30 18:22:53 -070070}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070071
Jordan Baylesaa021ce2019-05-29 13:57:44 -070072source_set("test") {
73 testonly = true
74 sources = [
75 "test/fake_clock.cc",
76 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -070077 "test/fake_task_runner.cc",
78 "test/fake_task_runner.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -070079 ]
80
Jordan Bayles7bc7f102019-05-30 12:38:43 -070081 configs += [ "../build:allow_build_from_embedder" ]
82
Jordan Baylesaa021ce2019-05-29 13:57:44 -070083 deps = [
84 ":platform",
85 ]
86}
87
Jordan Bayles9ade4152019-05-08 17:03:24 -070088source_set("default_logger") {
89 sources = [
90 "base/logging.cc",
91 ]
92
93 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070094 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070095 }
96
97 configs += [ "../build:allow_build_from_embedder" ]
98
99 deps = [
100 "../osp_base",
101 "../third_party/abseil",
102 ]
103}
104
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700105source_set("platform_unittests") {
106 testonly = true
107
108 sources = [
109 "api/time_unittest.cc",
Jordan Baylesb9262f42019-05-30 14:10:02 -0700110 "base/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700111 ]
112
113 # The unit tests in base/ assume the standalone implementation is being used.
114 # Exclude them if an embedder is providing the implementation.
115 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700116 sources += [
btolsch4051e722019-06-07 16:15:17 -0700117 "base/task_runner_impl_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700118 "base/time_unittest.cc",
119 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700120 }
121
122 deps = [
123 ":platform",
btolsch4666ed22019-04-25 15:58:07 -0700124 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700125 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700126
127 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700128}