blob: eb38dd0e29be38e41847b767314ee887119c6c71 [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 Baylesaa021ce2019-05-29 13:57:44 -070065source_set("test") {
66 testonly = true
67 sources = [
68 "test/fake_clock.cc",
69 "test/fake_clock.h",
70 ]
71
72 deps = [
73 ":platform",
74 ]
75}
76
Jordan Bayles9ade4152019-05-08 17:03:24 -070077source_set("default_logger") {
78 sources = [
79 "base/logging.cc",
80 ]
81
82 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070083 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070084 }
85
86 configs += [ "../build:allow_build_from_embedder" ]
87
88 deps = [
89 "../osp_base",
90 "../third_party/abseil",
91 ]
92}
93
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070094source_set("platform_unittests") {
95 testonly = true
96
97 sources = [
98 "api/time_unittest.cc",
99 ]
100
101 # The unit tests in base/ assume the standalone implementation is being used.
102 # Exclude them if an embedder is providing the implementation.
103 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700104 sources += [
105 "base/task_runner_unittest.cc",
106 "base/time_unittest.cc",
107 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700108 }
109
110 deps = [
111 ":platform",
btolsch4666ed22019-04-25 15:58:07 -0700112 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700113 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700114
115 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700116}