mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 1 | # Copyright 2016 Google Inc. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | declare_args() { |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 7 | ar = "ar" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 8 | cc = "cc" |
| 9 | cxx = "c++" |
mtklein | 8079ba6 | 2016-08-16 09:31:16 -0700 | [diff] [blame] | 10 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 11 | if (is_android) { |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 12 | if (host_os == "win") { |
Mike Klein | 67702f6 | 2016-12-09 10:32:28 -0500 | [diff] [blame] | 13 | ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar.exe" |
| 14 | cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang.exe" |
| 15 | cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++.exe" |
| 16 | } else { |
| 17 | ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" |
| 18 | cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" |
| 19 | cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 20 | } |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 21 | } |
| 22 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 23 | windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 24 | |
Mike Klein | 121563e | 2016-10-04 17:09:13 -0400 | [diff] [blame] | 25 | extra_cflags = [] |
| 26 | extra_cflags_c = [] |
| 27 | extra_cflags_cc = [] |
| 28 | extra_ldflags = [] |
mtklein | cab0bb7 | 2016-08-26 13:43:19 -0700 | [diff] [blame] | 29 | |
mtklein | 60b7ab7 | 2016-09-20 12:09:12 -0700 | [diff] [blame] | 30 | cc_wrapper = "" |
Herb Derby | 76073c1 | 2016-12-08 19:00:40 -0500 | [diff] [blame] | 31 | malloc = "" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 32 | } |
| 33 | |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 34 | if (host_os == "win") { |
| 35 | python = "python.bat" |
| 36 | stamp = "cmd.exe /c echo >" |
| 37 | } else { |
| 38 | python = "python" |
| 39 | stamp = "touch" |
| 40 | } |
| 41 | |
Mike Klein | 87c36f2 | 2016-11-13 10:29:25 -0500 | [diff] [blame] | 42 | is_clang = is_android || is_ios || is_mac || (cc == "clang" && cxx == "clang++") |
| 43 | if (!is_clang && !is_win) { |
Mike Klein | 461d328 | 2016-10-11 13:51:55 -0400 | [diff] [blame] | 44 | is_clang = exec_script("is_clang.py", |
| 45 | [ |
| 46 | cc, |
| 47 | cxx, |
| 48 | ], |
| 49 | "value") |
| 50 | } |
mtklein | f347c51 | 2016-09-26 08:40:12 -0700 | [diff] [blame] | 51 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 52 | if (is_ios) { |
| 53 | ios_sysroot = exec_script("find_ios_sysroot.py", [], "trim string") |
| 54 | } |
| 55 | |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 56 | config("default") { |
| 57 | asmflags = [] |
| 58 | cflags = [] |
| 59 | cflags_c = [] |
| 60 | cflags_cc = [] |
| 61 | defines = [] |
| 62 | ldflags = [] |
Herb Derby | 76073c1 | 2016-12-08 19:00:40 -0500 | [diff] [blame] | 63 | libs = [] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 64 | |
| 65 | if (is_win) { |
| 66 | cflags += [ |
| 67 | "/FS", # Preserve previous PDB behavior. |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 68 | "/bigobj", # Some of our files are bigger than the regular limits. |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 69 | "/WX", # Treat warnings as errors. |
Ben Wagner | e6b274e | 2017-01-03 17:09:59 -0500 | [diff] [blame] | 70 | "/utf-8", # Set Source and Executable character sets to UTF-8. |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 71 | ] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 72 | defines += [ |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 73 | "_CRT_SECURE_NO_WARNINGS", # Disables warnings about sscanf(). |
| 74 | "_HAS_EXCEPTIONS=0", # Disables exceptions in MSVC STL. |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 75 | "WIN32_LEAN_AND_MEAN", |
| 76 | "NOMINMAX", |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 77 | ] |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 78 | include_dirs = [ |
Mike Klein | d301683 | 2016-10-12 15:52:44 -0400 | [diff] [blame] | 79 | "$windk/VC/include", |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 80 | |
Mike Klein | d301683 | 2016-10-12 15:52:44 -0400 | [diff] [blame] | 81 | # For local builds. |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 82 | "$windk/../Windows Kits/10/Include/10.0.10150.0/ucrt", |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 83 | "$windk/../Windows Kits/8.1/Include/shared", |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 84 | "$windk/../Windows Kits/8.1/Include/um", |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 85 | "$windk/../Windows Kits/8.1/Include/winrt", |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 86 | |
Mike Klein | d301683 | 2016-10-12 15:52:44 -0400 | [diff] [blame] | 87 | # For builds using win_toolchain asset. |
Brian Osman | 3f28933 | 2017-01-10 10:38:23 -0500 | [diff] [blame] | 88 | "$windk/win_sdk/Include/10.0.14393.0/shared", |
| 89 | "$windk/win_sdk/Include/10.0.14393.0/ucrt", |
| 90 | "$windk/win_sdk/Include/10.0.14393.0/um", |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 91 | "$windk/win_sdk/Include/10.0.14393.0/winrt", |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 92 | ] |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 93 | lib_dirs = [ |
Mike Klein | d301683 | 2016-10-12 15:52:44 -0400 | [diff] [blame] | 94 | # For local builds. |
Mike Klein | 0bc5a76 | 2016-10-12 22:42:55 -0400 | [diff] [blame] | 95 | "$windk/../Windows Kits/10/Lib/10.0.10150.0/ucrt/$target_cpu", |
| 96 | "$windk/../Windows Kits/8.1/Lib/winv6.3/um/$target_cpu", |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 97 | |
Mike Klein | d301683 | 2016-10-12 15:52:44 -0400 | [diff] [blame] | 98 | # For builds using win_toolchain asset. |
Brian Osman | 3f28933 | 2017-01-10 10:38:23 -0500 | [diff] [blame] | 99 | "$windk/win_sdk/Lib/10.0.14393.0/ucrt/$target_cpu", |
| 100 | "$windk/win_sdk/Lib/10.0.14393.0/um/$target_cpu", |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 101 | ] |
Mike Klein | 0bc5a76 | 2016-10-12 22:42:55 -0400 | [diff] [blame] | 102 | if (target_cpu == "x86") { |
| 103 | lib_dirs += [ "$windk/VC/lib" ] |
| 104 | } else { |
| 105 | lib_dirs += [ "$windk/VC/lib/amd64" ] |
| 106 | } |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 107 | } else { |
| 108 | cflags += [ |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 109 | "-fstrict-aliasing", |
| 110 | "-fPIC", |
| 111 | "-fvisibility=hidden", |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 112 | "-Werror", |
mtklein | 2b3c2a3 | 2016-09-08 08:39:34 -0700 | [diff] [blame] | 113 | ] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 114 | cflags_cc += [ |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 115 | "-std=c++11", |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 116 | "-fno-threadsafe-statics", |
| 117 | "-fvisibility-inlines-hidden", |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 118 | ] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 119 | } |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 120 | |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 121 | if (current_cpu == "arm") { |
| 122 | cflags += [ |
| 123 | "-march=armv7-a", |
| 124 | "-mfpu=neon", |
| 125 | "-mthumb", |
| 126 | ] |
| 127 | } else if (current_cpu == "mipsel") { |
| 128 | cflags += [ |
| 129 | "-march=mips32r2", |
| 130 | "-mdspr2", |
| 131 | ] |
Mike Klein | 5d8cf29 | 2016-10-12 19:36:09 -0400 | [diff] [blame] | 132 | } else if (current_cpu == "x86" && !is_win) { |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 133 | asmflags += [ "-m32" ] |
| 134 | cflags += [ |
| 135 | "-m32", |
| 136 | "-msse2", |
| 137 | "-mfpmath=sse", |
| 138 | ] |
| 139 | ldflags += [ "-m32" ] |
| 140 | } |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 141 | |
Herb Derby | 76073c1 | 2016-12-08 19:00:40 -0500 | [diff] [blame] | 142 | if (malloc != "" && !is_win) { |
| 143 | cflags += [ |
| 144 | "-fno-builtin-malloc", |
| 145 | "-fno-builtin-calloc", |
| 146 | "-fno-builtin-realloc", |
| 147 | "-fno-builtin-free", |
| 148 | ] |
| 149 | libs += [ malloc ] |
| 150 | } |
| 151 | |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 152 | if (is_android) { |
| 153 | asmflags += [ |
| 154 | "--target=$ndk_target", |
| 155 | "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin", |
| 156 | ] |
| 157 | cflags += [ |
| 158 | "--sysroot=$ndk/platforms/$ndk_platform", |
| 159 | "--target=$ndk_target", |
| 160 | "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin", |
| 161 | ] |
| 162 | cflags_cc += [ |
| 163 | "-isystem$ndk/sources/android/support/include", |
Mike Klein | b7ce80b | 2016-12-14 13:17:53 -0500 | [diff] [blame] | 164 | "-isystem$ndk/sources/cxx-stl/gnu-libstdc++/4.9/include", |
| 165 | "-isystem$ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ndk_stdlib/include", |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 166 | ] |
| 167 | ldflags += [ |
| 168 | "--sysroot=$ndk/platforms/$ndk_platform", |
| 169 | "--target=$ndk_target", |
| 170 | "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin", |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 171 | ] |
| 172 | lib_dirs = [ |
Mike Klein | b7ce80b | 2016-12-14 13:17:53 -0500 | [diff] [blame] | 173 | "$ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ndk_stdlib", |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 174 | "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/lib/gcc/$ndk_target/4.9.x", |
| 175 | ] |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 176 | |
Mike Klein | 4fdc543 | 2016-10-11 11:21:36 -0400 | [diff] [blame] | 177 | if (current_cpu == "mips64el") { |
| 178 | # The r13 NDK omits /usr/lib from the MIPS64 sysroots, but Clang searches |
| 179 | # for /usr/lib64 as $PATH_TO_USR_LIB/../lib64. If there's no /usr/lib, |
| 180 | # it can't find /usr/lib64. We must point Clang at /usr/lib64 manually. |
| 181 | lib_dirs += [ "$ndk/platforms/$ndk_platform/usr/lib64" ] |
Mike Klein | 978cceb | 2016-12-08 10:29:27 -0500 | [diff] [blame] | 182 | ldflags += [ "-B$ndk/platforms/$ndk_platform/usr/lib64" ] |
Mike Klein | 4fdc543 | 2016-10-11 11:21:36 -0400 | [diff] [blame] | 183 | } |
| 184 | |
Mike Klein | b7ce80b | 2016-12-14 13:17:53 -0500 | [diff] [blame] | 185 | libs += [ "gnustl_static" ] |
mtklein | 2b3c2a3 | 2016-09-08 08:39:34 -0700 | [diff] [blame] | 186 | } |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 187 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 188 | if (is_ios) { |
Mike Klein | b48fd3c | 2017-01-23 11:58:53 -0500 | [diff] [blame] | 189 | _target = target_cpu |
| 190 | if (target_cpu == "arm") { |
| 191 | _target = "armv7" |
| 192 | } |
Mike Klein | 4fe2b15 | 2017-02-17 15:36:01 -0500 | [diff] [blame^] | 193 | asmflags += [ |
| 194 | "-isysroot", |
| 195 | ios_sysroot, |
| 196 | "-arch", |
| 197 | _target, |
| 198 | ] |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 199 | cflags += [ |
Mike Klein | 6749af4 | 2016-11-07 15:38:48 -0500 | [diff] [blame] | 200 | "-isysroot", |
| 201 | ios_sysroot, |
| 202 | "-arch", |
Mike Klein | b48fd3c | 2017-01-23 11:58:53 -0500 | [diff] [blame] | 203 | _target, |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 204 | ] |
| 205 | cflags_cc += [ "-stdlib=libc++" ] |
| 206 | ldflags += [ |
Mike Klein | 6749af4 | 2016-11-07 15:38:48 -0500 | [diff] [blame] | 207 | "-isysroot", |
| 208 | ios_sysroot, |
| 209 | "-arch", |
Mike Klein | b48fd3c | 2017-01-23 11:58:53 -0500 | [diff] [blame] | 210 | _target, |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 211 | "-stdlib=libc++", |
| 212 | ] |
Herb Derby | 76073c1 | 2016-12-08 19:00:40 -0500 | [diff] [blame] | 213 | libs += [ "objc" ] |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 214 | } |
| 215 | |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 216 | if (is_linux) { |
Herb Derby | 76073c1 | 2016-12-08 19:00:40 -0500 | [diff] [blame] | 217 | libs += [ "pthread" ] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | if (sanitize != "") { |
| 221 | # You can either pass the sanitizers directly, e.g. "address,undefined", |
| 222 | # or pass one of the couple common aliases used by the bots. |
| 223 | sanitizers = sanitize |
| 224 | if (sanitize == "ASAN") { |
| 225 | sanitizers = "address,bool,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound,vptr" |
| 226 | } else if (sanitize == "TSAN") { |
| 227 | sanitizers = "thread" |
| 228 | } else if (sanitize == "MSAN") { |
| 229 | sanitizers = "memory" |
| 230 | } |
| 231 | |
| 232 | cflags += [ |
| 233 | "-fsanitize=$sanitizers", |
| 234 | "-fno-sanitize-recover=$sanitizers", |
| 235 | "-fsanitize-blacklist=" + rebase_path("../tools/xsan.blacklist"), |
| 236 | ] |
| 237 | ldflags += [ "-fsanitize=$sanitizers" ] |
| 238 | if (sanitizers == "memory") { |
| 239 | cflags += [ "-fsanitize-memory-track-origins" ] |
| 240 | cflags_cc += [ "-stdlib=libc++" ] |
| 241 | ldflags += [ "-stdlib=libc++" ] |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
Mike Klein | 6e55fef | 2016-10-26 11:41:47 -0400 | [diff] [blame] | 246 | config("no_exceptions") { |
| 247 | # Exceptions are disabled by default on Windows. (Use /EHsc to enable them.) |
| 248 | if (!is_win) { |
| 249 | cflags_cc = [ "-fno-exceptions" ] |
| 250 | } |
| 251 | } |
| 252 | |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 253 | config("warnings") { |
| 254 | cflags = [] |
| 255 | cflags_cc = [] |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 256 | cflags_objc = [] |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 257 | if (is_win) { |
| 258 | cflags += [ |
| 259 | "/W3", # Turn on lots of warnings. |
| 260 | |
| 261 | # Disable a bunch of warnings: |
| 262 | "/wd4244", # conversion from 'float' to 'int', possible loss of data |
| 263 | "/wd4267", # conversion from 'size_t' to 'int', possible loss of data |
| 264 | "/wd4800", # forcing value to bool 'true' or 'false' (performance warning) |
| 265 | |
| 266 | # Probably only triggers when /EHsc is enabled. |
| 267 | "/wd4291", # no matching operator delete found; |
| 268 | # memory will not be freed if initialization throws an exception |
| 269 | ] |
| 270 | } else { |
| 271 | cflags += [ |
| 272 | "-Wall", |
| 273 | "-Wextra", |
| 274 | "-Winit-self", |
| 275 | "-Wpointer-arith", |
| 276 | "-Wsign-compare", |
| 277 | "-Wvla", |
| 278 | |
| 279 | "-Wno-deprecated-declarations", |
Mike Klein | db402ca | 2016-12-13 12:46:05 -0500 | [diff] [blame] | 280 | "-Wno-maybe-uninitialized", |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 281 | ] |
| 282 | cflags_cc += [ "-Wnon-virtual-dtor" ] |
| 283 | |
| 284 | if (is_clang) { |
| 285 | cflags += [ |
| 286 | "-Weverything", |
| 287 | "-Wno-unknown-warning-option", # Let older Clangs ignore newer Clangs' warnings. |
| 288 | ] |
| 289 | |
Mike Klein | b48fd3c | 2017-01-23 11:58:53 -0500 | [diff] [blame] | 290 | if ((target_cpu == "x86" && is_android) || |
| 291 | (target_cpu == "arm" && is_ios)) { |
| 292 | # Clang seems to think new/malloc will only be 4-byte aligned on x86 Android and 32-bit iOS. |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 293 | # We're pretty sure it's actually 8-byte alignment. |
| 294 | cflags += [ "-Wno-over-aligned" ] |
| 295 | } |
| 296 | |
| 297 | cflags += [ |
| 298 | "-Wno-cast-align", |
| 299 | "-Wno-conditional-uninitialized", |
| 300 | "-Wno-conversion", |
| 301 | "-Wno-disabled-macro-expansion", |
| 302 | "-Wno-documentation", |
| 303 | "-Wno-documentation-unknown-command", |
| 304 | "-Wno-double-promotion", |
| 305 | "-Wno-exit-time-destructors", # TODO: OK outside libskia |
| 306 | "-Wno-float-conversion", |
| 307 | "-Wno-float-equal", |
| 308 | "-Wno-format-nonliteral", |
| 309 | "-Wno-global-constructors", # TODO: OK outside libskia |
| 310 | "-Wno-gnu-zero-variadic-macro-arguments", |
| 311 | "-Wno-missing-prototypes", |
| 312 | "-Wno-missing-variable-declarations", |
| 313 | "-Wno-pedantic", |
| 314 | "-Wno-reserved-id-macro", |
| 315 | "-Wno-shadow", |
| 316 | "-Wno-shift-sign-overflow", |
| 317 | "-Wno-sign-conversion", |
Matt Sarett | d3ed402 | 2017-01-04 17:13:44 -0500 | [diff] [blame] | 318 | "-Wno-signed-enum-bitfield", |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 319 | "-Wno-switch-enum", |
| 320 | "-Wno-undef", |
| 321 | "-Wno-unreachable-code", |
| 322 | "-Wno-unreachable-code-break", |
| 323 | "-Wno-unreachable-code-return", |
| 324 | "-Wno-unused-macros", |
| 325 | "-Wno-unused-member-function", |
| 326 | ] |
| 327 | cflags_cc += [ |
| 328 | "-Wno-abstract-vbase-init", |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 329 | "-Wno-weak-vtables", |
| 330 | ] |
| 331 | |
| 332 | # We are unlikely to want to fix these. |
| 333 | cflags += [ |
| 334 | "-Wno-covered-switch-default", |
| 335 | "-Wno-deprecated", |
| 336 | "-Wno-implicit-fallthrough", |
| 337 | "-Wno-missing-noreturn", |
| 338 | "-Wno-old-style-cast", |
| 339 | "-Wno-padded", |
| 340 | ] |
| 341 | cflags_cc += [ |
| 342 | "-Wno-c++98-compat", |
| 343 | "-Wno-c++98-compat-pedantic", |
| 344 | "-Wno-undefined-func-template", |
| 345 | ] |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 346 | cflags_objc += [ |
| 347 | "-Wno-direct-ivar-access", |
| 348 | "-Wno-objc-interface-ivars", |
| 349 | ] |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 350 | } |
| 351 | } |
| 352 | } |
Mike Klein | 50500ad | 2016-11-16 12:13:44 -0500 | [diff] [blame] | 353 | config("warnings_except_public_headers") { |
| 354 | if (!is_win) { |
| 355 | cflags = [ "-Wno-unused-parameter" ] |
| 356 | } |
| 357 | } |
Mike Klein | c7165c2 | 2016-10-12 23:58:06 -0400 | [diff] [blame] | 358 | |
Mike Klein | 121563e | 2016-10-04 17:09:13 -0400 | [diff] [blame] | 359 | config("extra_flags") { |
| 360 | cflags = extra_cflags |
| 361 | cflags_c = extra_cflags_c |
| 362 | cflags_cc = extra_cflags_cc |
| 363 | ldflags = extra_ldflags |
| 364 | } |
| 365 | |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 366 | config("debug_symbols") { |
| 367 | # It's annoying to wait for full debug symbols to push over |
| 368 | # to Android devices. -gline-tables-only is a lot slimmer. |
| 369 | if (is_android) { |
| 370 | cflags = [ "-gline-tables-only" ] |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 371 | } else if (is_win) { |
| 372 | cflags = [ "/Zi" ] |
Mike Klein | 5286d6c | 2016-10-13 13:19:25 -0400 | [diff] [blame] | 373 | ldflags = [ "/DEBUG" ] |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 374 | } else { |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 375 | cflags = [ "-g" ] |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | config("no_rtti") { |
| 380 | if (sanitize != "ASAN") { # -fsanitize=vptr requires RTTI |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 381 | if (is_win) { |
| 382 | cflags_cc = [ "/GR-" ] |
| 383 | } else { |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 384 | cflags_cc = [ "-fno-rtti" ] |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | config("release") { |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 390 | if (is_win) { |
Mike Klein | 916ca1d | 2016-10-20 13:34:18 -0400 | [diff] [blame] | 391 | cflags = [ |
| 392 | "/O2", |
| 393 | "/Zc:inline", |
Mike Klein | 8ffb260 | 2016-10-20 15:45:02 -0400 | [diff] [blame] | 394 | "/GS-", |
Mike Klein | 916ca1d | 2016-10-20 13:34:18 -0400 | [diff] [blame] | 395 | ] |
Mike Klein | 90a381f | 2016-10-20 13:52:38 -0400 | [diff] [blame] | 396 | ldflags = [ |
| 397 | "/OPT:ICF", |
| 398 | "/OPT:REF", |
| 399 | ] |
Mike Klein | cc300a1 | 2016-10-12 16:25:27 -0400 | [diff] [blame] | 400 | } else { |
Mike Klein | 0bcfeac | 2016-10-19 22:24:10 -0400 | [diff] [blame] | 401 | cflags = [ |
| 402 | "-O3", |
Mike Klein | bd9be4d | 2017-02-10 07:59:39 -0500 | [diff] [blame] | 403 | "-fdata-sections", |
| 404 | "-ffunction-sections", |
Mike Klein | 0bcfeac | 2016-10-19 22:24:10 -0400 | [diff] [blame] | 405 | "-momit-leaf-frame-pointer", |
| 406 | ] |
Mike Klein | bd9be4d | 2017-02-10 07:59:39 -0500 | [diff] [blame] | 407 | if (is_mac || is_ios) { |
| 408 | ldflags = [ "-dead_strip" ] |
| 409 | } else { |
| 410 | ldflags = [ "-Wl,--gc-sections" ] |
| 411 | } |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 412 | } |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 413 | defines = [ "NDEBUG" ] |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | config("executable") { |
Mike Klein | c5875fb | 2016-12-06 10:46:02 -0500 | [diff] [blame] | 417 | if (is_android) { |
| 418 | ldflags = [ "-pie" ] |
| 419 | } else if (is_mac) { |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 420 | ldflags = [ "-Wl,-rpath,@loader_path/." ] |
| 421 | } else if (is_linux) { |
mtklein | a846c72 | 2016-09-15 10:44:15 -0700 | [diff] [blame] | 422 | ldflags = [ |
| 423 | "-rdynamic", |
| 424 | "-Wl,-rpath,\$ORIGIN", |
| 425 | ] |
Mike Klein | 4b6b503 | 2016-11-06 11:54:19 -0500 | [diff] [blame] | 426 | } else if (is_win) { |
| 427 | ldflags = [ |
| 428 | "/SUBSYSTEM:CONSOLE", # Quiet "no subsystem specified; CONSOLE assumed". |
| 429 | "/INCREMENTAL:NO", # Quiet warnings about failing to incrementally link by never trying to. |
| 430 | ] |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 431 | } |
| 432 | } |
| 433 | |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 434 | toolchain("msvc") { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 435 | lib_dir_switch = "/LIBPATH:" |
| 436 | |
Mike Klein | 0bc5a76 | 2016-10-12 22:42:55 -0400 | [diff] [blame] | 437 | bin = "$windk/VC/bin/amd64" |
| 438 | env_setup = "" |
| 439 | if (target_cpu == "x86") { |
| 440 | bin += "_x86" |
| 441 | env_setup = "cmd /c $windk/win_sdk/bin/SetEnv.cmd /x86 && " |
| 442 | } |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 443 | |
| 444 | tool("cc") { |
| 445 | rspfile = "{{output}}.rsp" |
| 446 | precompiled_header_type = "msvc" |
| 447 | pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" |
| 448 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 449 | # Label names may have spaces so pdbname must be quoted. |
Mike Klein | 0bc5a76 | 2016-10-12 22:42:55 -0400 | [diff] [blame] | 450 | command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 451 | depsformat = "msvc" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 452 | outputs = [ |
| 453 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 454 | ] |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 455 | rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}" |
Mike Klein | c756e86 | 2016-10-13 14:31:01 -0400 | [diff] [blame] | 456 | description = "compile {{source}}" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | tool("cxx") { |
| 460 | rspfile = "{{output}}.rsp" |
| 461 | precompiled_header_type = "msvc" |
| 462 | pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" |
| 463 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 464 | # Label names may have spaces so pdbname must be quoted. |
Mike Klein | 0bc5a76 | 2016-10-12 22:42:55 -0400 | [diff] [blame] | 465 | command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 466 | depsformat = "msvc" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 467 | outputs = [ |
| 468 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", |
| 469 | ] |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 470 | rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}" |
Mike Klein | c756e86 | 2016-10-13 14:31:01 -0400 | [diff] [blame] | 471 | description = "compile {{source}}" |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 472 | } |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 473 | |
| 474 | tool("alink") { |
| 475 | rspfile = "{{output}}.rsp" |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 476 | |
Mike Klein | c756e86 | 2016-10-13 14:31:01 -0400 | [diff] [blame] | 477 | command = "$env_setup$bin/lib.exe /nologo /ignore:4221 {{arflags}} /OUT:{{output}} @$rspfile" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 478 | outputs = [ |
| 479 | # Ignore {{output_extension}} and always use .lib, there's no reason to |
| 480 | # allow targets to override this extension on Windows. |
| 481 | "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
| 482 | ] |
| 483 | default_output_extension = ".lib" |
| 484 | default_output_dir = "{{target_out_dir}}" |
| 485 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 486 | # inputs_newline works around a fixed per-line buffer size in the linker. |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 487 | rspfile_content = "{{inputs_newline}}" |
Mike Klein | c756e86 | 2016-10-13 14:31:01 -0400 | [diff] [blame] | 488 | description = "link {{output}}" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 489 | } |
| 490 | |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 491 | tool("solink") { |
| 492 | dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| 493 | libname = "${dllname}.lib" |
| 494 | pdbname = "${dllname}.pdb" |
| 495 | rspfile = "${dllname}.rsp" |
| 496 | |
| 497 | command = "$env_setup$bin/link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
| 498 | outputs = [ |
| 499 | dllname, |
| 500 | libname, |
| 501 | pdbname, |
| 502 | ] |
| 503 | default_output_extension = ".dll" |
| 504 | default_output_dir = "{{root_out_dir}}" |
| 505 | |
| 506 | link_output = libname |
| 507 | depend_output = libname |
| 508 | runtime_outputs = [ |
| 509 | dllname, |
| 510 | pdbname, |
| 511 | ] |
| 512 | |
| 513 | # I don't quite understand this. Aping Chrome's toolchain/win/BUILD.gn. |
| 514 | restat = true |
| 515 | |
| 516 | # inputs_newline works around a fixed per-line buffer size in the linker. |
| 517 | rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}" |
| 518 | description = "link {{output}}" |
| 519 | } |
| 520 | |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 521 | tool("link") { |
| 522 | exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" |
| 523 | pdbname = "$exename.pdb" |
| 524 | rspfile = "$exename.rsp" |
| 525 | |
Mike Klein | 0bc5a76 | 2016-10-12 22:42:55 -0400 | [diff] [blame] | 526 | command = |
| 527 | "$env_setup$bin/link.exe /nologo /OUT:$exename /PDB:$pdbname @$rspfile" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 528 | |
| 529 | default_output_extension = ".exe" |
| 530 | default_output_dir = "{{root_out_dir}}" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 531 | outputs = [ |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 532 | exename, |
| 533 | ] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 534 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 535 | # inputs_newline works around a fixed per-line buffer size in the linker. |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 536 | rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}" |
Mike Klein | c756e86 | 2016-10-13 14:31:01 -0400 | [diff] [blame] | 537 | description = "link {{output}}" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 538 | } |
| 539 | |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 540 | tool("stamp") { |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 541 | command = "$stamp {{output}}" |
Mike Klein | c756e86 | 2016-10-13 14:31:01 -0400 | [diff] [blame] | 542 | description = "stamp {{output}}" |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 543 | } |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 544 | |
| 545 | tool("copy") { |
| 546 | cp_py = rebase_path("cp.py") |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 547 | command = "$python $cp_py {{source}} {{output}}" |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 548 | description = "copy {{source}} {{output}}" |
| 549 | } |
herb | b6318bf | 2016-09-16 13:29:57 -0700 | [diff] [blame] | 550 | } |
| 551 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 552 | toolchain("gcc_like") { |
| 553 | lib_switch = "-l" |
| 554 | lib_dir_switch = "-L" |
| 555 | |
| 556 | tool("cc") { |
| 557 | depfile = "{{output}}.d" |
Mike Klein | 121563e | 2016-10-04 17:09:13 -0400 | [diff] [blame] | 558 | command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 559 | depsformat = "gcc" |
| 560 | outputs = [ |
| 561 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 562 | ] |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 563 | description = "compile {{source}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 564 | } |
| 565 | |
| 566 | tool("cxx") { |
| 567 | depfile = "{{output}}.d" |
Mike Klein | 121563e | 2016-10-04 17:09:13 -0400 | [diff] [blame] | 568 | command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 569 | depsformat = "gcc" |
| 570 | outputs = [ |
| 571 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 572 | ] |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 573 | description = "compile {{source}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 574 | } |
| 575 | |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 576 | tool("objc") { |
| 577 | depfile = "{{output}}.d" |
| 578 | command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objc}} -c {{source}} -o {{output}}" |
| 579 | depsformat = "gcc" |
| 580 | outputs = [ |
| 581 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 582 | ] |
| 583 | description = "compile {{source}}" |
| 584 | } |
| 585 | |
| 586 | tool("objcxx") { |
| 587 | depfile = "{{output}}.d" |
| 588 | command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objc}} -c {{source}} -o {{output}}" |
| 589 | depsformat = "gcc" |
| 590 | outputs = [ |
| 591 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 592 | ] |
| 593 | description = "compile {{source}}" |
| 594 | } |
| 595 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 596 | tool("asm") { |
| 597 | depfile = "{{output}}.d" |
mtklein | 60b7ab7 | 2016-09-20 12:09:12 -0700 | [diff] [blame] | 598 | command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 599 | depsformat = "gcc" |
| 600 | outputs = [ |
| 601 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 602 | ] |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 603 | description = "compile {{source}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | tool("alink") { |
Mike Klein | 44b36a2 | 2016-11-06 11:20:09 -0500 | [diff] [blame] | 607 | rspfile = "{{output}}.rsp" |
| 608 | rspfile_content = "{{inputs}}" |
| 609 | ar_py = rebase_path("ar.py") |
| 610 | command = "$python $ar_py $ar {{output}} $rspfile" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 611 | outputs = [ |
mtklein | 5db44aa | 2016-07-29 09:10:31 -0700 | [diff] [blame] | 612 | "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 613 | ] |
| 614 | default_output_extension = ".a" |
| 615 | output_prefix = "lib" |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 616 | description = "link {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | tool("solink") { |
| 620 | soname = "{{target_output_name}}{{output_extension}}" |
| 621 | |
| 622 | rpath = "-Wl,-soname,$soname" |
| 623 | if (is_mac) { |
| 624 | rpath = "-Wl,-install_name,@rpath/$soname" |
| 625 | } |
| 626 | |
Mike Klein | 121563e | 2016-10-04 17:09:13 -0400 | [diff] [blame] | 627 | command = "$cc_wrapper $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 628 | outputs = [ |
| 629 | "{{root_out_dir}}/$soname", |
| 630 | ] |
| 631 | output_prefix = "lib" |
| 632 | default_output_extension = ".so" |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 633 | description = "link {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | tool("link") { |
Mike Klein | 121563e | 2016-10-04 17:09:13 -0400 | [diff] [blame] | 637 | command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 638 | outputs = [ |
| 639 | "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
| 640 | ] |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 641 | description = "link {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | tool("stamp") { |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 645 | command = "$stamp {{output}}" |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 646 | description = "stamp {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | tool("copy") { |
Mike Klein | 1a8d675 | 2016-10-17 11:51:11 -0400 | [diff] [blame] | 650 | cp_py = rebase_path("cp.py") |
Mike Klein | 82364ba | 2016-10-24 16:49:15 -0400 | [diff] [blame] | 651 | command = "$python $cp_py {{source}} {{output}}" |
Mike Klein | 24267ff | 2016-10-17 10:41:41 -0400 | [diff] [blame] | 652 | description = "copy {{source}} {{output}}" |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 653 | } |
| 654 | } |