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