| OLD | NEW |
| (Empty) |
| 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 import("build/config/linux/pkg_config.gni") | |
| 7 | |
| 8 declare_args() { | |
| 9 } | |
| 10 | |
| 11 # Skia public API, generally provided by :skia. | |
| 12 config("skia_public") { | |
| 13 include_dirs = [ | |
| 14 "include/c", | |
| 15 "include/config", | |
| 16 "include/core", | |
| 17 "include/effects", | |
| 18 "include/gpu", | |
| 19 "include/images", | |
| 20 "include/lazy", | |
| 21 "include/pathops", | |
| 22 "include/ports", | |
| 23 "include/utils", | |
| 24 "include/utils/mac", | |
| 25 ] | |
| 26 defines = [ "SKIA_DLL" ] | |
| 27 } | |
| 28 | |
| 29 # Skia internal APIs, used by Skia itself and a few test tools. | |
| 30 config("skia_private") { | |
| 31 visibility = [ ":*" ] | |
| 32 | |
| 33 include_dirs = [ | |
| 34 "include/private", | |
| 35 "src/c", | |
| 36 "src/config", | |
| 37 "src/core", | |
| 38 "src/effects", | |
| 39 "src/gpu", | |
| 40 "src/image", | |
| 41 "src/images", | |
| 42 "src/lazy", | |
| 43 "src/opts", | |
| 44 "src/pathops", | |
| 45 "src/ports", | |
| 46 "src/sfnt", | |
| 47 "src/utils", | |
| 48 "third_party/etc1", | |
| 49 "third_party/ktx", | |
| 50 ] | |
| 51 } | |
| 52 | |
| 53 # Any code that's linked into Skia-the-library should use this config via += ski
a_library_configs. | |
| 54 config("skia_library") { | |
| 55 visibility = [ ":*" ] | |
| 56 | |
| 57 cflags = [ | |
| 58 "-Winit-self", | |
| 59 "-Wpointer-arith", | |
| 60 "-Wsign-compare", | |
| 61 "-Wvla", | |
| 62 "-fstrict-aliasing", | |
| 63 ] | |
| 64 cflags_cc = [ "-Wnon-virtual-dtor" ] | |
| 65 | |
| 66 defines = [ "SKIA_IMPLEMENTATION=1" ] | |
| 67 } | |
| 68 | |
| 69 skia_library_configs = [ | |
| 70 ":skia_public", | |
| 71 ":skia_private", | |
| 72 ":skia_library", | |
| 73 ] | |
| 74 | |
| 75 # Chrome's GN environment is mostly helpful, but a couple default configs tend t
o get in the way. | |
| 76 unwanted_configs = [ | |
| 77 "//build/config/clang:find_bad_constructs", # Chrome style checks. | |
| 78 "//build/config:feature_flags", # A bunch of #defines we don't care about. | |
| 79 ] | |
| 80 | |
| 81 core_gypi = exec_script("build/gypi_to_gn.py", | |
| 82 [ | |
| 83 rebase_path("gyp/core.gypi"), | |
| 84 "--replace=<(skia_include_path)=include", | |
| 85 "--replace=<(skia_src_path)=src", | |
| 86 ], | |
| 87 "scope", | |
| 88 [ "gyp/core.gypi" ]) | |
| 89 | |
| 90 effects_gypi = exec_script("build/gypi_to_gn.py", | |
| 91 [ | |
| 92 rebase_path("gyp/effects.gypi"), | |
| 93 "--replace=<(skia_include_path)=include", | |
| 94 "--replace=<(skia_src_path)=src", | |
| 95 ], | |
| 96 "scope", | |
| 97 [ "gyp/effects.gypi" ]) | |
| 98 | |
| 99 gpu_gypi = exec_script("build/gypi_to_gn.py", | |
| 100 [ | |
| 101 rebase_path("gyp/gpu.gypi"), | |
| 102 "--replace=<(skia_include_path)=include", | |
| 103 "--replace=<(skia_src_path)=src", | |
| 104 ], | |
| 105 "scope", | |
| 106 [ "gyp/gpu.gypi" ]) | |
| 107 | |
| 108 opts_gypi = exec_script("build/gypi_to_gn.py", | |
| 109 [ | |
| 110 rebase_path("gyp/opts.gypi"), | |
| 111 "--replace=<(skia_include_path)=include", | |
| 112 "--replace=<(skia_src_path)=src", | |
| 113 ], | |
| 114 "scope", | |
| 115 [ "gyp/opts.gypi" ]) | |
| 116 | |
| 117 pdf_gypi = exec_script("build/gypi_to_gn.py", | |
| 118 [ | |
| 119 rebase_path("gyp/pdf.gypi"), | |
| 120 "--replace=<(skia_include_path)=include", | |
| 121 "--replace=<(skia_src_path)=src", | |
| 122 ], | |
| 123 "scope", | |
| 124 [ "gyp/pdf.gypi" ]) | |
| 125 | |
| 126 utils_gypi = exec_script("build/gypi_to_gn.py", | |
| 127 [ | |
| 128 rebase_path("gyp/utils.gypi"), | |
| 129 "--replace=<(skia_include_path)=include", | |
| 130 "--replace=<(skia_src_path)=src", | |
| 131 ], | |
| 132 "scope", | |
| 133 [ "gyp/utils.gypi" ]) | |
| 134 | |
| 135 source_set("opts_ssse3") { | |
| 136 configs += skia_library_configs | |
| 137 configs -= unwanted_configs | |
| 138 | |
| 139 sources = opts_gypi.ssse3_sources | |
| 140 cflags = [ "-mssse3" ] | |
| 141 } | |
| 142 | |
| 143 source_set("opts_sse41") { | |
| 144 configs += skia_library_configs | |
| 145 configs -= unwanted_configs | |
| 146 | |
| 147 sources = opts_gypi.sse41_sources | |
| 148 cflags = [ "-msse4.1" ] | |
| 149 } | |
| 150 | |
| 151 component("skia") { | |
| 152 public_configs = [ ":skia_public" ] | |
| 153 configs += skia_library_configs | |
| 154 configs -= unwanted_configs | |
| 155 | |
| 156 deps = [ | |
| 157 ":opts_sse41", | |
| 158 ":opts_ssse3", | |
| 159 "third_party:zlib", | |
| 160 ] | |
| 161 | |
| 162 libs = [] | |
| 163 | |
| 164 sources = [] | |
| 165 sources += core_gypi.sources | |
| 166 sources += effects_gypi.sources | |
| 167 sources += gpu_gypi.skgpu_sources | |
| 168 sources += opts_gypi.sse2_sources | |
| 169 sources += pdf_gypi.sources | |
| 170 sources += utils_gypi.sources | |
| 171 sources += [ | |
| 172 "src/images/SkImageEncoder.cpp", | |
| 173 "src/images/SkImageEncoder_Factory.cpp", | |
| 174 "src/ports/SkDiscardableMemory_none.cpp", | |
| 175 "src/ports/SkGlobalInitialization_default.cpp", | |
| 176 "src/ports/SkImageGenerator_none.cpp", | |
| 177 "src/ports/SkMemory_malloc.cpp", | |
| 178 "src/ports/SkOSFile_stdio.cpp", | |
| 179 "src/sfnt/SkOTTable_name.cpp", | |
| 180 "src/sfnt/SkOTUtils.cpp", | |
| 181 "src/utils/mac/SkStream_mac.cpp", | |
| 182 "third_party/etc1/etc1.cpp", | |
| 183 "third_party/ktx/ktx.cpp", | |
| 184 ] | |
| 185 | |
| 186 if (is_win) { | |
| 187 sources += [ | |
| 188 "src/ports/SkDebug_win.cpp", | |
| 189 "src/ports/SkFontHost_win.cpp", | |
| 190 "src/ports/SkFontMgr_win_dw.cpp", | |
| 191 "src/ports/SkFontMgr_win_dw_factory.cpp", | |
| 192 "src/ports/SkImageEncoder_WIC.cpp", | |
| 193 "src/ports/SkImageGeneratorWIC.cpp", | |
| 194 "src/ports/SkOSFile_win.cpp", | |
| 195 "src/ports/SkScalerContext_win_dw.cpp", | |
| 196 "src/ports/SkTLS_win.cpp", | |
| 197 "src/ports/SkTypeface_win_dw.cpp", | |
| 198 ] | |
| 199 } else { | |
| 200 sources += [ | |
| 201 "src/ports/SkDebug_stdio.cpp", | |
| 202 "src/ports/SkOSFile_posix.cpp", | |
| 203 "src/ports/SkTLS_pthread.cpp", | |
| 204 ] | |
| 205 } | |
| 206 | |
| 207 if (is_linux) { | |
| 208 deps += [ | |
| 209 ":fontconfig", | |
| 210 ":freetype2", | |
| 211 "third_party:libjpeg-turbo", | |
| 212 "third_party:libpng", | |
| 213 ] | |
| 214 sources += [ | |
| 215 "src/fonts/SkFontMgr_fontconfig.cpp", | |
| 216 "src/images/SkJPEGImageEncoder.cpp", | |
| 217 "src/images/SkJPEGWriteUtility.cpp", | |
| 218 "src/images/SkPNGImageEncoder.cpp", | |
| 219 "src/ports/SkFontConfigInterface_direct.cpp", | |
| 220 "src/ports/SkFontConfigInterface_direct_factory.cpp", | |
| 221 "src/ports/SkFontHost_FreeType.cpp", | |
| 222 "src/ports/SkFontHost_FreeType_common.cpp", | |
| 223 "src/ports/SkFontHost_fontconfig.cpp", | |
| 224 ] | |
| 225 } | |
| 226 | |
| 227 if (is_mac) { | |
| 228 sources += [ | |
| 229 "src/ports/SkFontHost_mac.cpp", | |
| 230 "src/ports/SkImageEncoder_CG.cpp", | |
| 231 "src/ports/SkImageGeneratorCG.cpp", | |
| 232 ] | |
| 233 libs += [ "ApplicationServices.framework" ] | |
| 234 } | |
| 235 } | |
| 236 | |
| 237 executable("example") { | |
| 238 configs -= unwanted_configs | |
| 239 | |
| 240 sources = [ | |
| 241 "cmake/example.cpp", | |
| 242 ] | |
| 243 deps = [ | |
| 244 ":skia", | |
| 245 ] | |
| 246 | |
| 247 libs = [] | |
| 248 if (is_mac) { | |
| 249 libs += [ "OpenGL.framework" ] | |
| 250 } | |
| 251 } | |
| 252 | |
| 253 pkg_config("system_freetype2") { | |
| 254 packages = [ "freetype2" ] | |
| 255 } | |
| 256 group("freetype2") { | |
| 257 public_configs = [ ":system_freetype2" ] | |
| 258 } | |
| 259 | |
| 260 pkg_config("system_fontconfig") { | |
| 261 packages = [ "fontconfig" ] | |
| 262 } | |
| 263 group("fontconfig") { | |
| 264 public_configs = [ ":system_fontconfig" ] | |
| 265 } | |
| OLD | NEW |