blob: e196b043208fce4616b314624b7fc5a56183bb5e [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",
Jordan Bayles9ade4152019-05-08 17:03:24 -070011 "api/logging_util.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080012 "api/logging.h",
13 "api/network_interface.cc",
14 "api/network_interface.h",
Jordan Baylesa80724b2019-05-02 17:17:26 -070015 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070016 "api/task_runner.h",
17 "api/task_runner_factory.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080018 "api/time.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",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080054 "posix/socket.cc",
55 "posix/socket.h",
56 ]
57 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070058
59 deps = [
60 ":default_logger"
61 ]
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) {
71 sources += [
72 "posix/log_initializer.cc",
73 ]
74 }
75
76 configs += [ "../build:allow_build_from_embedder" ]
77
78 deps = [
79 "../osp_base",
80 "../third_party/abseil",
81 ]
82}
83
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070084source_set("platform_unittests") {
85 testonly = true
86
87 sources = [
88 "api/time_unittest.cc",
89 ]
90
91 # The unit tests in base/ assume the standalone implementation is being used.
92 # Exclude them if an embedder is providing the implementation.
93 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070094 sources += [
95 "base/task_runner_unittest.cc",
96 "base/time_unittest.cc",
97 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070098 }
99
100 deps = [
101 ":platform",
btolsch4666ed22019-04-25 15:58:07 -0700102 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700103 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700104
105 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700106}