blob: 7ead5f7bbfc0c4de18f251c793d5a82485e8ded8 [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
9# Skia public API, generally provided by :skia.
10config("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.
28config("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.
52config("skia_library") {
53 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070054 defines = [ "SKIA_IMPLEMENTATION=1" ]
55}
56
57skia_library_configs = [
58 ":skia_public",
59 ":skia_private",
60 ":skia_library",
61]
62
mtklein7fbfbbe2016-07-21 12:25:45 -070063core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070064 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070072effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070073 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070081gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070082 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070090opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070091 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -070099pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700100 [
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
mtklein7fbfbbe2016-07-21 12:25:45 -0700108utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700109 [
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
117source_set("opts_ssse3") {
118 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700119
120 sources = opts_gypi.ssse3_sources
121 cflags = [ "-mssse3" ]
122}
123
124source_set("opts_sse41") {
125 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700126
127 sources = opts_gypi.sse41_sources
128 cflags = [ "-msse4.1" ]
129}
130
131source_set("opts_avx") {
132 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700133
134 sources = opts_gypi.avx_sources
135 cflags = [ "-mavx" ]
136}
137
138component("skia") {
139 public_configs = [ ":skia_public" ]
140 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700141
142 deps = [
143 ":opts_avx",
144 ":opts_sse41",
145 ":opts_ssse3",
abarth6fc8ff02016-07-15 15:15:15 -0700146 "//third_party/zlib",
mtkleinc04ff472016-06-23 10:29:30 -0700147 ]
148
mtklein7fbfbbe2016-07-21 12:25:45 -0700149 libs = [ "pthread" ]
mtkleinc04ff472016-06-23 10:29:30 -0700150
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 }
abarth6fc8ff02016-07-15 15:15:15 -0700222
223 if (is_fuchsia) {
mtkleine817ddf2016-07-19 06:03:22 -0700224 sources += [ "src/ports/SkFontMgr_empty_factory.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700225 }
mtkleinc04ff472016-06-23 10:29:30 -0700226}
227
228executable("example") {
mtkleinc04ff472016-06-23 10:29:30 -0700229 sources = [
230 "cmake/example.cpp",
231 ]
232 deps = [
233 ":skia",
234 ]
235
236 libs = []
237 if (is_mac) {
238 libs += [ "OpenGL.framework" ]
239 }
240}