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 = [ |
| 10 | "include/codec", |
| 11 | "include/config", |
| 12 | "include/core", |
| 13 | "include/effects", |
| 14 | "include/gpu", |
| 15 | "include/gpu/gl", |
| 16 | "include/images", |
| 17 | "include/pathops", |
| 18 | "include/ports", |
| 19 | "include/utils", |
| 20 | "include/utils/mac", |
| 21 | |
| 22 | "include/c", # TODO: move back to top, order shouldn't matter |
| 23 | ] |
| 24 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 25 | # Skia public API, generally provided by :skia. |
| 26 | config("skia_public") { |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 27 | include_dirs = skia_public_includes |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 28 | defines = [ "SKIA_DLL" ] |
| 29 | } |
| 30 | |
| 31 | # Skia internal APIs, used by Skia itself and a few test tools. |
| 32 | config("skia_private") { |
| 33 | visibility = [ ":*" ] |
| 34 | |
| 35 | include_dirs = [ |
| 36 | "include/private", |
| 37 | "src/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 38 | "src/codec", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 39 | "src/config", |
| 40 | "src/core", |
| 41 | "src/effects", |
| 42 | "src/gpu", |
| 43 | "src/image", |
| 44 | "src/images", |
| 45 | "src/lazy", |
| 46 | "src/opts", |
| 47 | "src/pathops", |
| 48 | "src/ports", |
| 49 | "src/sfnt", |
| 50 | "src/utils", |
| 51 | "third_party/etc1", |
| 52 | "third_party/ktx", |
| 53 | ] |
| 54 | } |
| 55 | |
| 56 | # Any code that's linked into Skia-the-library should use this config via += skia_library_configs. |
| 57 | config("skia_library") { |
| 58 | visibility = [ ":*" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 59 | defines = [ "SKIA_IMPLEMENTATION=1" ] |
| 60 | } |
| 61 | |
| 62 | skia_library_configs = [ |
| 63 | ":skia_public", |
| 64 | ":skia_private", |
| 65 | ":skia_library", |
| 66 | ] |
| 67 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 68 | core_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 69 | [ |
| 70 | rebase_path("gyp/core.gypi"), |
| 71 | "--replace=<(skia_include_path)=include", |
| 72 | "--replace=<(skia_src_path)=src", |
| 73 | ], |
| 74 | "scope", |
| 75 | [ "gyp/core.gypi" ]) |
| 76 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 77 | effects_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 78 | [ |
| 79 | rebase_path("gyp/effects.gypi"), |
| 80 | "--replace=<(skia_include_path)=include", |
| 81 | "--replace=<(skia_src_path)=src", |
| 82 | ], |
| 83 | "scope", |
| 84 | [ "gyp/effects.gypi" ]) |
| 85 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 86 | gpu_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 87 | [ |
| 88 | rebase_path("gyp/gpu.gypi"), |
| 89 | "--replace=<(skia_include_path)=include", |
| 90 | "--replace=<(skia_src_path)=src", |
| 91 | ], |
| 92 | "scope", |
| 93 | [ "gyp/gpu.gypi" ]) |
| 94 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 95 | opts_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 96 | [ |
| 97 | rebase_path("gyp/opts.gypi"), |
| 98 | "--replace=<(skia_include_path)=include", |
| 99 | "--replace=<(skia_src_path)=src", |
| 100 | ], |
| 101 | "scope", |
| 102 | [ "gyp/opts.gypi" ]) |
| 103 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 104 | pdf_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 105 | [ |
| 106 | rebase_path("gyp/pdf.gypi"), |
| 107 | "--replace=<(skia_include_path)=include", |
| 108 | "--replace=<(skia_src_path)=src", |
| 109 | ], |
| 110 | "scope", |
| 111 | [ "gyp/pdf.gypi" ]) |
| 112 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 113 | utils_gypi = exec_script("gn/gypi_to_gn.py", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 114 | [ |
| 115 | rebase_path("gyp/utils.gypi"), |
| 116 | "--replace=<(skia_include_path)=include", |
| 117 | "--replace=<(skia_src_path)=src", |
| 118 | ], |
| 119 | "scope", |
| 120 | [ "gyp/utils.gypi" ]) |
| 121 | |
| 122 | source_set("opts_ssse3") { |
| 123 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 124 | |
| 125 | sources = opts_gypi.ssse3_sources |
| 126 | cflags = [ "-mssse3" ] |
| 127 | } |
| 128 | |
| 129 | source_set("opts_sse41") { |
| 130 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 131 | |
| 132 | sources = opts_gypi.sse41_sources |
| 133 | cflags = [ "-msse4.1" ] |
| 134 | } |
| 135 | |
| 136 | source_set("opts_avx") { |
| 137 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 138 | |
| 139 | sources = opts_gypi.avx_sources |
| 140 | cflags = [ "-mavx" ] |
| 141 | } |
| 142 | |
| 143 | component("skia") { |
| 144 | public_configs = [ ":skia_public" ] |
| 145 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 146 | |
| 147 | deps = [ |
| 148 | ":opts_avx", |
| 149 | ":opts_sse41", |
| 150 | ":opts_ssse3", |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 151 | "//third_party/zlib", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 152 | ] |
| 153 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 154 | defines = [ |
| 155 | "SK_HAS_JPEG_LIBRARY", |
| 156 | "SK_HAS_PNG_LIBRARY", |
| 157 | ] |
| 158 | |
mtklein | 7fbfbbe | 2016-07-21 12:25:45 -0700 | [diff] [blame] | 159 | libs = [ "pthread" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 160 | |
| 161 | sources = [] |
| 162 | sources += core_gypi.sources |
| 163 | sources += effects_gypi.sources |
| 164 | sources += gpu_gypi.skgpu_sources |
| 165 | sources += opts_gypi.sse2_sources |
| 166 | sources += pdf_gypi.sources |
| 167 | sources += utils_gypi.sources |
| 168 | sources += [ |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 169 | "src/codec/SkBmpCodec.cpp", |
| 170 | "src/codec/SkBmpMaskCodec.cpp", |
| 171 | "src/codec/SkBmpRLECodec.cpp", |
| 172 | "src/codec/SkBmpStandardCodec.cpp", |
| 173 | "src/codec/SkCodec.cpp", |
| 174 | "src/codec/SkCodecImageGenerator.cpp", |
| 175 | "src/codec/SkIcoCodec.cpp", |
| 176 | "src/codec/SkJpegCodec.cpp", |
| 177 | "src/codec/SkJpegDecoderMgr.cpp", |
| 178 | "src/codec/SkJpegUtility.cpp", |
| 179 | "src/codec/SkMaskSwizzler.cpp", |
| 180 | "src/codec/SkMasks.cpp", |
| 181 | "src/codec/SkPngCodec.cpp", |
| 182 | "src/codec/SkSampler.cpp", |
| 183 | "src/codec/SkSwizzler.cpp", |
| 184 | "src/codec/SkWbmpCodec.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 185 | "src/images/SkImageEncoder.cpp", |
| 186 | "src/images/SkImageEncoder_Factory.cpp", |
| 187 | "src/ports/SkDiscardableMemory_none.cpp", |
| 188 | "src/ports/SkGlobalInitialization_default.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 189 | "src/ports/SkImageGenerator_skia.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 190 | "src/ports/SkMemory_malloc.cpp", |
| 191 | "src/ports/SkOSFile_stdio.cpp", |
| 192 | "src/sfnt/SkOTTable_name.cpp", |
| 193 | "src/sfnt/SkOTUtils.cpp", |
| 194 | "src/utils/mac/SkStream_mac.cpp", |
| 195 | "third_party/etc1/etc1.cpp", |
| 196 | "third_party/ktx/ktx.cpp", |
| 197 | ] |
| 198 | |
| 199 | if (is_win) { |
| 200 | sources += [ |
| 201 | "src/ports/SkDebug_win.cpp", |
| 202 | "src/ports/SkFontHost_win.cpp", |
| 203 | "src/ports/SkFontMgr_win_dw.cpp", |
| 204 | "src/ports/SkFontMgr_win_dw_factory.cpp", |
| 205 | "src/ports/SkImageEncoder_WIC.cpp", |
| 206 | "src/ports/SkImageGeneratorWIC.cpp", |
| 207 | "src/ports/SkOSFile_win.cpp", |
| 208 | "src/ports/SkScalerContext_win_dw.cpp", |
| 209 | "src/ports/SkTLS_win.cpp", |
| 210 | "src/ports/SkTypeface_win_dw.cpp", |
| 211 | ] |
| 212 | } else { |
| 213 | sources += [ |
| 214 | "src/ports/SkDebug_stdio.cpp", |
| 215 | "src/ports/SkOSFile_posix.cpp", |
| 216 | "src/ports/SkTLS_pthread.cpp", |
| 217 | ] |
| 218 | } |
| 219 | |
| 220 | if (is_linux) { |
| 221 | deps += [ |
| 222 | "third_party:fontconfig", |
| 223 | "third_party:freetype2", |
| 224 | "third_party:libjpeg-turbo", |
| 225 | "third_party:libpng", |
| 226 | ] |
| 227 | sources += [ |
| 228 | "src/fonts/SkFontMgr_fontconfig.cpp", |
| 229 | "src/images/SkJPEGImageEncoder.cpp", |
| 230 | "src/images/SkJPEGWriteUtility.cpp", |
| 231 | "src/images/SkPNGImageEncoder.cpp", |
| 232 | "src/ports/SkFontConfigInterface_direct.cpp", |
| 233 | "src/ports/SkFontConfigInterface_direct_factory.cpp", |
| 234 | "src/ports/SkFontHost_FreeType.cpp", |
| 235 | "src/ports/SkFontHost_FreeType_common.cpp", |
| 236 | "src/ports/SkFontHost_fontconfig.cpp", |
| 237 | ] |
| 238 | } |
| 239 | |
| 240 | if (is_mac) { |
| 241 | sources += [ |
| 242 | "src/ports/SkFontHost_mac.cpp", |
| 243 | "src/ports/SkImageEncoder_CG.cpp", |
| 244 | "src/ports/SkImageGeneratorCG.cpp", |
| 245 | ] |
| 246 | libs += [ "ApplicationServices.framework" ] |
| 247 | } |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 248 | |
| 249 | if (is_fuchsia) { |
mtklein | e817ddf | 2016-07-19 06:03:22 -0700 | [diff] [blame] | 250 | sources += [ "src/ports/SkFontMgr_empty_factory.cpp" ] |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 251 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 252 | } |
| 253 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 254 | action("skia.h") { |
| 255 | script = "gn/echo_headers.py" |
| 256 | args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] + |
| 257 | rebase_path(skia_public_includes, root_build_dir) |
| 258 | outputs = [ |
| 259 | "$target_gen_dir/skia.h", |
| 260 | ] |
| 261 | } |
| 262 | |
| 263 | executable("fiddle") { |
| 264 | include_dirs = [ "$target_gen_dir" ] |
| 265 | libs = [ "OSMesa" ] |
| 266 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 267 | sources = [ |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 268 | "tools/fiddle/draw.cpp", |
| 269 | "tools/fiddle/fiddle_main.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 270 | ] |
| 271 | deps = [ |
| 272 | ":skia", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame^] | 273 | ":skia.h", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 274 | ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 275 | } |