• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# GYP file to build various tools.
2#
3# To build on Linux:
4#  ./gyp_skia tools.gyp && make tools
5#
6{
7  'includes': [
8    'apptype_console.gypi',
9  ],
10  'targets': [
11    {
12      # Build all executable targets defined below.
13      'target_name': 'tools',
14      'type': 'none',
15      'dependencies': [
16        'bench_pictures',
17        'filter',
18        'lua_pictures',
19        'bbh_shootout',
20        'lua_app',
21        'pinspect',
22        'render_pdfs',
23        'render_pictures',
24        'skdiff',
25        'skpdiff',
26        'skhello',
27        'skimage',
28        'test_image_decoder',
29      ],
30      'conditions': [
31        ['skia_shared_lib',
32          {
33            'dependencies': [
34              'sklua', # This can only be built if skia is built as a shared library
35            ],
36          },
37        ],
38      ],
39    },
40    {
41      'target_name': 'skdiff',
42      'type': 'executable',
43      'sources': [
44        '../tools/skdiff.cpp',
45        '../tools/skdiff.h',
46        '../tools/skdiff_html.cpp',
47        '../tools/skdiff_html.h',
48        '../tools/skdiff_main.cpp',
49        '../tools/skdiff_utils.cpp',
50        '../tools/skdiff_utils.h',
51      ],
52      'dependencies': [
53        'skia_lib.gyp:skia_lib',
54      ],
55    },
56    {
57      'target_name': 'skpdiff',
58      'type': 'executable',
59      'sources': [
60        '../tools/skpdiff/skpdiff_main.cpp',
61        '../tools/skpdiff/SkDiffContext.cpp',
62        '../tools/skpdiff/SkImageDiffer.cpp',
63        '../tools/skpdiff/SkPMetric.cpp',
64        '../tools/skpdiff/skpdiff_util.cpp',
65        '../tools/flags/SkCommandLineFlags.cpp',
66      ],
67      'include_dirs': [
68        '../tools/flags',
69        '../src/core/', # needed for SkTLList.h
70      ],
71      'dependencies': [
72        'skia_lib.gyp:skia_lib',
73      ],
74      'cflags': [
75        '-O3',
76      ],
77      'conditions': [
78        [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
79          'link_settings': {
80            'libraries': [
81              '-lrt',
82            ],
83          },
84        }],
85        ['skia_opencl', {
86          'sources': [
87            '../tools/skpdiff/SkCLImageDiffer.cpp',
88            '../tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp',
89          ],
90          'conditions': [
91            [ 'skia_os == "mac"', {
92              'link_settings': {
93                'libraries': [
94                  '$(SDKROOT)/System/Library/Frameworks/OpenCL.framework',
95                ]
96              }
97            }, {
98              'link_settings': {
99                'libraries': [
100                  '-lOpenCL',
101                ],
102              },
103            }],
104          ],
105        }, { # !skia_opencl
106          'sources': [
107            '../tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp',
108          ],
109        }],
110      ],
111    },
112    {
113      'target_name': 'skimagediff',
114      'type': 'executable',
115      'sources': [
116        '../tools/skdiff.cpp',
117        '../tools/skdiff.h',
118        '../tools/skdiff_html.cpp',
119        '../tools/skdiff_html.h',
120        '../tools/skdiff_image.cpp',
121        '../tools/skdiff_utils.cpp',
122        '../tools/skdiff_utils.h',
123      ],
124      'dependencies': [
125        'skia_lib.gyp:skia_lib',
126      ],
127    },
128    {
129      'target_name': 'skhello',
130      'type': 'executable',
131      'dependencies': [
132        'skia_lib.gyp:skia_lib',
133      ],
134      'conditions': [
135        [ 'skia_os == "nacl"', {
136          'sources': [
137            '../platform_tools/nacl/src/nacl_hello.cpp',
138          ],
139        }, {
140          'sources': [
141            '../tools/skhello.cpp',
142          ],
143          'dependencies': [
144            'flags.gyp:flags',
145            'pdf.gyp:pdf',
146          ],
147        }],
148      ],
149    },
150    {
151      'target_name': 'skimage',
152      'type': 'executable',
153      'sources': [
154        '../tools/skimage_main.cpp',
155      ],
156      'include_dirs': [
157        # For SkBitmapHasher.h
158        '../src/utils/',
159      ],
160      'dependencies': [
161        'flags.gyp:flags',
162        'gm.gyp:gm_expectations',
163        'jsoncpp.gyp:jsoncpp',
164        'skia_lib.gyp:skia_lib',
165        'utils.gyp:utils',
166      ],
167    },
168
169    {
170      'target_name': 'lua_app',
171      'type': 'executable',
172      'sources': [
173        '../tools/lua/lua_app.cpp',
174        '../src/utils/SkLua.cpp',
175      ],
176      'dependencies': [
177        'effects.gyp:effects',
178        'images.gyp:images',
179        'lua.gyp:lua',
180        'pdf.gyp:pdf',
181        'ports.gyp:ports',
182        'skia_lib.gyp:skia_lib',
183        'utils.gyp:utils',
184      ],
185    },
186    {
187      'target_name': 'lua_pictures',
188      'type': 'executable',
189      'sources': [
190        '../tools/lua/lua_pictures.cpp',
191        '../src/utils/SkLuaCanvas.cpp',
192        '../src/utils/SkLua.cpp',
193      ],
194      'dependencies': [
195        'effects.gyp:effects',
196        'flags.gyp:flags',
197        'images.gyp:images',
198        'lua.gyp:lua',
199        'tools.gyp:picture_renderer',
200        'tools.gyp:picture_utils',
201        'pdf.gyp:pdf',
202        'ports.gyp:ports',
203        'skia_lib.gyp:skia_lib',
204        'utils.gyp:utils',
205      ],
206    },
207    {
208      'target_name': 'render_pictures',
209      'type': 'executable',
210      'sources': [
211        '../tools/render_pictures_main.cpp',
212      ],
213      'include_dirs': [
214        '../src/core',
215        '../src/images',
216        '../src/lazy',
217        '../src/pipe/utils/',
218      ],
219      'dependencies': [
220        'flags.gyp:flags',
221        'skia_lib.gyp:skia_lib',
222        'tools.gyp:picture_renderer',
223        'tools.gyp:picture_utils',
224      ],
225    },
226    {
227      'target_name': 'bench_pictures',
228      'type': 'executable',
229      'sources': [
230        '../bench/SkBenchLogger.h',
231        '../bench/SkBenchLogger.cpp',
232        '../bench/TimerData.h',
233        '../bench/TimerData.cpp',
234        '../tools/bench_pictures_main.cpp',
235        '../tools/PictureBenchmark.cpp',
236      ],
237      'include_dirs': [
238        '../src/core/',
239        '../bench',
240        '../src/lazy/',
241      ],
242      'dependencies': [
243        'bench.gyp:bench_timer',
244        'flags.gyp:flags',
245        'skia_lib.gyp:skia_lib',
246        'tools.gyp:picture_utils',
247        'tools.gyp:picture_renderer',
248      ],
249    },
250    {
251      'target_name': 'picture_renderer',
252      'type': 'static_library',
253      'sources': [
254        '../tools/LazyDecodeBitmap.cpp',
255        '../tools/PictureRenderer.h',
256        '../tools/PictureRenderer.cpp',
257        '../tools/PictureRenderingFlags.h',
258        '../tools/PictureRenderingFlags.cpp',
259        '../tools/CopyTilesRenderer.h',
260        '../tools/CopyTilesRenderer.cpp',
261        '../src/pipe/utils/SamplePipeControllers.h',
262        '../src/pipe/utils/SamplePipeControllers.cpp',
263      ],
264      'include_dirs': [
265        '../src/core',
266        '../src/images',
267        '../src/lazy',
268        '../src/pipe/utils/',
269        '../src/utils/',
270      ],
271      'direct_dependent_settings': {
272        'include_dirs': [
273          # needed for JSON headers used within PictureRenderer.h
274          '../third_party/externals/jsoncpp-chromium/overrides/include/',
275          '../third_party/externals/jsoncpp/include/',
276        ],
277      },
278      'dependencies': [
279        'flags.gyp:flags',
280        'jsoncpp.gyp:jsoncpp',
281        'skia_lib.gyp:skia_lib',
282        'tools.gyp:picture_utils',
283      ],
284      'conditions': [
285        ['skia_gpu == 1',
286          {
287            'include_dirs' : [
288              '../src/gpu',
289            ],
290          },
291        ],
292      ],
293    },
294    {
295      'target_name': 'render_pdfs',
296      'type': 'executable',
297      'sources': [
298        '../tools/render_pdfs_main.cpp',
299        '../tools/PdfRenderer.cpp',
300        '../tools/PdfRenderer.h',
301      ],
302      'include_dirs': [
303        '../src/pipe/utils/',
304        '../src/utils/',
305      ],
306      'dependencies': [
307        'pdf.gyp:pdf',
308        'skia_lib.gyp:skia_lib',
309        'tools.gyp:picture_utils',
310      ],
311      'conditions': [
312        ['skia_win_debuggers_path and skia_os == "win"',
313          {
314            'dependencies': [
315              'tools.gyp:win_dbghelp',
316            ],
317          },
318        ],
319        # VS static libraries don't have a linker option. We must set a global
320        # project linker option, or add it to each executable.
321        ['skia_win_debuggers_path and skia_os == "win" and '
322         'skia_arch_width == 64',
323          {
324            'msvs_settings': {
325              'VCLinkerTool': {
326                'AdditionalDependencies': [
327                  '<(skia_win_debuggers_path)/x64/DbgHelp.lib',
328                ],
329              },
330            },
331          },
332        ],
333        ['skia_win_debuggers_path and skia_os == "win" and '
334         'skia_arch_width == 32',
335          {
336            'msvs_settings': {
337              'VCLinkerTool': {
338                'AdditionalDependencies': [
339                  '<(skia_win_debuggers_path)/DbgHelp.lib',
340                ],
341              },
342            },
343          },
344        ],
345      ],
346    },
347    {
348      'target_name': 'picture_utils',
349      'type': 'static_library',
350      'sources': [
351        '../tools/picture_utils.cpp',
352        '../tools/picture_utils.h',
353      ],
354      'dependencies': [
355        'skia_lib.gyp:skia_lib',
356      ],
357      'direct_dependent_settings': {
358        'include_dirs': [
359        '../tools/',
360        ],
361      },
362    },
363    {
364      'target_name': 'pinspect',
365      'type': 'executable',
366      'sources': [
367        '../tools/pinspect.cpp',
368      ],
369      'dependencies': [
370        'flags.gyp:flags',
371        'skia_lib.gyp:skia_lib',
372        'tools.gyp:picture_renderer',
373      ],
374    },
375    {
376      'target_name': 'bbh_shootout',
377      'type': 'executable',
378      'include_dirs': [
379        '../bench',
380        '../tools/'
381      ],
382      'sources': [
383        '../tools/bbh_shootout.cpp',
384
385        # Bench code:
386        '../bench/TimerData.h',
387        '../bench/TimerData.cpp',
388      ],
389      'dependencies': [
390        'bench.gyp:bench_timer',
391        'flags.gyp:flags',
392        'skia_lib.gyp:skia_lib',
393        'tools.gyp:picture_renderer',
394        'tools.gyp:picture_utils',
395      ],
396    },
397    {
398      'target_name': 'filter',
399      'type': 'executable',
400      'include_dirs' : [
401        '../src/core',
402        '../src/utils/debugger',
403      ],
404      'sources': [
405        '../tools/filtermain.cpp',
406        '../tools/path_utils.h',
407        '../tools/path_utils.cpp',
408        '../src/utils/debugger/SkDrawCommand.h',
409        '../src/utils/debugger/SkDrawCommand.cpp',
410        '../src/utils/debugger/SkDebugCanvas.h',
411        '../src/utils/debugger/SkDebugCanvas.cpp',
412        '../src/utils/debugger/SkObjectParser.h',
413        '../src/utils/debugger/SkObjectParser.cpp',
414      ],
415      'dependencies': [
416        'skia_lib.gyp:skia_lib',
417        'tools.gyp:picture_utils',
418      ],
419    },
420    {
421      'target_name': 'test_image_decoder',
422      'type': 'executable',
423      'sources': [
424        '../tools/test_image_decoder.cpp',
425      ],
426      'dependencies': [
427        'skia_lib.gyp:skia_lib',
428      ],
429    },
430  ],
431  'conditions': [
432    ['skia_shared_lib',
433      {
434        'targets': [
435          {
436            'target_name': 'sklua',
437            'product_name': 'skia',
438            'product_prefix': '',
439            'product_dir': '<(PRODUCT_DIR)/',
440            'type': 'shared_library',
441            'sources': [
442              '../src/utils/SkLuaCanvas.cpp',
443              '../src/utils/SkLua.cpp',
444            ],
445            'include_dirs': [
446              '../third_party/lua/src/',
447            ],
448            'dependencies': [
449              'lua.gyp:lua',
450              'pdf.gyp:pdf',
451              'skia_lib.gyp:skia_lib',
452            ],
453            'conditions': [
454              ['skia_os != "win"',
455                {
456                  'ldflags': [
457                    '-Wl,-rpath,\$$ORIGIN,--enable-new-dtags',
458                  ],
459                },
460              ],
461            ],
462          },
463        ],
464      },
465    ],
466    ['skia_win_debuggers_path and skia_os == "win"',
467      {
468        'targets': [
469          {
470            'target_name': 'win_dbghelp',
471            'type': 'static_library',
472            'defines': [
473              'SK_CDB_PATH="<(skia_win_debuggers_path)"',
474            ],
475            'sources': [
476              '../tools/win_dbghelp.h',
477              '../tools/win_dbghelp.cpp',
478            ],
479          },
480        ],
481      },
482    ],
483    ['skia_os == "win"',
484      {
485        'targets': [
486          {
487            'target_name': 'win_lcid',
488            'type': 'executable',
489            'sources': [
490              '../tools/win_lcid.cpp',
491            ],
492          },
493        ],
494      },
495    ],
496  ],
497}
498