blob: 8d8e7aae2e911f6e2beb581806735b81dc037f6f [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
Jordan Bayles7bc7f102019-05-30 12:38:43 -070074 configs += [ "../build:allow_build_from_embedder" ]
75
Jordan Baylesaa021ce2019-05-29 13:57:44 -070076 deps = [
77 ":platform",
78 ]
79}
80
Jordan Bayles9ade4152019-05-08 17:03:24 -070081source_set("default_logger") {
82 sources = [
83 "base/logging.cc",
84 ]
85
86 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070087 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070088 }
89
90 configs += [ "../build:allow_build_from_embedder" ]
91
92 deps = [
93 "../osp_base",
94 "../third_party/abseil",
95 ]
96}
97
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070098source_set("platform_unittests") {
99 testonly = true
100
101 sources = [
102 "api/time_unittest.cc",
103 ]
104
105 # The unit tests in base/ assume the standalone implementation is being used.
106 # Exclude them if an embedder is providing the implementation.
107 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700108 sources += [
109 "base/task_runner_unittest.cc",
110 "base/time_unittest.cc",
111 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700112 }
113
114 deps = [
115 ":platform",
btolsch4666ed22019-04-25 15:58:07 -0700116 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700117 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700118
119 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700120}