btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 1 | # 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 Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 5 | import("//build_overrides/build.gni") |
btolsch | 5292c94 | 2018-07-26 00:06:22 -0700 | [diff] [blame] | 6 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 7 | source_set("platform") { |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 8 | defines = [] |
| 9 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 10 | sources = [ |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 11 | "api/logging.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 12 | "api/network_interface.h", |
Jordan Bayles | f3cf17d | 2019-06-11 15:29:43 -0700 | [diff] [blame] | 13 | "api/scoped_wake_lock.cc", |
| 14 | "api/scoped_wake_lock.h", |
btolsch | 4051e72 | 2019-06-07 16:15:17 -0700 | [diff] [blame] | 15 | "api/socket.h", |
Jordan Bayles | b0c191e | 2019-03-26 15:49:57 -0700 | [diff] [blame] | 16 | "api/task_runner.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 17 | "api/time.h", |
Ryan Keane | fdebe6c | 2019-09-06 14:12:51 -0700 | [diff] [blame] | 18 | "api/tls_connection.cc", |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 19 | "api/tls_connection.h", |
Ryan Keane | fdebe6c | 2019-09-06 14:12:51 -0700 | [diff] [blame] | 20 | "api/tls_connection_factory.cc", |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 21 | "api/tls_connection_factory.h", |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 22 | "api/trace_logging_platform.cc", |
| 23 | "api/trace_logging_platform.h", |
Max Yakimakha | 04362e2 | 2019-07-22 17:54:45 -0700 | [diff] [blame] | 24 | "api/udp_read_callback.h", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 25 | "api/udp_socket.cc", |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 26 | "api/udp_socket.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 27 | "base/error.cc", |
| 28 | "base/error.h", |
Yuri Wiitala | 22f643c | 2019-11-25 14:54:17 -0800 | [diff] [blame] | 29 | "base/interface_info.cc", |
| 30 | "base/interface_info.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 31 | "base/ip_address.cc", |
| 32 | "base/ip_address.h", |
| 33 | "base/location.cc", |
| 34 | "base/location.h", |
Jordan Bayles | c56f038 | 2019-10-10 16:57:56 -0700 | [diff] [blame] | 35 | "base/serial_delete_ptr.h", |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 36 | "base/socket_state.h", |
| 37 | "base/tls_connect_options.h", |
| 38 | "base/tls_credentials.cc", |
| 39 | "base/tls_credentials.h", |
| 40 | "base/tls_listen_options.h", |
Yuri Wiitala | 8e6db3b | 2019-11-20 11:20:54 -0800 | [diff] [blame] | 41 | "base/trace_logging_activation.cc", |
| 42 | "base/trace_logging_activation.h", |
| 43 | "base/trace_logging_types.h", |
Yuri Wiitala | 977b6ef | 2019-11-07 17:08:25 -0800 | [diff] [blame] | 44 | "base/udp_packet.cc", |
| 45 | "base/udp_packet.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 46 | ] |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 47 | |
| 48 | public_deps = [ |
btolsch | 2f2e7fa | 2019-03-29 16:48:49 -0700 | [diff] [blame] | 49 | "../third_party/abseil", |
Jordan Bayles | b9262f4 | 2019-05-30 14:10:02 -0700 | [diff] [blame] | 50 | "../third_party/boringssl", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 51 | "../util", |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 52 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 53 | |
Jordan Bayles | 21b5adc | 2019-10-25 12:01:20 -0700 | [diff] [blame] | 54 | public_configs = [ "../build:openscreen_include_dirs" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 55 | |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 56 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 57 | sources += [ |
Yuri Wiitala | b797903 | 2019-11-08 15:17:20 -0800 | [diff] [blame] | 58 | "impl/logging.h", |
Ryan Keane | 3b88a25 | 2019-09-17 09:55:33 -0700 | [diff] [blame] | 59 | "impl/socket_handle.h", |
Ryan Keane | 2fdf966 | 2019-09-25 13:29:32 -0700 | [diff] [blame] | 60 | "impl/socket_handle_waiter.cc", |
| 61 | "impl/socket_handle_waiter.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 62 | "impl/task_runner.cc", |
| 63 | "impl/task_runner.h", |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 64 | "impl/text_trace_logging_platform.cc", |
| 65 | "impl/text_trace_logging_platform.h", |
btolsch | 4397c29 | 2019-07-22 12:42:10 -0700 | [diff] [blame] | 66 | "impl/time.cc", |
Ryan Keane | c5e56e7 | 2019-09-18 18:21:40 -0700 | [diff] [blame] | 67 | "impl/tls_write_buffer.cc", |
| 68 | "impl/tls_write_buffer.h", |
Yuri Wiitala | fb75b09 | 2019-11-14 14:13:18 -0800 | [diff] [blame] | 69 | "impl/weak_ptr.h", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 70 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 71 | |
| 72 | if (is_linux) { |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 73 | sources += [ "impl/network_interface_linux.cc" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 74 | } else if (is_mac) { |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 75 | defines += [ |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 76 | # Required, to use the new IPv6 Sockets options introduced by RFC 3542. |
| 77 | "__APPLE_USE_RFC_3542", |
| 78 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 79 | |
Jordan Bayles | c56f038 | 2019-10-10 16:57:56 -0700 | [diff] [blame] | 80 | libs = [ |
| 81 | "CoreFoundation.framework", |
| 82 | "IOKit.framework", |
| 83 | ] |
| 84 | |
| 85 | sources += [ |
| 86 | "impl/network_interface_mac.cc", |
| 87 | "impl/scoped_wake_lock_mac.cc", |
| 88 | "impl/scoped_wake_lock_mac.h", |
| 89 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | if (is_posix) { |
| 93 | sources += [ |
Yuri Wiitala | b797903 | 2019-11-08 15:17:20 -0800 | [diff] [blame] | 94 | "impl/logging_posix.cc", |
Ryan Keane | 52e2fd8 | 2019-10-08 11:44:11 -0700 | [diff] [blame] | 95 | "impl/platform_client_posix.cc", |
| 96 | "impl/platform_client_posix.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 97 | "impl/scoped_pipe.h", |
Jordan Bayles | 62b7c6a | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 98 | "impl/socket_address_posix.cc", |
| 99 | "impl/socket_address_posix.h", |
Ryan Keane | 6e54252 | 2019-09-10 16:05:44 -0700 | [diff] [blame] | 100 | "impl/socket_handle_posix.cc", |
| 101 | "impl/socket_handle_posix.h", |
Ryan Keane | 2fdf966 | 2019-09-25 13:29:32 -0700 | [diff] [blame] | 102 | "impl/socket_handle_waiter_posix.cc", |
| 103 | "impl/socket_handle_waiter_posix.h", |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 104 | "impl/stream_socket.h", |
Jordan Bayles | 62b7c6a | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 105 | "impl/stream_socket_posix.cc", |
| 106 | "impl/stream_socket_posix.h", |
mark a. foltz | cbdea4b | 2019-11-18 16:49:14 -0800 | [diff] [blame] | 107 | "impl/timeval_posix.cc", |
| 108 | "impl/timeval_posix.h", |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 109 | "impl/tls_connection_factory_posix.cc", |
| 110 | "impl/tls_connection_factory_posix.h", |
| 111 | "impl/tls_connection_posix.cc", |
| 112 | "impl/tls_connection_posix.h", |
Ryan Keane | ffa8c1e | 2019-09-23 10:42:48 -0700 | [diff] [blame] | 113 | "impl/tls_data_router_posix.cc", |
| 114 | "impl/tls_data_router_posix.h", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 115 | "impl/udp_socket_posix.cc", |
| 116 | "impl/udp_socket_posix.h", |
Ryan Keane | e93f8c7 | 2019-09-25 12:35:00 -0700 | [diff] [blame] | 117 | "impl/udp_socket_reader_posix.cc", |
| 118 | "impl/udp_socket_reader_posix.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 119 | ] |
| 120 | } |
| 121 | } |
btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 122 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 123 | |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 124 | source_set("test") { |
| 125 | testonly = true |
| 126 | sources = [ |
| 127 | "test/fake_clock.cc", |
| 128 | "test/fake_clock.h", |
Yuri Wiitala | ec35361 | 2019-06-18 17:32:39 -0700 | [diff] [blame] | 129 | "test/fake_task_runner.cc", |
| 130 | "test/fake_task_runner.h", |
Ryan Keane | 7d4b5fc | 2019-08-30 12:38:39 -0700 | [diff] [blame] | 131 | "test/fake_udp_socket.cc", |
| 132 | "test/fake_udp_socket.h", |
Ryan Keane | 38e7d51 | 2019-08-02 15:37:49 -0700 | [diff] [blame] | 133 | "test/trace_logging_helpers.h", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 134 | ] |
| 135 | |
| 136 | deps = [ |
| 137 | ":platform", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 138 | "../third_party/googletest:gmock", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 139 | ] |
| 140 | } |
| 141 | |
mark a. foltz | 3fe4617 | 2019-09-18 05:50:30 -0700 | [diff] [blame] | 142 | source_set("unittests") { |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 143 | testonly = true |
| 144 | |
| 145 | sources = [ |
| 146 | "api/time_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 147 | "base/error_unittest.cc", |
| 148 | "base/ip_address_unittest.cc", |
| 149 | "base/location_unittest.cc", |
Jordan Bayles | c56f038 | 2019-10-10 16:57:56 -0700 | [diff] [blame] | 150 | "base/serial_delete_ptr_unittest.cc", |
Jordan Bayles | 05ce6b6 | 2019-09-06 14:09:10 -0700 | [diff] [blame] | 151 | "base/tls_credentials_unittest.cc", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 152 | ] |
| 153 | |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 154 | # The unit tests in impl/ assume the standalone implementation is being used. |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 155 | # Exclude them if an embedder is providing the implementation. |
| 156 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 157 | sources += [ |
Jordan Bayles | 063c3b5 | 2019-08-13 18:14:55 -0700 | [diff] [blame] | 158 | # TODO(jophba): move over to general sources when UDP socket create |
| 159 | # is implemented in Chromium, as part of the NetworkRunner work. |
Ryan Keane | 493029d | 2019-08-19 14:01:04 -0700 | [diff] [blame] | 160 | "api/socket_integration_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 161 | "impl/task_runner_unittest.cc", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 162 | "impl/time_unittest.cc", |
Yuri Wiitala | fb75b09 | 2019-11-14 14:13:18 -0800 | [diff] [blame] | 163 | "impl/weak_ptr_unittest.cc", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 164 | ] |
Jordan Bayles | 063c3b5 | 2019-08-13 18:14:55 -0700 | [diff] [blame] | 165 | |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 166 | if (is_posix) { |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 167 | sources += [ |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 168 | "impl/scoped_pipe_unittest.cc", |
Jordan Bayles | 62b7c6a | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 169 | "impl/socket_address_posix_unittest.cc", |
Ryan Keane | 2fdf966 | 2019-09-25 13:29:32 -0700 | [diff] [blame] | 170 | "impl/socket_handle_waiter_posix_unittest.cc", |
mark a. foltz | cbdea4b | 2019-11-18 16:49:14 -0800 | [diff] [blame] | 171 | "impl/timeval_posix_unittest.cc", |
Ryan Keane | d838a25 | 2019-09-25 12:48:15 -0700 | [diff] [blame] | 172 | "impl/tls_data_router_posix_unittest.cc", |
Ryan Keane | f277612 | 2019-10-11 09:07:33 -0700 | [diff] [blame] | 173 | "impl/tls_write_buffer_unittest.cc", |
Ryan Keane | e93f8c7 | 2019-09-25 12:35:00 -0700 | [diff] [blame] | 174 | "impl/udp_socket_reader_posix_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 175 | ] |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 176 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | deps = [ |
| 180 | ":platform", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 181 | "../third_party/googletest:gmock", |
btolsch | 4666ed2 | 2019-04-25 15:58:07 -0700 | [diff] [blame] | 182 | "../third_party/googletest:gtest", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 183 | ] |
| 184 | } |