Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1127)

Side by Side Diff: BUILD.gn

Issue 2302803005: Move Skia GN sources to a separate .gni file. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gn/shared_sources.gni » ('j') | gn/shared_sources.gni » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 Google Inc. 1 # Copyright 2016 Google Inc.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import("//gn/shared_sources.gni")
7
6 declare_args() { 8 declare_args() {
7 skia_enable_tools = !is_fuchsia && !is_component_build 9 skia_enable_tools = !is_fuchsia && !is_component_build
8 10
9 skia_use_expat = true 11 skia_use_expat = true
10 skia_use_fontconfig = is_linux 12 skia_use_fontconfig = is_linux
11 skia_use_freetype = is_android || is_linux 13 skia_use_freetype = is_android || is_linux
12 skia_use_giflib = !is_fuchsia 14 skia_use_giflib = !is_fuchsia
13 skia_use_libjpeg_turbo = true 15 skia_use_libjpeg_turbo = true
14 skia_use_libpng = true 16 skia_use_libpng = true
15 skia_use_libwebp = !is_fuchsia 17 skia_use_libwebp = !is_fuchsia
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 visibility = [ ":*" ] 85 visibility = [ ":*" ]
84 defines = [ "SKIA_IMPLEMENTATION=1" ] 86 defines = [ "SKIA_IMPLEMENTATION=1" ]
85 } 87 }
86 88
87 skia_library_configs = [ 89 skia_library_configs = [
88 ":skia_public", 90 ":skia_public",
89 ":skia_private", 91 ":skia_private",
90 ":skia_library", 92 ":skia_library",
91 ] 93 ]
92 94
93 core_gypi = exec_script("gn/gypi_to_gn.py",
94 [
95 rebase_path("gyp/core.gypi"),
96 "--replace=<(skia_include_path)=include",
97 "--replace=<(skia_src_path)=src",
98 ],
99 "scope",
100 [ "gyp/core.gypi" ])
101
102 effects_gypi = exec_script("gn/gypi_to_gn.py",
103 [
104 rebase_path("gyp/effects.gypi"),
105 "--replace=<(skia_include_path)=include",
106 "--replace=<(skia_src_path)=src",
107 ],
108 "scope",
109 [ "gyp/effects.gypi" ])
110
111 gpu_gypi = exec_script("gn/gypi_to_gn.py",
112 [
113 rebase_path("gyp/gpu.gypi"),
114 "--replace=<(skia_include_path)=include",
115 "--replace=<(skia_src_path)=src",
116 ],
117 "scope",
118 [ "gyp/gpu.gypi" ])
119
120 opts_gypi = exec_script("gn/gypi_to_gn.py",
121 [
122 rebase_path("gyp/opts.gypi"),
123 "--replace=<(skia_include_path)=include",
124 "--replace=<(skia_src_path)=src",
125 ],
126 "scope",
127 [ "gyp/opts.gypi" ])
128
129 pdf_gypi = exec_script("gn/gypi_to_gn.py",
130 [
131 rebase_path("gyp/pdf.gypi"),
132 "--replace=<(skia_include_path)=include",
133 "--replace=<(skia_src_path)=src",
134 ],
135 "scope",
136 [ "gyp/pdf.gypi" ])
137
138 sksl_gypi = exec_script("gn/gypi_to_gn.py",
139 [
140 rebase_path("gyp/sksl.gypi"),
141 "--replace=<(skia_include_path)=include",
142 "--replace=<(skia_src_path)=src",
143 ],
144 "scope",
145 [ "gyp/sksl.gypi" ])
146
147 utils_gypi = exec_script("gn/gypi_to_gn.py",
148 [
149 rebase_path("gyp/utils.gypi"),
150 "--replace=<(skia_include_path)=include",
151 "--replace=<(skia_src_path)=src",
152 ],
153 "scope",
154 [ "gyp/utils.gypi" ])
155
156 # Use for CPU-specific Skia code that needs particular compiler flags. 95 # Use for CPU-specific Skia code that needs particular compiler flags.
157 template("opts") { 96 template("opts") {
158 if (invoker.enabled) { 97 if (invoker.enabled) {
159 source_set(target_name) { 98 source_set(target_name) {
160 forward_variables_from(invoker, "*") 99 forward_variables_from(invoker, "*")
161 configs += skia_library_configs 100 configs += skia_library_configs
162 } 101 }
163 } else { 102 } else {
164 # If not enabled, a phony empty target that swallows all otherwise unused va riables. 103 # If not enabled, a phony empty target that swallows all otherwise unused va riables.
165 source_set(target_name) { 104 source_set(target_name) {
166 forward_variables_from(invoker, 105 forward_variables_from(invoker,
167 "*", 106 "*",
168 [ 107 [
169 "sources", 108 "sources",
170 "cflags", 109 "cflags",
171 ]) 110 ])
172 } 111 }
173 } 112 }
174 } 113 }
175 114
176 is_x86 = current_cpu == "x64" || current_cpu == "x86" 115 is_x86 = current_cpu == "x64" || current_cpu == "x86"
177 116
178 opts("none") { 117 opts("none") {
179 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64" 118 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
180 sources = opts_gypi.none_sources 119 sources = skia_opts.none_sources
181 cflags = [] 120 cflags = []
182 } 121 }
183 122
184 opts("armv7") { 123 opts("armv7") {
185 enabled = current_cpu == "arm" 124 enabled = current_cpu == "arm"
186 sources = opts_gypi.armv7_sources + opts_gypi.neon_sources 125 sources = skia_opts.armv7_sources + skia_opts.neon_sources
187 cflags = [] 126 cflags = []
188 } 127 }
189 128
190 opts("arm64") { 129 opts("arm64") {
191 enabled = current_cpu == "arm64" 130 enabled = current_cpu == "arm64"
192 sources = opts_gypi.arm64_sources 131 sources = skia_opts.arm64_sources
193 cflags = [] 132 cflags = []
194 } 133 }
195 134
196 opts("crc32") { 135 opts("crc32") {
197 enabled = current_cpu == "arm64" 136 enabled = current_cpu == "arm64"
198 sources = opts_gypi.crc32_sources 137 sources = skia_opts.crc32_sources
199 cflags = [ "-march=armv8-a+crc" ] 138 cflags = [ "-march=armv8-a+crc" ]
200 } 139 }
201 140
202 opts("sse2") { 141 opts("sse2") {
203 enabled = is_x86 142 enabled = is_x86
204 sources = opts_gypi.sse2_sources 143 sources = skia_opts.sse2_sources
205 cflags = [ "-msse2" ] 144 cflags = [ "-msse2" ]
206 } 145 }
207 146
208 opts("ssse3") { 147 opts("ssse3") {
209 enabled = is_x86 148 enabled = is_x86
210 sources = opts_gypi.ssse3_sources 149 sources = skia_opts.ssse3_sources
211 cflags = [ "-mssse3" ] 150 cflags = [ "-mssse3" ]
212 } 151 }
213 152
214 opts("sse41") { 153 opts("sse41") {
215 enabled = is_x86 154 enabled = is_x86
216 sources = opts_gypi.sse41_sources 155 sources = skia_opts.sse41_sources
217 cflags = [ "-msse4.1" ] 156 cflags = [ "-msse4.1" ]
218 } 157 }
219 158
220 opts("sse42") { 159 opts("sse42") {
221 enabled = is_x86 160 enabled = is_x86
222 sources = opts_gypi.sse42_sources 161 sources = skia_opts.sse42_sources
223 cflags = [ "-msse4.2" ] 162 cflags = [ "-msse4.2" ]
224 } 163 }
225 164
226 opts("avx") { 165 opts("avx") {
227 enabled = is_x86 166 enabled = is_x86
228 sources = opts_gypi.avx_sources 167 sources = skia_opts.avx_sources
229 cflags = [ "-mavx" ] 168 cflags = [ "-mavx" ]
230 } 169 }
231 170
232 opts("dsp") { 171 opts("dsp") {
233 enabled = current_cpu == "mipsel" 172 enabled = current_cpu == "mipsel"
234 sources = opts_gypi.mips_dsp_sources 173 sources = skia_opts.mips_dsp_sources
235 cflags = [] 174 cflags = []
236 } 175 }
237 176
238 # Any feature of Skia that requires third-party code should be optional and use this template. 177 # Any feature of Skia that requires third-party code should be optional and use this template.
239 template("optional") { 178 template("optional") {
240 if (invoker.enabled) { 179 if (invoker.enabled) {
241 config(target_name + "_public") { 180 config(target_name + "_public") {
242 if (defined(invoker.public_defines)) { 181 if (defined(invoker.public_defines)) {
243 defines = invoker.public_defines 182 defines = invoker.public_defines
244 } 183 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 "src/images/SkJPEGWriteUtility.cpp", 267 "src/images/SkJPEGWriteUtility.cpp",
329 ] 268 ]
330 } 269 }
331 270
332 optional("pdf") { 271 optional("pdf") {
333 enabled = skia_use_zlib 272 enabled = skia_use_zlib
334 273
335 deps = [ 274 deps = [
336 "//third_party/zlib", 275 "//third_party/zlib",
337 ] 276 ]
338 sources = pdf_gypi.sources 277 sources = skia_pdf_sources
339 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] 278 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
340 279
341 if (skia_use_sfntly) { 280 if (skia_use_sfntly) {
342 deps += [ "//third_party/sfntly" ] 281 deps += [ "//third_party/sfntly" ]
343 public_defines = [ "SK_PDF_USE_SFNTLY" ] 282 public_defines = [ "SK_PDF_USE_SFNTLY" ]
344 } 283 }
345 } 284 }
346 285
347 optional("png") { 286 optional("png") {
348 enabled = skia_use_libpng 287 enabled = skia_use_libpng
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 ":sse2", 356 ":sse2",
418 ":sse41", 357 ":sse41",
419 ":sse42", 358 ":sse42",
420 ":ssse3", 359 ":ssse3",
421 ":typeface_freetype", 360 ":typeface_freetype",
422 ":webp", 361 ":webp",
423 ":xml", 362 ":xml",
424 ] 363 ]
425 364
426 sources = [] 365 sources = []
427 sources += core_gypi.sources 366 sources += skia_core_sources
428 sources += effects_gypi.sources 367 sources += skia_effects_sources
429 sources += gpu_gypi.skgpu_sources 368 sources += skia_gpu_sources
430 sources += sksl_gypi.sources 369 sources += skia_sksl_sources
431 sources += utils_gypi.sources 370 sources += skia_utils_sources
432 sources += [ 371 sources += [
433 "src/android/SkBitmapRegionCodec.cpp", 372 "src/android/SkBitmapRegionCodec.cpp",
434 "src/android/SkBitmapRegionDecoder.cpp", 373 "src/android/SkBitmapRegionDecoder.cpp",
435 "src/codec/SkAndroidCodec.cpp", 374 "src/codec/SkAndroidCodec.cpp",
436 "src/codec/SkBmpCodec.cpp", 375 "src/codec/SkBmpCodec.cpp",
437 "src/codec/SkBmpMaskCodec.cpp", 376 "src/codec/SkBmpMaskCodec.cpp",
438 "src/codec/SkBmpRLECodec.cpp", 377 "src/codec/SkBmpRLECodec.cpp",
439 "src/codec/SkBmpStandardCodec.cpp", 378 "src/codec/SkBmpStandardCodec.cpp",
440 "src/codec/SkCodec.cpp", 379 "src/codec/SkCodec.cpp",
441 "src/codec/SkCodecImageGenerator.cpp", 380 "src/codec/SkCodecImageGenerator.cpp",
(...skipping 14 matching lines...) Expand all
456 "src/ports/SkOSFile_stdio.cpp", 395 "src/ports/SkOSFile_stdio.cpp",
457 "src/sfnt/SkOTTable_name.cpp", 396 "src/sfnt/SkOTTable_name.cpp",
458 "src/sfnt/SkOTUtils.cpp", 397 "src/sfnt/SkOTUtils.cpp",
459 "src/svg/SkSVGCanvas.cpp", 398 "src/svg/SkSVGCanvas.cpp",
460 "src/svg/SkSVGDevice.cpp", 399 "src/svg/SkSVGDevice.cpp",
461 "src/utils/mac/SkStream_mac.cpp", 400 "src/utils/mac/SkStream_mac.cpp",
462 "third_party/etc1/etc1.cpp", 401 "third_party/etc1/etc1.cpp",
463 "third_party/ktx/ktx.cpp", 402 "third_party/ktx/ktx.cpp",
464 ] 403 ]
465 sources -= [ 404 sources -= [
466 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp", 405 "//src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein_C 2016/09/01 20:54:38 Fuchsia pulls Skia in and uses this BUILD.gn file
brettw 2016/09/01 20:58:42 I didn't know that. I changed this so it will work
467 "src/gpu/gl/GrGLDefaultInterface_none.cpp", 406 "//src/gpu/gl/GrGLDefaultInterface_none.cpp",
468 ] 407 ]
469 408
470 libs = [] 409 libs = []
471 410
472 if (is_win) { 411 if (is_win) {
473 sources += [ 412 sources += [
474 "src/ports/SkDebug_win.cpp", 413 "src/ports/SkDebug_win.cpp",
475 "src/ports/SkFontHost_win.cpp", 414 "src/ports/SkFontHost_win.cpp",
476 "src/ports/SkFontMgr_win_dw.cpp", 415 "src/ports/SkFontMgr_win_dw.cpp",
477 "src/ports/SkFontMgr_win_dw_factory.cpp", 416 "src/ports/SkFontMgr_win_dw_factory.cpp",
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 "tools/using_skia_and_harfbuzz.cpp", 767 "tools/using_skia_and_harfbuzz.cpp",
829 ] 768 ]
830 deps = [ 769 deps = [
831 ":skia", 770 ":skia",
832 "//third_party/harfbuzz", 771 "//third_party/harfbuzz",
833 ] 772 ]
834 testonly = true 773 testonly = true
835 } 774 }
836 } 775 }
837 } 776 }
OLDNEW
« no previous file with comments | « no previous file | gn/shared_sources.gni » ('j') | gn/shared_sources.gni » ('J')

Powered by Google App Engine
This is Rietveld 408576698