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