blob: e3eb1509a6b7d6199f35065f3f7e3a163c79ee81 [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 Baylesad2d2cd2019-05-22 14:49:40 -070018 "api/udp_socket.h",
btolsch2f2e7fa2019-03-29 16:48:49 -070019 "base/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080020 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080021
22 public_deps = [
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070023 "../osp_base",
btolsch2f2e7fa2019-03-29 16:48:49 -070024 "../third_party/abseil",
Jordan Bayles9eb09742019-01-15 14:04:52 -080025 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070026
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070027 allow_circular_includes_from = [ "../osp_base" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070028
Jordan Baylesa80724b2019-05-02 17:17:26 -070029 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080030
Jordan Baylesa80724b2019-05-02 17:17:26 -070031 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070032 sources += [
btolsch4666ed22019-04-25 15:58:07 -070033 "base/event_loop.cc",
34 "base/event_loop.h",
btolschc92ba2f2019-04-10 11:46:01 -070035 "base/task_runner_factory.cc",
36 "base/task_runner_impl.cc",
37 "base/task_runner_impl.h",
38 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080039
40 if (is_linux) {
41 sources += [ "linux/network_interface.cc" ]
42 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070043 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080044 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
45 "__APPLE_USE_RFC_3542",
46 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070047
Yuri Wiitalab2d13232019-02-04 18:07:28 -080048 sources += [ "mac/network_interface.cc" ]
49 }
50
51 if (is_posix) {
52 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080053 "posix/event_waiter.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070054 "posix/udp_socket.cc",
55 "posix/udp_socket.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080056 ]
57 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070058
59 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070060 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070061 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080062 }
btolsch9d6900c2018-05-30 18:22:53 -070063}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070064
Jordan Bayles9ade4152019-05-08 17:03:24 -070065source_set("default_logger") {
66 sources = [
67 "base/logging.cc",
68 ]
69
70 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070071 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070072 }
73
74 configs += [ "../build:allow_build_from_embedder" ]
75
76 deps = [
77 "../osp_base",
78 "../third_party/abseil",
79 ]
80}
81
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070082source_set("platform_unittests") {
83 testonly = true
84
85 sources = [
86 "api/time_unittest.cc",
87 ]
88
89 # The unit tests in base/ assume the standalone implementation is being used.
90 # Exclude them if an embedder is providing the implementation.
91 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070092 sources += [
93 "base/task_runner_unittest.cc",
94 "base/time_unittest.cc",
95 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070096 }
97
98 deps = [
99 ":platform",
btolsch4666ed22019-04-25 15:58:07 -0700100 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700101 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700102
103 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700104}