blob: 6ed589498fbf43ce000a72fe1c9ed931a0cad31a [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") {
8 defines = []
9
10 sources = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080011 "api/event_waiter.cc",
12 "api/event_waiter.h",
13 "api/logging.cc",
14 "api/logging.h",
15 "api/network_interface.cc",
16 "api/network_interface.h",
17 "api/socket.h.",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070018 "api/task_runner.h",
19 "api/task_runner_factory.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080020 "api/time.h",
btolsch2f2e7fa2019-03-29 16:48:49 -070021 "base/event_loop.cc",
22 "base/event_loop.h",
23 "base/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080024 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080025
btolsch2f2e7fa2019-03-29 16:48:49 -070026 deps = []
Jordan Bayles9eb09742019-01-15 14:04:52 -080027 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070028 "../base",
29 "../third_party/abseil",
Jordan Bayles9eb09742019-01-15 14:04:52 -080030 ]
btolsch2f2e7fa2019-03-29 16:48:49 -070031 configs += [ "..:root_config_overrides" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080032
33 if (build_with_chromium) {
btolsch2f2e7fa2019-03-29 16:48:49 -070034 deps += [ ":chromium" ]
35 public_deps += [ "//base" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080036 } else { # !build_with_chromium
btolschc92ba2f2019-04-10 11:46:01 -070037 sources += [
38 "base/logging.cc",
39 "base/task_runner_factory.cc",
40 "base/task_runner_impl.cc",
41 "base/task_runner_impl.h",
42 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080043
44 if (is_linux) {
45 sources += [ "linux/network_interface.cc" ]
46 } else if (is_mac) {
47 defines += [
48 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
49 "__APPLE_USE_RFC_3542",
50 ]
51 sources += [ "mac/network_interface.cc" ]
52 }
53
54 if (is_posix) {
55 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080056 "posix/event_waiter.cc",
57 "posix/logging.cc",
58 "posix/socket.cc",
59 "posix/socket.h",
60 ]
61 }
62 }
btolsch9d6900c2018-05-30 18:22:53 -070063}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070064
btolsch2f2e7fa2019-03-29 16:48:49 -070065if (build_with_chromium) {
66 source_set("chromium") {
67 sources = [
68 "chromium/logging.cc",
69 ]
70
71 deps = [
72 "../third_party/abseil",
73 "//base",
74 ]
75
76 configs += [ "..:root_config_overrides" ]
77 }
78}
79
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070080source_set("platform_unittests") {
81 testonly = true
82
83 sources = [
84 "api/time_unittest.cc",
85 ]
86
87 # The unit tests in base/ assume the standalone implementation is being used.
88 # Exclude them if an embedder is providing the implementation.
89 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070090 sources += [
91 "base/task_runner_unittest.cc",
92 "base/time_unittest.cc",
93 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070094 }
95
96 deps = [
97 ":platform",
98 "//third_party/googletest:gtest",
99 ]
btolsch2f2e7fa2019-03-29 16:48:49 -0700100
101 configs += [ "..:root_config_overrides" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700102}