Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 1 | # Copyright 2015 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 | |
| 5 | if (is_mac) { |
| 6 | import("//build/config/sysroot.gni") |
| 7 | } |
| 8 | |
| 9 | # Allows the source set to inject ldflags for targets that link to it. |
| 10 | config("util_link_config") { |
| 11 | if (is_mac) { |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 12 | libs = [ "bsm" ] |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 13 | } |
| 14 | } |
| 15 | |
| 16 | if (is_mac) { |
| 17 | action_foreach("mig") { |
| 18 | script = "mach/mig.py" |
| 19 | sources = [ |
| 20 | "$sysroot/usr/include/mach/exc.defs", |
| 21 | "$sysroot/usr/include/mach/mach_exc.defs", |
| 22 | "$sysroot/usr/include/mach/notify.defs", |
| 23 | "mach/child_port.defs", |
| 24 | ] |
| 25 | |
| 26 | outputs = [ |
| 27 | "$target_gen_dir/mach/{{source_name_part}}User.c", |
| 28 | "$target_gen_dir/mach/{{source_name_part}}Server.c", |
| 29 | "$target_gen_dir/mach/{{source_name_part}}.h", |
| 30 | "$target_gen_dir/mach/{{source_name_part}}Server.h", |
| 31 | ] |
| 32 | |
| 33 | args = [ "{{source}}" ] |
| 34 | args += rebase_path(outputs, root_build_dir) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | source_set("util") { |
| 39 | sources = [ |
| 40 | "file/file_io.cc", |
| 41 | "file/file_io.h", |
| 42 | "file/file_io_posix.cc", |
| 43 | "file/file_io_win.cc", |
| 44 | "file/file_reader.cc", |
| 45 | "file/file_reader.h", |
| 46 | "file/file_seeker.cc", |
| 47 | "file/file_seeker.h", |
| 48 | "file/file_writer.cc", |
| 49 | "file/file_writer.h", |
| 50 | "file/string_file.cc", |
| 51 | "file/string_file.h", |
| 52 | "mac/checked_mach_address_range.h", |
| 53 | "mac/launchd.h", |
| 54 | "mac/launchd.mm", |
| 55 | "mac/mac_util.cc", |
| 56 | "mac/mac_util.h", |
| 57 | "mac/service_management.cc", |
| 58 | "mac/service_management.h", |
| 59 | "mac/xattr.cc", |
| 60 | "mac/xattr.h", |
| 61 | "misc/clock.h", |
| 62 | "misc/clock_mac.cc", |
| 63 | "misc/clock_posix.cc", |
| 64 | "misc/clock_win.cc", |
| 65 | "misc/implicit_cast.h", |
| 66 | "misc/initialization_state.h", |
| 67 | "misc/initialization_state_dcheck.cc", |
| 68 | "misc/initialization_state_dcheck.h", |
| 69 | "misc/pdb_structures.cc", |
| 70 | "misc/pdb_structures.h", |
| 71 | "misc/random_string.cc", |
| 72 | "misc/random_string.h", |
| 73 | "misc/scoped_forbid_return.cc", |
| 74 | "misc/scoped_forbid_return.h", |
| 75 | "misc/symbolic_constants_common.h", |
| 76 | "misc/tri_state.h", |
| 77 | "misc/uuid.cc", |
| 78 | "misc/uuid.h", |
| 79 | "net/http_body.cc", |
| 80 | "net/http_body.h", |
| 81 | "net/http_headers.cc", |
| 82 | "net/http_headers.h", |
| 83 | "net/http_multipart_builder.cc", |
| 84 | "net/http_multipart_builder.h", |
| 85 | "net/http_transport.cc", |
| 86 | "net/http_transport.h", |
| 87 | "net/http_transport_mac.mm", |
| 88 | "net/http_transport_win.cc", |
| 89 | "numeric/checked_address_range.cc", |
| 90 | "numeric/checked_address_range.h", |
| 91 | "numeric/checked_range.h", |
| 92 | "numeric/in_range_cast.h", |
| 93 | "numeric/int128.h", |
| 94 | "numeric/safe_assignment.h", |
| 95 | "posix/close_multiple.cc", |
| 96 | "posix/close_multiple.h", |
| 97 | "posix/close_stdio.cc", |
| 98 | "posix/close_stdio.h", |
| 99 | "posix/drop_privileges.cc", |
| 100 | "posix/drop_privileges.h", |
| 101 | "posix/process_info.h", |
| 102 | "posix/process_info_mac.cc", |
| 103 | "posix/symbolic_constants_posix.cc", |
| 104 | "posix/symbolic_constants_posix.h", |
| 105 | "stdlib/aligned_allocator.cc", |
| 106 | "stdlib/aligned_allocator.h", |
| 107 | "stdlib/cxx.h", |
| 108 | "stdlib/map_insert.h", |
| 109 | "stdlib/objc.h", |
| 110 | "stdlib/pointer_container.h", |
| 111 | "stdlib/string_number_conversion.cc", |
| 112 | "stdlib/string_number_conversion.h", |
| 113 | "stdlib/strlcpy.cc", |
| 114 | "stdlib/strlcpy.h", |
| 115 | "stdlib/strnlen.cc", |
| 116 | "stdlib/strnlen.h", |
| 117 | "string/split_string.cc", |
| 118 | "string/split_string.h", |
| 119 | "synchronization/semaphore.h", |
| 120 | "synchronization/semaphore_mac.cc", |
| 121 | "synchronization/semaphore_posix.cc", |
| 122 | "synchronization/semaphore_win.cc", |
| 123 | "thread/thread.cc", |
| 124 | "thread/thread.h", |
| 125 | "thread/thread_log_messages.cc", |
| 126 | "thread/thread_log_messages.h", |
| 127 | "thread/thread_posix.cc", |
| 128 | "thread/thread_win.cc", |
| 129 | "thread/worker_thread.cc", |
| 130 | "thread/worker_thread.h", |
| 131 | "win/address_types.h", |
| 132 | "win/capture_context.asm", |
| 133 | "win/capture_context.h", |
| 134 | "win/checked_win_address_range.h", |
| 135 | "win/command_line.cc", |
| 136 | "win/command_line.h", |
| 137 | "win/critical_section_with_debug_info.cc", |
| 138 | "win/critical_section_with_debug_info.h", |
| 139 | "win/exception_handler_server.cc", |
| 140 | "win/exception_handler_server.h", |
| 141 | "win/get_function.cc", |
| 142 | "win/get_function.h", |
| 143 | "win/get_module_information.cc", |
| 144 | "win/get_module_information.h", |
| 145 | "win/handle.cc", |
| 146 | "win/handle.h", |
| 147 | "win/module_version.cc", |
| 148 | "win/module_version.h", |
| 149 | "win/nt_internals.cc", |
| 150 | "win/nt_internals.h", |
| 151 | "win/ntstatus_logging.cc", |
| 152 | "win/ntstatus_logging.h", |
| 153 | "win/process_info.cc", |
| 154 | "win/process_info.h", |
| 155 | "win/process_structs.h", |
| 156 | "win/registration_protocol_win.cc", |
| 157 | "win/registration_protocol_win.h", |
| 158 | "win/scoped_handle.cc", |
| 159 | "win/scoped_handle.h", |
| 160 | "win/scoped_local_alloc.cc", |
| 161 | "win/scoped_local_alloc.h", |
| 162 | "win/scoped_process_suspend.cc", |
| 163 | "win/scoped_process_suspend.h", |
| 164 | "win/time.cc", |
| 165 | "win/time.h", |
| 166 | "win/xp_compat.h", |
| 167 | ] |
| 168 | |
| 169 | if (is_mac) { |
| 170 | # mach/ are not globally filtered. |
| 171 | sources += [ |
| 172 | "mach/child_port_handshake.cc", |
| 173 | "mach/child_port_handshake.h", |
| 174 | "mach/child_port_server.cc", |
| 175 | "mach/child_port_server.h", |
| 176 | "mach/child_port_types.h", |
| 177 | "mach/composite_mach_message_server.cc", |
| 178 | "mach/composite_mach_message_server.h", |
| 179 | "mach/exc_client_variants.cc", |
| 180 | "mach/exc_client_variants.h", |
| 181 | "mach/exc_server_variants.cc", |
| 182 | "mach/exc_server_variants.h", |
| 183 | "mach/exception_behaviors.cc", |
| 184 | "mach/exception_behaviors.h", |
| 185 | "mach/exception_ports.cc", |
| 186 | "mach/exception_ports.h", |
| 187 | "mach/exception_types.cc", |
| 188 | "mach/exception_types.h", |
| 189 | "mach/mach_extensions.cc", |
| 190 | "mach/mach_extensions.h", |
| 191 | "mach/mach_message.cc", |
| 192 | "mach/mach_message.h", |
| 193 | "mach/mach_message_server.cc", |
| 194 | "mach/mach_message_server.h", |
| 195 | "mach/notify_server.cc", |
| 196 | "mach/notify_server.h", |
| 197 | "mach/scoped_task_suspend.cc", |
| 198 | "mach/scoped_task_suspend.h", |
| 199 | "mach/symbolic_constants_mach.cc", |
| 200 | "mach/symbolic_constants_mach.h", |
| 201 | "mach/task_for_pid.cc", |
| 202 | "mach/task_for_pid.h", |
| 203 | "mach/task_memory.cc", |
| 204 | "mach/task_memory.h", |
| 205 | ] |
| 206 | } |
| 207 | |
| 208 | # Include files from here and generated files starting with "util". |
| 209 | include_dirs = [ |
| 210 | "..", |
| 211 | "$root_gen_dir/third_party/crashpad/crashpad", |
| 212 | ] |
| 213 | |
| 214 | all_dependent_configs = [ ":util_link_config" ] |
| 215 | |
| 216 | deps = [ |
| 217 | "//base", |
| 218 | "//third_party/crashpad/crashpad/compat", |
| 219 | ] |
| 220 | |
| 221 | if (is_win) { |
| 222 | libs = [ |
| 223 | "rpcrt4.lib", |
| 224 | "winhttp.lib", |
| 225 | ] |
| 226 | cflags = [ |
| 227 | "/wd4201", # nonstandard extension used : nameless struct/union. |
| 228 | "/wd4577", # 'noexcept' used with no exception handling mode specified. |
| 229 | ] |
| 230 | |
| 231 | if (current_cpu == "x86") { |
| 232 | asmflags = [ "/safeseh" ] |
| 233 | } |
| 234 | } else if (is_mac) { |
| 235 | sources += get_target_outputs(":mig") |
| 236 | deps += [ ":mig" ] |
| 237 | libs = [ |
| 238 | "CoreFoundation.framework", |
| 239 | "Foundation.framework", |
| 240 | "IOKit.framework", |
| 241 | ] |
| 242 | } |
| 243 | } |