blob: 07c70097afcec761e09065957226ce99462a76d4 [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
mtklein7d10b9f2016-07-27 11:17:18 -070022 "include/c", # TODO: move back to top, order shouldn't matter
mtklein1211e0c2016-07-26 13:55:45 -070023]
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",
mtklein7d10b9f2016-07-27 11:17:18 -0700151 "//third_party/libjpeg_turbo",
152 "//third_party/libpng",
abarth6fc8ff02016-07-15 15:15:15 -0700153 "//third_party/zlib",
mtkleinc04ff472016-06-23 10:29:30 -0700154 ]
155
mtklein1211e0c2016-07-26 13:55:45 -0700156 defines = [
157 "SK_HAS_JPEG_LIBRARY",
158 "SK_HAS_PNG_LIBRARY",
159 ]
160
mtklein7fbfbbe2016-07-21 12:25:45 -0700161 libs = [ "pthread" ]
mtkleinc04ff472016-06-23 10:29:30 -0700162
163 sources = []
164 sources += core_gypi.sources
165 sources += effects_gypi.sources
166 sources += gpu_gypi.skgpu_sources
167 sources += opts_gypi.sse2_sources
168 sources += pdf_gypi.sources
169 sources += utils_gypi.sources
170 sources += [
mtklein1211e0c2016-07-26 13:55:45 -0700171 "src/codec/SkBmpCodec.cpp",
172 "src/codec/SkBmpMaskCodec.cpp",
173 "src/codec/SkBmpRLECodec.cpp",
174 "src/codec/SkBmpStandardCodec.cpp",
175 "src/codec/SkCodec.cpp",
176 "src/codec/SkCodecImageGenerator.cpp",
177 "src/codec/SkIcoCodec.cpp",
178 "src/codec/SkJpegCodec.cpp",
179 "src/codec/SkJpegDecoderMgr.cpp",
180 "src/codec/SkJpegUtility.cpp",
181 "src/codec/SkMaskSwizzler.cpp",
182 "src/codec/SkMasks.cpp",
183 "src/codec/SkPngCodec.cpp",
184 "src/codec/SkSampler.cpp",
185 "src/codec/SkSwizzler.cpp",
186 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700187 "src/images/SkImageEncoder.cpp",
188 "src/images/SkImageEncoder_Factory.cpp",
189 "src/ports/SkDiscardableMemory_none.cpp",
190 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700191 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700192 "src/ports/SkMemory_malloc.cpp",
193 "src/ports/SkOSFile_stdio.cpp",
194 "src/sfnt/SkOTTable_name.cpp",
195 "src/sfnt/SkOTUtils.cpp",
196 "src/utils/mac/SkStream_mac.cpp",
197 "third_party/etc1/etc1.cpp",
198 "third_party/ktx/ktx.cpp",
199 ]
200
201 if (is_win) {
202 sources += [
203 "src/ports/SkDebug_win.cpp",
204 "src/ports/SkFontHost_win.cpp",
205 "src/ports/SkFontMgr_win_dw.cpp",
206 "src/ports/SkFontMgr_win_dw_factory.cpp",
207 "src/ports/SkImageEncoder_WIC.cpp",
208 "src/ports/SkImageGeneratorWIC.cpp",
209 "src/ports/SkOSFile_win.cpp",
210 "src/ports/SkScalerContext_win_dw.cpp",
211 "src/ports/SkTLS_win.cpp",
212 "src/ports/SkTypeface_win_dw.cpp",
213 ]
214 } else {
215 sources += [
216 "src/ports/SkDebug_stdio.cpp",
217 "src/ports/SkOSFile_posix.cpp",
218 "src/ports/SkTLS_pthread.cpp",
219 ]
220 }
221
222 if (is_linux) {
223 deps += [
224 "third_party:fontconfig",
225 "third_party:freetype2",
mtkleinc04ff472016-06-23 10:29:30 -0700226 ]
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" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700265 libs = []
266 if (is_linux) {
267 libs += [ "OSMesa" ]
268 }
mtklein1211e0c2016-07-26 13:55:45 -0700269
mtkleinc04ff472016-06-23 10:29:30 -0700270 sources = [
mtklein1211e0c2016-07-26 13:55:45 -0700271 "tools/fiddle/draw.cpp",
272 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700273 ]
274 deps = [
275 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700276 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700277 ]
mtkleinc04ff472016-06-23 10:29:30 -0700278}