mtklein | c04ff47 | 2016-06-23 10:29:30 -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() { |
| 7 | } |
| 8 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 9 | skia_public_includes = [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 10 | "include/android", |
mtklein | fa84d94 | 2016-07-28 09:45:14 -0700 | [diff] [blame] | 11 | "include/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 12 | "include/codec", |
| 13 | "include/config", |
| 14 | "include/core", |
| 15 | "include/effects", |
| 16 | "include/gpu", |
| 17 | "include/gpu/gl", |
| 18 | "include/images", |
| 19 | "include/pathops", |
| 20 | "include/ports", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 21 | "include/svg", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 22 | "include/utils", |
| 23 | "include/utils/mac", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 24 | "include/xml", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 25 | ] |
| 26 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 27 | # Skia public API, generally provided by :skia. |
| 28 | config("skia_public") { |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 29 | include_dirs = skia_public_includes |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 30 | defines = [ "SKIA_DLL" ] |
| 31 | } |
| 32 | |
| 33 | # Skia internal APIs, used by Skia itself and a few test tools. |
| 34 | config("skia_private") { |
| 35 | visibility = [ ":*" ] |
| 36 | |
| 37 | include_dirs = [ |
| 38 | "include/private", |
| 39 | "src/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 40 | "src/codec", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 41 | "src/config", |
| 42 | "src/core", |
| 43 | "src/effects", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 44 | "src/effects/gradients", |
| 45 | "src/fonts", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 46 | "src/gpu", |
| 47 | "src/image", |
| 48 | "src/images", |
| 49 | "src/lazy", |
| 50 | "src/opts", |
| 51 | "src/pathops", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 52 | "src/pdf", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 53 | "src/ports", |
| 54 | "src/sfnt", |
| 55 | "src/utils", |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 56 | "src/utils/win", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 57 | "third_party/etc1", |
| 58 | "third_party/ktx", |
| 59 | ] |
mtklein | 150d113 | 2016-08-01 06:56:40 -0700 | [diff] [blame] | 60 | |
| 61 | defines = [ |
mtklein | 9be6866 | 2016-08-01 08:37:48 -0700 | [diff] [blame] | 62 | "SK_GAMMA_APPLY_TO_A8", |
| 63 | |
mtklein | 150d113 | 2016-08-01 06:56:40 -0700 | [diff] [blame] | 64 | "SK_HAS_GIF_LIBRARY", |
| 65 | "SK_HAS_JPEG_LIBRARY", |
| 66 | "SK_HAS_PNG_LIBRARY", |
| 67 | "SK_HAS_WEBP_LIBRARY", |
mtklein | 7c1ae7a | 2016-08-01 15:50:27 -0700 | [diff] [blame] | 68 | |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 69 | # TODO(halcanary): make this the default; this is the value Android uses. |
| 70 | "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"", |
| 71 | |
mtklein | 7c1ae7a | 2016-08-01 15:50:27 -0700 | [diff] [blame] | 72 | "TURBO_HAS_565", |
| 73 | "TURBO_HAS_CROP", |
| 74 | "TURBO_HAS_SKIP", |
mtklein | 150d113 | 2016-08-01 06:56:40 -0700 | [diff] [blame] | 75 | ] |
mtklein | ee269f4 | 2016-08-04 09:52:11 -0700 | [diff] [blame] | 76 | if (is_linux) { |
| 77 | defines += [ "SK_SAMPLES_FOR_X" ] |
| 78 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | # Any code that's linked into Skia-the-library should use this config via += skia_library_configs. |
| 82 | config("skia_library") { |
| 83 | visibility = [ ":*" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 84 | defines = [ "SKIA_IMPLEMENTATION=1" ] |
| 85 | } |
| 86 | |
| 87 | skia_library_configs = [ |
| 88 | ":skia_public", |
| 89 | ":skia_private", |
| 90 | ":skia_library", |
| 91 | ] |
| 92 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 93 | core_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 94 | [ |
| 95 | rebase_path("gyp/core.gypi"), |
| 96 | "--replace=<(skia_include_path)=include", |
| 97 | "--replace=<(skia_src_path)=src", |
| 98 | ], |
| 99 | "scope", |
| 100 | [ "gyp/core.gypi" ]) |
| 101 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 102 | effects_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 103 | [ |
| 104 | rebase_path("gyp/effects.gypi"), |
| 105 | "--replace=<(skia_include_path)=include", |
| 106 | "--replace=<(skia_src_path)=src", |
| 107 | ], |
| 108 | "scope", |
| 109 | [ "gyp/effects.gypi" ]) |
| 110 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 111 | gpu_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 112 | [ |
| 113 | rebase_path("gyp/gpu.gypi"), |
| 114 | "--replace=<(skia_include_path)=include", |
| 115 | "--replace=<(skia_src_path)=src", |
| 116 | ], |
| 117 | "scope", |
| 118 | [ "gyp/gpu.gypi" ]) |
| 119 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 120 | opts_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 121 | [ |
| 122 | rebase_path("gyp/opts.gypi"), |
| 123 | "--replace=<(skia_include_path)=include", |
| 124 | "--replace=<(skia_src_path)=src", |
| 125 | ], |
| 126 | "scope", |
| 127 | [ "gyp/opts.gypi" ]) |
| 128 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 129 | pdf_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 130 | [ |
| 131 | rebase_path("gyp/pdf.gypi"), |
| 132 | "--replace=<(skia_include_path)=include", |
| 133 | "--replace=<(skia_src_path)=src", |
| 134 | ], |
| 135 | "scope", |
| 136 | [ "gyp/pdf.gypi" ]) |
| 137 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 138 | utils_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 139 | [ |
| 140 | rebase_path("gyp/utils.gypi"), |
| 141 | "--replace=<(skia_include_path)=include", |
| 142 | "--replace=<(skia_src_path)=src", |
| 143 | ], |
| 144 | "scope", |
| 145 | [ "gyp/utils.gypi" ]) |
| 146 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 147 | is_x86 = current_cpu == "x64" || current_cpu == "x86" |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 148 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 149 | if (is_x86) { |
| 150 | source_set("opts_sse2") { |
| 151 | configs += skia_library_configs |
| 152 | sources = opts_gypi.sse2_sources |
| 153 | cflags = [ "-msse2" ] |
| 154 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 155 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 156 | source_set("opts_ssse3") { |
| 157 | configs += skia_library_configs |
| 158 | sources = opts_gypi.ssse3_sources |
| 159 | cflags = [ "-mssse3" ] |
| 160 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 161 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 162 | source_set("opts_sse41") { |
| 163 | configs += skia_library_configs |
| 164 | sources = opts_gypi.sse41_sources |
| 165 | cflags = [ "-msse4.1" ] |
| 166 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 167 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 168 | source_set("opts_sse42") { |
| 169 | configs += skia_library_configs |
| 170 | sources = opts_gypi.sse42_sources |
| 171 | cflags = [ "-msse4.2" ] |
| 172 | } |
mtklein | 4e97607 | 2016-08-08 09:06:27 -0700 | [diff] [blame] | 173 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 174 | source_set("opts_avx") { |
| 175 | configs += skia_library_configs |
| 176 | sources = opts_gypi.avx_sources |
| 177 | cflags = [ "-mavx" ] |
| 178 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | component("skia") { |
| 182 | public_configs = [ ":skia_public" ] |
| 183 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 184 | |
| 185 | deps = [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 186 | "//third_party/expat", |
| 187 | "//third_party/giflib", |
mtklein | 7d10b9f | 2016-07-27 11:17:18 -0700 | [diff] [blame] | 188 | "//third_party/libjpeg_turbo", |
| 189 | "//third_party/libpng", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 190 | "//third_party/libwebp", |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 191 | "//third_party/sfntly", |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 192 | "//third_party/zlib", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 193 | ] |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 194 | if (is_x86) { |
| 195 | deps += [ |
| 196 | ":opts_avx", |
| 197 | ":opts_sse2", |
| 198 | ":opts_sse41", |
| 199 | ":opts_sse42", |
| 200 | ":opts_ssse3", |
| 201 | ] |
| 202 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 203 | |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 204 | if (!is_win) { |
| 205 | libs = [ "pthread" ] |
| 206 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 207 | |
| 208 | sources = [] |
| 209 | sources += core_gypi.sources |
| 210 | sources += effects_gypi.sources |
| 211 | sources += gpu_gypi.skgpu_sources |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 212 | sources += pdf_gypi.sources |
| 213 | sources += utils_gypi.sources |
| 214 | sources += [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 215 | "src/android/SkBitmapRegionCodec.cpp", |
| 216 | "src/android/SkBitmapRegionDecoder.cpp", |
| 217 | "src/codec/SkAndroidCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 218 | "src/codec/SkBmpCodec.cpp", |
| 219 | "src/codec/SkBmpMaskCodec.cpp", |
| 220 | "src/codec/SkBmpRLECodec.cpp", |
| 221 | "src/codec/SkBmpStandardCodec.cpp", |
| 222 | "src/codec/SkCodec.cpp", |
| 223 | "src/codec/SkCodecImageGenerator.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 224 | "src/codec/SkGifCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 225 | "src/codec/SkIcoCodec.cpp", |
| 226 | "src/codec/SkJpegCodec.cpp", |
| 227 | "src/codec/SkJpegDecoderMgr.cpp", |
| 228 | "src/codec/SkJpegUtility.cpp", |
| 229 | "src/codec/SkMaskSwizzler.cpp", |
| 230 | "src/codec/SkMasks.cpp", |
| 231 | "src/codec/SkPngCodec.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 232 | "src/codec/SkSampledCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 233 | "src/codec/SkSampler.cpp", |
| 234 | "src/codec/SkSwizzler.cpp", |
| 235 | "src/codec/SkWbmpCodec.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 236 | "src/codec/SkWebpAdapterCodec.cpp", |
| 237 | "src/codec/SkWebpCodec.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 238 | "src/images/SkImageEncoder.cpp", |
| 239 | "src/images/SkImageEncoder_Factory.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 240 | "src/images/SkJPEGImageEncoder.cpp", |
| 241 | "src/images/SkJPEGWriteUtility.cpp", |
| 242 | "src/images/SkKTXImageEncoder.cpp", |
| 243 | "src/images/SkPNGImageEncoder.cpp", |
| 244 | "src/images/SkWEBPImageEncoder.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 245 | "src/ports/SkDiscardableMemory_none.cpp", |
| 246 | "src/ports/SkGlobalInitialization_default.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 247 | "src/ports/SkImageGenerator_skia.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 248 | "src/ports/SkMemory_malloc.cpp", |
| 249 | "src/ports/SkOSFile_stdio.cpp", |
| 250 | "src/sfnt/SkOTTable_name.cpp", |
| 251 | "src/sfnt/SkOTUtils.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 252 | "src/svg/SkSVGCanvas.cpp", |
| 253 | "src/svg/SkSVGDevice.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 254 | "src/utils/mac/SkStream_mac.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 255 | "src/xml/SkDOM.cpp", |
| 256 | "src/xml/SkXMLParser.cpp", |
| 257 | "src/xml/SkXMLWriter.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 258 | "third_party/etc1/etc1.cpp", |
| 259 | "third_party/ktx/ktx.cpp", |
| 260 | ] |
| 261 | |
| 262 | if (is_win) { |
| 263 | sources += [ |
| 264 | "src/ports/SkDebug_win.cpp", |
| 265 | "src/ports/SkFontHost_win.cpp", |
| 266 | "src/ports/SkFontMgr_win_dw.cpp", |
| 267 | "src/ports/SkFontMgr_win_dw_factory.cpp", |
| 268 | "src/ports/SkImageEncoder_WIC.cpp", |
| 269 | "src/ports/SkImageGeneratorWIC.cpp", |
| 270 | "src/ports/SkOSFile_win.cpp", |
| 271 | "src/ports/SkScalerContext_win_dw.cpp", |
| 272 | "src/ports/SkTLS_win.cpp", |
| 273 | "src/ports/SkTypeface_win_dw.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 274 | "src/xps/SkDocument_XPS.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 275 | ] |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 276 | sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 277 | } else { |
| 278 | sources += [ |
| 279 | "src/ports/SkDebug_stdio.cpp", |
| 280 | "src/ports/SkOSFile_posix.cpp", |
| 281 | "src/ports/SkTLS_pthread.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 282 | "src/xps/SkDocument_XPS_None.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 283 | ] |
| 284 | } |
| 285 | |
| 286 | if (is_linux) { |
| 287 | deps += [ |
| 288 | "third_party:fontconfig", |
| 289 | "third_party:freetype2", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 290 | ] |
| 291 | sources += [ |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 292 | "src/ports/SkFontConfigInterface_direct.cpp", |
| 293 | "src/ports/SkFontConfigInterface_direct_factory.cpp", |
| 294 | "src/ports/SkFontHost_FreeType.cpp", |
| 295 | "src/ports/SkFontHost_FreeType_common.cpp", |
bungeman | 7d0e3bc | 2016-08-02 07:07:33 -0700 | [diff] [blame] | 296 | "src/ports/SkFontMgr_FontConfigInterface.cpp", |
mtklein | 7a34b1c | 2016-08-01 13:08:46 -0700 | [diff] [blame] | 297 | "src/ports/SkFontMgr_fontconfig.cpp", |
| 298 | "src/ports/SkFontMgr_fontconfig_factory.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 299 | ] |
| 300 | } |
| 301 | |
| 302 | if (is_mac) { |
| 303 | sources += [ |
| 304 | "src/ports/SkFontHost_mac.cpp", |
| 305 | "src/ports/SkImageEncoder_CG.cpp", |
| 306 | "src/ports/SkImageGeneratorCG.cpp", |
| 307 | ] |
| 308 | libs += [ "ApplicationServices.framework" ] |
| 309 | } |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 310 | |
| 311 | if (is_fuchsia) { |
mtklein | e817ddf | 2016-07-19 06:03:22 -0700 | [diff] [blame] | 312 | sources += [ "src/ports/SkFontMgr_empty_factory.cpp" ] |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 313 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 314 | } |
| 315 | |
mtklein | ada5a44 | 2016-08-02 14:28:26 -0700 | [diff] [blame] | 316 | skia_h_headers = exec_script("gyp/find.py", |
| 317 | [ "*.h" ] + rebase_path(skia_public_includes), |
| 318 | "list lines", |
| 319 | []) - |
| 320 | [ |
| 321 | rebase_path("include/gpu/gl/GrGLConfig_chrome.h"), |
| 322 | rebase_path("include/gpu/vk/GrVkBackendContext.h"), |
| 323 | rebase_path("include/gpu/vk/GrVkDefines.h"), |
| 324 | rebase_path("include/gpu/vk/GrVkInterface.h"), |
| 325 | rebase_path("include/gpu/vk/GrVkTypes.h"), |
| 326 | rebase_path("include/ports/SkFontMgr_fontconfig.h"), |
| 327 | ] |
| 328 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 329 | action("skia.h") { |
| 330 | script = "gn/echo_headers.py" |
| 331 | args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] + |
mtklein | ada5a44 | 2016-08-02 14:28:26 -0700 | [diff] [blame] | 332 | rebase_path(skia_h_headers, root_build_dir) |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 333 | outputs = [ |
| 334 | "$target_gen_dir/skia.h", |
| 335 | ] |
| 336 | } |
| 337 | |
| 338 | executable("fiddle") { |
| 339 | include_dirs = [ "$target_gen_dir" ] |
mtklein | 7d10b9f | 2016-07-27 11:17:18 -0700 | [diff] [blame] | 340 | libs = [] |
| 341 | if (is_linux) { |
| 342 | libs += [ "OSMesa" ] |
| 343 | } |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 344 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 345 | sources = [ |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 346 | "tools/fiddle/draw.cpp", |
| 347 | "tools/fiddle/fiddle_main.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 348 | ] |
| 349 | deps = [ |
| 350 | ":skia", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 351 | ":skia.h", |
mtklein | 5dbd274 | 2016-08-02 11:13:48 -0700 | [diff] [blame] | 352 | ":tool_utils", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 353 | ] |
mtklein | 5dbd274 | 2016-08-02 11:13:48 -0700 | [diff] [blame] | 354 | testonly = true |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 355 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 356 | |
| 357 | template("test_lib") { |
| 358 | config(target_name + "_config") { |
| 359 | include_dirs = invoker.public_include_dirs |
| 360 | } |
| 361 | source_set(target_name) { |
| 362 | forward_variables_from(invoker, "*", [ "public_include_dirs" ]) |
| 363 | public_configs = [ |
| 364 | ":" + target_name + "_config", |
| 365 | ":skia_private", |
| 366 | ] |
| 367 | |
| 368 | if (!defined(deps)) { |
| 369 | deps = [] |
| 370 | } |
| 371 | deps += [ ":skia" ] |
| 372 | testonly = true |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | test_lib("gpu_tool_utils") { |
| 377 | public_include_dirs = [ "tools/gpu" ] |
| 378 | sources = [ |
| 379 | "tools/gpu/GrContextFactory.cpp", |
| 380 | "tools/gpu/GrTest.cpp", |
| 381 | "tools/gpu/TestContext.cpp", |
| 382 | "tools/gpu/gl/GLTestContext.cpp", |
| 383 | "tools/gpu/gl/debug/DebugGLTestContext.cpp", |
| 384 | "tools/gpu/gl/debug/GrBufferObj.cpp", |
| 385 | "tools/gpu/gl/debug/GrFrameBufferObj.cpp", |
| 386 | "tools/gpu/gl/debug/GrProgramObj.cpp", |
| 387 | "tools/gpu/gl/debug/GrShaderObj.cpp", |
| 388 | "tools/gpu/gl/debug/GrTextureObj.cpp", |
| 389 | "tools/gpu/gl/debug/GrTextureUnitObj.cpp", |
| 390 | "tools/gpu/gl/null/NullGLTestContext.cpp", |
| 391 | ] |
| 392 | libs = [] |
| 393 | |
| 394 | if (is_linux) { |
mtklein | 5259da5 | 2016-08-03 08:28:20 -0700 | [diff] [blame] | 395 | sources += [ |
mtklein | 4db3b79 | 2016-08-03 14:18:22 -0700 | [diff] [blame] | 396 | "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp", |
| 397 | "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp", |
mtklein | 5259da5 | 2016-08-03 08:28:20 -0700 | [diff] [blame] | 398 | ] |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 399 | libs += [ |
| 400 | "GL", |
| 401 | "GLU", |
| 402 | "X11", |
| 403 | ] |
| 404 | } else if (is_mac) { |
mtklein | 5259da5 | 2016-08-03 08:28:20 -0700 | [diff] [blame] | 405 | sources += [ |
mtklein | 4db3b79 | 2016-08-03 14:18:22 -0700 | [diff] [blame] | 406 | "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp", |
| 407 | "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp", |
mtklein | 5259da5 | 2016-08-03 08:28:20 -0700 | [diff] [blame] | 408 | ] |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 409 | libs += [ "OpenGL.framework" ] |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | test_lib("flags") { |
| 414 | public_include_dirs = [ "tools/flags" ] |
| 415 | sources = [ |
| 416 | "tools/flags/SkCommandLineFlags.cpp", |
| 417 | "tools/flags/SkCommonFlags.cpp", |
| 418 | "tools/flags/SkCommonFlagsConfig.cpp", |
| 419 | ] |
| 420 | deps = [ |
| 421 | ":gpu_tool_utils", |
| 422 | ] |
| 423 | } |
| 424 | |
| 425 | test_lib("tool_utils") { |
| 426 | public_include_dirs = [ |
| 427 | "tools", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 428 | "tools/debugger", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 429 | "tools/timer", |
| 430 | ] |
| 431 | sources = [ |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 432 | "src/images/SkForceLinking.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 433 | "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools? |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 434 | "tools/CrashHandler.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 435 | "tools/ProcStats.cpp", |
| 436 | "tools/Resources.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 437 | "tools/ThermalManager.cpp", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 438 | "tools/UrlDataManager.cpp", |
| 439 | "tools/debugger/SkDebugCanvas.cpp", |
| 440 | "tools/debugger/SkDrawCommand.cpp", |
| 441 | "tools/debugger/SkJsonWriteBuffer.cpp", |
| 442 | "tools/debugger/SkObjectParser.cpp", |
| 443 | "tools/debugger/SkOverdrawMode.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 444 | "tools/picture_utils.cpp", |
| 445 | "tools/random_parse_path.cpp", |
| 446 | "tools/sk_tool_utils.cpp", |
| 447 | "tools/sk_tool_utils_font.cpp", |
| 448 | "tools/timer/Timer.cpp", |
| 449 | ] |
| 450 | deps = [ |
| 451 | ":flags", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 452 | "//third_party/libpng", |
| 453 | ] |
| 454 | public_deps = [ |
| 455 | "//third_party/jsoncpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 456 | ] |
| 457 | } |
| 458 | |
| 459 | gm_sources = exec_script("gyp/find.py", |
| 460 | [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 461 | "*.c*", |
mtklein | ada5a44 | 2016-08-02 14:28:26 -0700 | [diff] [blame] | 462 | rebase_path("gm"), |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 463 | ], |
| 464 | "list lines", |
| 465 | []) |
| 466 | test_lib("gm") { |
| 467 | public_include_dirs = [ "gm" ] |
| 468 | sources = gm_sources |
| 469 | deps = [ |
| 470 | ":gpu_tool_utils", |
| 471 | ":skia", |
| 472 | ":tool_utils", |
| 473 | ] |
| 474 | } |
| 475 | |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 476 | tests_sources = exec_script("gyp/find.py", |
| 477 | [ |
| 478 | "*.c*", |
| 479 | rebase_path("tests"), |
| 480 | ], |
| 481 | "list lines", |
| 482 | []) |
| 483 | |
| 484 | test_lib("tests") { |
| 485 | public_include_dirs = [ "tests" ] |
| 486 | sources = tests_sources - [ |
| 487 | rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only |
| 488 | rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main |
mtklein | 4db3b79 | 2016-08-03 14:18:22 -0700 | [diff] [blame] | 489 | rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work |
| 490 | rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 491 | rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile |
| 492 | rebase_path("tests/skia_test.cpp"), # alternate main |
| 493 | ] |
| 494 | deps = [ |
| 495 | ":flags", |
| 496 | ":gpu_tool_utils", |
| 497 | ":skia", |
| 498 | ":tool_utils", |
| 499 | "//third_party/libpng", |
| 500 | "//third_party/zlib", |
| 501 | ] |
| 502 | } |
| 503 | |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 504 | bench_sources = exec_script("gyp/find.py", |
| 505 | [ |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 506 | "*.c*", |
mtklein | ada5a44 | 2016-08-02 14:28:26 -0700 | [diff] [blame] | 507 | rebase_path("bench"), |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 508 | ], |
| 509 | "list lines", |
| 510 | []) |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 511 | |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 512 | test_lib("bench") { |
| 513 | public_include_dirs = [ "bench" ] |
| 514 | sources = bench_sources |
| 515 | sources -= [ |
| 516 | rebase_path("bench/nanobench.cpp"), |
| 517 | rebase_path("bench/nanobenchAndroid.cpp"), |
| 518 | ] |
| 519 | deps = [ |
| 520 | ":flags", |
| 521 | ":gm", |
| 522 | ":gpu_tool_utils", |
| 523 | ":skia", |
| 524 | ":tool_utils", |
| 525 | ] |
| 526 | } |
| 527 | |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 528 | test_lib("experimental_svg_model") { |
| 529 | public_include_dirs = [ "experimental/svg/model" ] |
| 530 | sources = [ |
| 531 | "experimental/svg/model/SkSVGAttribute.cpp", |
| 532 | "experimental/svg/model/SkSVGAttributeParser.cpp", |
| 533 | "experimental/svg/model/SkSVGContainer.cpp", |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 534 | "experimental/svg/model/SkSVGCircle.cpp", |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 535 | "experimental/svg/model/SkSVGDOM.cpp", |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 536 | "experimental/svg/model/SkSVGEllipse.cpp", |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 537 | "experimental/svg/model/SkSVGNode.cpp", |
| 538 | "experimental/svg/model/SkSVGPath.cpp", |
fmalita | 5b31f32 | 2016-08-12 12:15:33 -0700 | [diff] [blame] | 539 | "experimental/svg/model/SkSVGPoly.cpp", |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 540 | "experimental/svg/model/SkSVGRect.cpp", |
| 541 | "experimental/svg/model/SkSVGRenderContext.cpp", |
| 542 | "experimental/svg/model/SkSVGSVG.cpp", |
| 543 | "experimental/svg/model/SkSVGShape.cpp", |
| 544 | "experimental/svg/model/SkSVGTransformableNode.cpp", |
| 545 | "experimental/svg/model/SkSVGValue.cpp", |
| 546 | ] |
| 547 | deps = [ |
| 548 | ":skia", |
| 549 | ] |
| 550 | } |
| 551 | |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 552 | if (!is_component_build) { # Our test tools use many non-SK_API APIs... |
| 553 | executable("dm") { |
| 554 | sources = [ |
| 555 | "dm/DM.cpp", |
| 556 | "dm/DMJsonWriter.cpp", |
| 557 | "dm/DMSrcSink.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 558 | ] |
| 559 | include_dirs = [ "tests" ] |
| 560 | deps = [ |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 561 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 562 | ":flags", |
| 563 | ":gm", |
| 564 | ":gpu_tool_utils", |
| 565 | ":skia", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 566 | ":tests", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 567 | ":tool_utils", |
| 568 | "//third_party/jsoncpp", |
| 569 | "//third_party/libpng", |
| 570 | ] |
| 571 | testonly = true |
| 572 | } |
| 573 | |
| 574 | executable("monobench") { |
| 575 | sources = [ |
| 576 | "tools/monobench.cpp", |
| 577 | ] |
| 578 | deps = [ |
| 579 | ":bench", |
| 580 | ":skia", |
| 581 | ] |
| 582 | testonly = true |
| 583 | } |
| 584 | |
| 585 | executable("nanobench") { |
| 586 | sources = [ |
| 587 | "bench/nanobench.cpp", |
| 588 | ] |
| 589 | deps = [ |
| 590 | ":bench", |
| 591 | ":flags", |
| 592 | ":gm", |
| 593 | ":gpu_tool_utils", |
| 594 | ":skia", |
| 595 | ":tool_utils", |
| 596 | "//third_party/jsoncpp", |
| 597 | ] |
| 598 | testonly = true |
| 599 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 600 | |
| 601 | executable("sktexttopdf") { |
| 602 | sources = [ |
| 603 | "tools/SkShaper_harfbuzz.cpp", |
| 604 | "tools/using_skia_and_harfbuzz.cpp", |
| 605 | ] |
| 606 | deps = [ |
| 607 | ":skia", |
| 608 | "//third_party/harfbuzz", |
| 609 | ] |
| 610 | testonly = true |
| 611 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 612 | } |