blob: bd24e0b00906ae37c3e2023f3b431ecad8c66bba [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") {
Ryan Keane1d9c0c42019-07-29 15:22:19 -07008 defines = []
9
Yuri Wiitalab2d13232019-02-04 18:07:28 -080010 sources = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080011 "api/logging.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080012 "api/network_interface.h",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070013 "api/scoped_wake_lock.cc",
14 "api/scoped_wake_lock.h",
btolsch4051e722019-06-07 16:15:17 -070015 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070016 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080017 "api/time.h",
Ryan Keanefdebe6c2019-09-06 14:12:51 -070018 "api/tls_connection.cc",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070019 "api/tls_connection.h",
Ryan Keanefdebe6c2019-09-06 14:12:51 -070020 "api/tls_connection_factory.cc",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070021 "api/tls_connection_factory.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070022 "api/trace_logging_platform.cc",
23 "api/trace_logging_platform.h",
Max Yakimakha04362e22019-07-22 17:54:45 -070024 "api/udp_read_callback.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070025 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070026 "api/udp_socket.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070027 "base/error.cc",
28 "base/error.h",
Yuri Wiitala22f643c2019-11-25 14:54:17 -080029 "base/interface_info.cc",
30 "base/interface_info.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070031 "base/ip_address.cc",
32 "base/ip_address.h",
33 "base/location.cc",
34 "base/location.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070035 "base/socket_state.h",
36 "base/tls_connect_options.h",
37 "base/tls_credentials.cc",
38 "base/tls_credentials.h",
39 "base/tls_listen_options.h",
Yuri Wiitala8e6db3b2019-11-20 11:20:54 -080040 "base/trace_logging_activation.cc",
41 "base/trace_logging_activation.h",
42 "base/trace_logging_types.h",
Yuri Wiitalaf162a612019-11-22 22:46:04 -080043 "base/trivial_clock_traits.cc",
44 "base/trivial_clock_traits.h",
Yuri Wiitala977b6ef2019-11-07 17:08:25 -080045 "base/udp_packet.cc",
46 "base/udp_packet.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080047 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080048
49 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070050 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070051 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070052 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080053 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070054
Jordan Bayles21b5adc2019-10-25 12:01:20 -070055 public_configs = [ "../build:openscreen_include_dirs" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080056
Jordan Baylesa80724b2019-05-02 17:17:26 -070057 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070058 sources += [
Yuri Wiitalab7979032019-11-08 15:17:20 -080059 "impl/logging.h",
Ryan Keane3b88a252019-09-17 09:55:33 -070060 "impl/socket_handle.h",
Ryan Keane2fdf9662019-09-25 13:29:32 -070061 "impl/socket_handle_waiter.cc",
62 "impl/socket_handle_waiter.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070063 "impl/task_runner.cc",
64 "impl/task_runner.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070065 "impl/text_trace_logging_platform.cc",
66 "impl/text_trace_logging_platform.h",
btolsch4397c292019-07-22 12:42:10 -070067 "impl/time.cc",
Ryan Keanec5e56e72019-09-18 18:21:40 -070068 "impl/tls_write_buffer.cc",
69 "impl/tls_write_buffer.h",
Yuri Wiitalafb75b092019-11-14 14:13:18 -080070 "impl/weak_ptr.h",
btolschc92ba2f2019-04-10 11:46:01 -070071 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080072
73 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070074 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080075 } else if (is_mac) {
Ryan Keane1d9c0c42019-07-29 15:22:19 -070076 defines += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080077 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
78 "__APPLE_USE_RFC_3542",
79 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070080
Jordan Baylesc56f0382019-10-10 16:57:56 -070081 libs = [
82 "CoreFoundation.framework",
83 "IOKit.framework",
84 ]
85
86 sources += [
87 "impl/network_interface_mac.cc",
88 "impl/scoped_wake_lock_mac.cc",
89 "impl/scoped_wake_lock_mac.h",
90 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080091 }
92
93 if (is_posix) {
94 sources += [
Yuri Wiitalab7979032019-11-08 15:17:20 -080095 "impl/logging_posix.cc",
Ryan Keane52e2fd82019-10-08 11:44:11 -070096 "impl/platform_client_posix.cc",
97 "impl/platform_client_posix.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070098 "impl/scoped_pipe.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -070099 "impl/socket_address_posix.cc",
100 "impl/socket_address_posix.h",
Ryan Keane6e542522019-09-10 16:05:44 -0700101 "impl/socket_handle_posix.cc",
102 "impl/socket_handle_posix.h",
Ryan Keane2fdf9662019-09-25 13:29:32 -0700103 "impl/socket_handle_waiter_posix.cc",
104 "impl/socket_handle_waiter_posix.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -0700105 "impl/stream_socket.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700106 "impl/stream_socket_posix.cc",
107 "impl/stream_socket_posix.h",
mark a. foltzcbdea4b2019-11-18 16:49:14 -0800108 "impl/timeval_posix.cc",
109 "impl/timeval_posix.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -0700110 "impl/tls_connection_factory_posix.cc",
111 "impl/tls_connection_factory_posix.h",
112 "impl/tls_connection_posix.cc",
113 "impl/tls_connection_posix.h",
Ryan Keaneffa8c1e2019-09-23 10:42:48 -0700114 "impl/tls_data_router_posix.cc",
115 "impl/tls_data_router_posix.h",
Jordan Baylescc471802019-07-09 14:25:02 -0700116 "impl/udp_socket_posix.cc",
117 "impl/udp_socket_posix.h",
Ryan Keanee93f8c72019-09-25 12:35:00 -0700118 "impl/udp_socket_reader_posix.cc",
119 "impl/udp_socket_reader_posix.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -0800120 ]
121 }
122 }
btolsch9d6900c2018-05-30 18:22:53 -0700123}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700124
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700125source_set("test") {
126 testonly = true
127 sources = [
128 "test/fake_clock.cc",
129 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -0700130 "test/fake_task_runner.cc",
131 "test/fake_task_runner.h",
Ryan Keane7d4b5fc2019-08-30 12:38:39 -0700132 "test/fake_udp_socket.cc",
133 "test/fake_udp_socket.h",
btolsch07bf81f2019-11-26 13:52:05 -0800134 "test/mock_tls_connection.h",
Ryan Keane38e7d512019-08-02 15:37:49 -0700135 "test/trace_logging_helpers.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700136 ]
137
138 deps = [
139 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700140 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700141 ]
142}
143
mark a. foltz3fe46172019-09-18 05:50:30 -0700144source_set("unittests") {
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700145 testonly = true
146
147 sources = [
148 "api/time_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700149 "base/error_unittest.cc",
150 "base/ip_address_unittest.cc",
151 "base/location_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700152 ]
153
Jordan Baylescc471802019-07-09 14:25:02 -0700154 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700155 # Exclude them if an embedder is providing the implementation.
156 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700157 sources += [
Jordan Bayles063c3b52019-08-13 18:14:55 -0700158 # TODO(jophba): move over to general sources when UDP socket create
159 # is implemented in Chromium, as part of the NetworkRunner work.
Ryan Keane493029d2019-08-19 14:01:04 -0700160 "api/socket_integration_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700161 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700162 "impl/time_unittest.cc",
Yuri Wiitalafb75b092019-11-14 14:13:18 -0800163 "impl/weak_ptr_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700164 ]
Jordan Bayles063c3b52019-08-13 18:14:55 -0700165
Ryan Keane32c88d02019-07-02 18:46:14 -0700166 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700167 sources += [
Jordan Baylesa26582d2019-07-10 14:44:58 -0700168 "impl/scoped_pipe_unittest.cc",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700169 "impl/socket_address_posix_unittest.cc",
Ryan Keane2fdf9662019-09-25 13:29:32 -0700170 "impl/socket_handle_waiter_posix_unittest.cc",
mark a. foltzcbdea4b2019-11-18 16:49:14 -0800171 "impl/timeval_posix_unittest.cc",
Ryan Keaned838a252019-09-25 12:48:15 -0700172 "impl/tls_data_router_posix_unittest.cc",
Ryan Keanef2776122019-10-11 09:07:33 -0700173 "impl/tls_write_buffer_unittest.cc",
Ryan Keanee93f8c72019-09-25 12:35:00 -0700174 "impl/udp_socket_reader_posix_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700175 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700176 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700177 }
178
179 deps = [
180 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700181 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700182 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700183 ]
184}