blob: 1ddf12a9579855a38fdfe746e655ca0bb2958514 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# 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
6declare_args() {
7}
8
mtklein1211e0c2016-07-26 13:55:45 -07009skia_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
mtkleinc04ff472016-06-23 10:29:30 -070025# Skia public API, generally provided by :skia.
26config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070027 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070028 defines = [ "SKIA_DLL" ]
29}
30
31# Skia internal APIs, used by Skia itself and a few test tools.
32config("skia_private") {
33 visibility = [ ":*" ]
34
35 include_dirs = [
36 "include/private",
37 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070038 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070039 "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.
57config("skia_library") {
58 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070059 defines = [ "SKIA_IMPLEMENTATION=1" ]
60}
61
62skia_library_configs = [
63 ":skia_public",
64 ":skia_private",
65 ":skia_library",
66]
67
mtklein7fbfbbe2016-07-21 12:25:45 -070068core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070069 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070077effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070078 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070086gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070087 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070095opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070096 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -0700104pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700105 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -0700113utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700114 [
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
122source_set("opts_ssse3") {
123 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700124
125 sources = opts_gypi.ssse3_sources
126 cflags = [ "-mssse3" ]
127}
128
129source_set("opts_sse41") {
130 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700131
132 sources = opts_gypi.sse41_sources
133 cflags = [ "-msse4.1" ]
134}
135
136source_set("opts_avx") {
137 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700138
139 sources = opts_gypi.avx_sources
140 cflags = [ "-mavx" ]
141}
142
143component("skia") {
144 public_configs = [ ":skia_public" ]
145 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700146
147 deps = [
148 ":opts_avx",
149 ":opts_sse41",
150 ":opts_ssse3",
abarth6fc8ff02016-07-15 15:15:15 -0700151 "//third_party/zlib",
mtkleinc04ff472016-06-23 10:29:30 -0700152 ]
153
mtklein1211e0c2016-07-26 13:55:45 -0700154 defines = [
155 "SK_HAS_JPEG_LIBRARY",
156 "SK_HAS_PNG_LIBRARY",
157 ]
158
mtklein7fbfbbe2016-07-21 12:25:45 -0700159 libs = [ "pthread" ]
mtkleinc04ff472016-06-23 10:29:30 -0700160
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 += [
mtklein1211e0c2016-07-26 13:55:45 -0700169 "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",
mtkleinc04ff472016-06-23 10:29:30 -0700185 "src/images/SkImageEncoder.cpp",
186 "src/images/SkImageEncoder_Factory.cpp",
187 "src/ports/SkDiscardableMemory_none.cpp",
188 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700189 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700190 "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 }
abarth6fc8ff02016-07-15 15:15:15 -0700248
249 if (is_fuchsia) {
mtkleine817ddf2016-07-19 06:03:22 -0700250 sources += [ "src/ports/SkFontMgr_empty_factory.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700251 }
mtkleinc04ff472016-06-23 10:29:30 -0700252}
253
mtklein1211e0c2016-07-26 13:55:45 -0700254action("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
263executable("fiddle") {
264 include_dirs = [ "$target_gen_dir" ]
265 libs = [ "OSMesa" ]
266
mtkleinc04ff472016-06-23 10:29:30 -0700267 sources = [
mtklein1211e0c2016-07-26 13:55:45 -0700268 "tools/fiddle/draw.cpp",
269 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700270 ]
271 deps = [
272 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700273 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700274 ]
mtkleinc04ff472016-06-23 10:29:30 -0700275}