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 | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 7 | # Source files that depend on nothing (all your base/ are belong to us). |
| 8 | source_set("base") { |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 9 | defines = [] |
| 10 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 11 | sources = [ |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 12 | "base/error.cc", |
| 13 | "base/error.h", |
Yuri Wiitala | 22f643c | 2019-11-25 14:54:17 -0800 | [diff] [blame] | 14 | "base/interface_info.cc", |
| 15 | "base/interface_info.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 16 | "base/ip_address.cc", |
| 17 | "base/ip_address.h", |
| 18 | "base/location.cc", |
| 19 | "base/location.h", |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 20 | "base/socket_state.h", |
| 21 | "base/tls_connect_options.h", |
| 22 | "base/tls_credentials.cc", |
| 23 | "base/tls_credentials.h", |
| 24 | "base/tls_listen_options.h", |
Yuri Wiitala | 8e6db3b | 2019-11-20 11:20:54 -0800 | [diff] [blame] | 25 | "base/trace_logging_activation.cc", |
| 26 | "base/trace_logging_activation.h", |
| 27 | "base/trace_logging_types.h", |
Yuri Wiitala | f162a61 | 2019-11-22 22:46:04 -0800 | [diff] [blame] | 28 | "base/trivial_clock_traits.cc", |
| 29 | "base/trivial_clock_traits.h", |
Yuri Wiitala | 977b6ef | 2019-11-07 17:08:25 -0800 | [diff] [blame] | 30 | "base/udp_packet.cc", |
| 31 | "base/udp_packet.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 32 | ] |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 33 | |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 34 | public_configs = [ "../build:openscreen_include_dirs" ] |
| 35 | } |
| 36 | |
| 37 | # Public API source files. These may depend on nothing except :base. |
| 38 | source_set("api") { |
| 39 | defines = [] |
| 40 | |
| 41 | sources = [ |
| 42 | "api/export.h", |
| 43 | "api/logging.h", |
| 44 | "api/network_interface.h", |
| 45 | "api/scoped_wake_lock.cc", |
| 46 | "api/scoped_wake_lock.h", |
| 47 | "api/task_runner.h", |
| 48 | "api/time.h", |
| 49 | "api/tls_connection.cc", |
| 50 | "api/tls_connection.h", |
| 51 | "api/tls_connection_factory.cc", |
| 52 | "api/tls_connection_factory.h", |
| 53 | "api/trace_logging_platform.cc", |
| 54 | "api/trace_logging_platform.h", |
| 55 | "api/udp_socket.cc", |
| 56 | "api/udp_socket.h", |
| 57 | ] |
| 58 | |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 59 | public_deps = [ |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 60 | ":base", |
| 61 | ] |
| 62 | } |
| 63 | |
| 64 | # The following target is only activated in standalone builds (see :platform). |
| 65 | source_set("standalone_impl") { |
| 66 | defines = [] |
| 67 | |
| 68 | sources = [ |
| 69 | "impl/logging.h", |
| 70 | "impl/socket_handle.h", |
| 71 | "impl/socket_handle_waiter.cc", |
| 72 | "impl/socket_handle_waiter.h", |
| 73 | "impl/stream_socket.h", |
| 74 | "impl/task_runner.cc", |
| 75 | "impl/task_runner.h", |
| 76 | "impl/text_trace_logging_platform.cc", |
| 77 | "impl/text_trace_logging_platform.h", |
| 78 | "impl/time.cc", |
| 79 | "impl/tls_write_buffer.cc", |
| 80 | "impl/tls_write_buffer.h", |
| 81 | "impl/weak_ptr.h", |
| 82 | ] |
| 83 | |
| 84 | if (is_linux) { |
| 85 | sources += [ "impl/network_interface_linux.cc" ] |
| 86 | } else if (is_mac) { |
| 87 | defines += [ |
| 88 | # Required, to use the new IPv6 Sockets options introduced by RFC 3542. |
| 89 | "__APPLE_USE_RFC_3542", |
| 90 | ] |
| 91 | |
| 92 | libs = [ |
| 93 | "CoreFoundation.framework", |
| 94 | "IOKit.framework", |
| 95 | ] |
| 96 | |
| 97 | sources += [ |
| 98 | "impl/network_interface_mac.cc", |
| 99 | "impl/scoped_wake_lock_mac.cc", |
| 100 | "impl/scoped_wake_lock_mac.h", |
| 101 | ] |
| 102 | } |
| 103 | |
| 104 | if (is_posix) { |
| 105 | sources += [ |
| 106 | "impl/logging_posix.cc", |
| 107 | "impl/platform_client_posix.cc", |
| 108 | "impl/platform_client_posix.h", |
| 109 | "impl/scoped_pipe.h", |
| 110 | "impl/socket_address_posix.cc", |
| 111 | "impl/socket_address_posix.h", |
| 112 | "impl/socket_handle_posix.cc", |
| 113 | "impl/socket_handle_posix.h", |
| 114 | "impl/socket_handle_waiter_posix.cc", |
| 115 | "impl/socket_handle_waiter_posix.h", |
| 116 | "impl/stream_socket_posix.cc", |
| 117 | "impl/stream_socket_posix.h", |
| 118 | "impl/timeval_posix.cc", |
| 119 | "impl/timeval_posix.h", |
| 120 | "impl/tls_connection_factory_posix.cc", |
| 121 | "impl/tls_connection_factory_posix.h", |
| 122 | "impl/tls_connection_posix.cc", |
| 123 | "impl/tls_connection_posix.h", |
| 124 | "impl/tls_data_router_posix.cc", |
| 125 | "impl/tls_data_router_posix.h", |
| 126 | "impl/udp_socket_posix.cc", |
| 127 | "impl/udp_socket_posix.h", |
| 128 | "impl/udp_socket_reader_posix.cc", |
| 129 | "impl/udp_socket_reader_posix.h", |
| 130 | ] |
| 131 | } |
| 132 | |
| 133 | deps = [ |
| 134 | ":api", |
btolsch | 2f2e7fa | 2019-03-29 16:48:49 -0700 | [diff] [blame] | 135 | "../third_party/abseil", |
Jordan Bayles | b9262f4 | 2019-05-30 14:10:02 -0700 | [diff] [blame] | 136 | "../third_party/boringssl", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 137 | "../util", |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 138 | ] |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 139 | } |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 140 | |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 141 | # The main target, which either assumes an embedder will link-in the platform |
| 142 | # API implementation elsewhere, or links-in the :standalone_impl in the build. |
| 143 | source_set("platform") { |
| 144 | public_deps = [ |
| 145 | ":api", |
| 146 | ] |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 147 | if (!build_with_chromium) { |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 148 | deps = [ |
| 149 | ":standalone_impl", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 150 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 151 | } |
btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 152 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 153 | |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 154 | # Test helpers, referenced in other Open Screen BUILD.gn test targets. |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 155 | source_set("test") { |
| 156 | testonly = true |
| 157 | sources = [ |
| 158 | "test/fake_clock.cc", |
| 159 | "test/fake_clock.h", |
Yuri Wiitala | ec35361 | 2019-06-18 17:32:39 -0700 | [diff] [blame] | 160 | "test/fake_task_runner.cc", |
| 161 | "test/fake_task_runner.h", |
Ryan Keane | 7d4b5fc | 2019-08-30 12:38:39 -0700 | [diff] [blame] | 162 | "test/fake_udp_socket.cc", |
| 163 | "test/fake_udp_socket.h", |
btolsch | 07bf81f | 2019-11-26 13:52:05 -0800 | [diff] [blame] | 164 | "test/mock_tls_connection.h", |
Ryan Keane | 38e7d51 | 2019-08-02 15:37:49 -0700 | [diff] [blame] | 165 | "test/trace_logging_helpers.h", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 166 | ] |
| 167 | |
| 168 | deps = [ |
| 169 | ":platform", |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 170 | "../third_party/abseil", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 171 | "../third_party/googletest:gmock", |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 172 | "../util", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 173 | ] |
| 174 | } |
| 175 | |
mark a. foltz | 3fe4617 | 2019-09-18 05:50:30 -0700 | [diff] [blame] | 176 | source_set("unittests") { |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 177 | testonly = true |
| 178 | |
| 179 | sources = [ |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 180 | "api/socket_integration_unittest.cc", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 181 | "api/time_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 182 | "base/error_unittest.cc", |
| 183 | "base/ip_address_unittest.cc", |
| 184 | "base/location_unittest.cc", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 185 | ] |
| 186 | |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 187 | # The unit tests in impl/ assume the standalone implementation is being used. |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 188 | # Exclude them if an embedder is providing the implementation. |
| 189 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 190 | sources += [ |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 191 | "impl/task_runner_unittest.cc", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 192 | "impl/time_unittest.cc", |
Yuri Wiitala | fb75b09 | 2019-11-14 14:13:18 -0800 | [diff] [blame] | 193 | "impl/weak_ptr_unittest.cc", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 194 | ] |
Jordan Bayles | 063c3b5 | 2019-08-13 18:14:55 -0700 | [diff] [blame] | 195 | |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 196 | if (is_posix) { |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 197 | sources += [ |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 198 | "impl/scoped_pipe_unittest.cc", |
Jordan Bayles | 62b7c6a | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 199 | "impl/socket_address_posix_unittest.cc", |
Ryan Keane | 2fdf966 | 2019-09-25 13:29:32 -0700 | [diff] [blame] | 200 | "impl/socket_handle_waiter_posix_unittest.cc", |
mark a. foltz | cbdea4b | 2019-11-18 16:49:14 -0800 | [diff] [blame] | 201 | "impl/timeval_posix_unittest.cc", |
Ryan Keane | d838a25 | 2019-09-25 12:48:15 -0700 | [diff] [blame] | 202 | "impl/tls_data_router_posix_unittest.cc", |
Ryan Keane | f277612 | 2019-10-11 09:07:33 -0700 | [diff] [blame] | 203 | "impl/tls_write_buffer_unittest.cc", |
Ryan Keane | e93f8c7 | 2019-09-25 12:35:00 -0700 | [diff] [blame] | 204 | "impl/udp_socket_reader_posix_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 205 | ] |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 206 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | deps = [ |
| 210 | ":platform", |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 211 | ":test", |
| 212 | "../third_party/abseil", |
| 213 | "../third_party/boringssl", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 214 | "../third_party/googletest:gmock", |
btolsch | 4666ed2 | 2019-04-25 15:58:07 -0700 | [diff] [blame] | 215 | "../third_party/googletest:gtest", |
Yuri Wiitala | ca24ee5 | 2019-12-05 16:51:42 -0800 | [diff] [blame^] | 216 | "../util", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 217 | ] |
| 218 | } |