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