blob: d9ec44e9f013636592c9036abbb008340de26e89 [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",
11 "api/logging.cc",
12 "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 Baylesf1e4bb72019-05-01 12:38:39 -070026 allow_circular_includes_from = [ "../osp_base" ]
Jordan Baylesa80724b2019-05-02 17:17:26 -070027 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080028
Jordan Baylesa80724b2019-05-02 17:17:26 -070029 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070030 sources += [
btolsch4666ed22019-04-25 15:58:07 -070031 "base/event_loop.cc",
32 "base/event_loop.h",
btolschc92ba2f2019-04-10 11:46:01 -070033 "base/logging.cc",
34 "base/task_runner_factory.cc",
35 "base/task_runner_impl.cc",
36 "base/task_runner_impl.h",
37 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080038
39 if (is_linux) {
40 sources += [ "linux/network_interface.cc" ]
41 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070042 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080043 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
44 "__APPLE_USE_RFC_3542",
45 ]
46 sources += [ "mac/network_interface.cc" ]
47 }
48
49 if (is_posix) {
50 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080051 "posix/event_waiter.cc",
52 "posix/logging.cc",
53 "posix/socket.cc",
54 "posix/socket.h",
55 ]
56 }
57 }
btolsch9d6900c2018-05-30 18:22:53 -070058}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070059
60source_set("platform_unittests") {
61 testonly = true
62
63 sources = [
64 "api/time_unittest.cc",
65 ]
66
67 # The unit tests in base/ assume the standalone implementation is being used.
68 # Exclude them if an embedder is providing the implementation.
69 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070070 sources += [
71 "base/task_runner_unittest.cc",
72 "base/time_unittest.cc",
73 ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070074 }
75
76 deps = [
77 ":platform",
btolsch4666ed22019-04-25 15:58:07 -070078 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070079 ]
80}