Home | History | Annotate | Download | only in gyp
      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         'bbh_shootout',
     17         'bench_pictures',
     18         'bench_record',
     19         'bench_playback',
     20         'dump_record',
     21         'filter',
     22         'gpuveto',
     23         'lua_app',
     24         'lua_pictures',
     25         'pinspect',
     26         'render_pdfs',
     27         'render_pictures',
     28         'skdiff',
     29         'skhello',
     30         'skpdiff',
     31         'skpinfo',
     32         'skpmaker',
     33         'skimage',
     34         'test_image_decoder',
     35       ],
     36       'conditions': [
     37         ['skia_shared_lib',
     38           {
     39             'dependencies': [
     40               'sklua', # This can only be built if skia is built as a shared library
     41             ],
     42           },
     43         ],
     44       ],
     45     },
     46     {  # This would go in gm.gyp, but it's also used by skimage below.
     47       'target_name': 'gm_expectations',
     48       'type': 'static_library',
     49       'include_dirs' : [ '../src/utils/' ],
     50       'sources': [
     51         '../gm/gm_expectations.cpp',
     52         '../tools/sk_tool_utils.cpp',
     53       ],
     54       'dependencies': [
     55         'jsoncpp.gyp:jsoncpp',
     56         'skia_lib.gyp:skia_lib',
     57       ],
     58       'direct_dependent_settings': {
     59         'include_dirs': [ '../gm/' ],
     60       },
     61     },
     62     {
     63       'target_name': 'crash_handler',
     64         'type': 'static_library',
     65         'sources': [ '../tools/CrashHandler.cpp' ],
     66         'dependencies': [ 'skia_lib.gyp:skia_lib' ],
     67         'direct_dependent_settings': {
     68           'include_dirs': [ '../tools' ],
     69         },
     70         'all_dependent_settings': {
     71           'msvs_settings': {
     72             'VCLinkerTool': {
     73               'AdditionalDependencies': [ 'Dbghelp.lib' ],
     74             }
     75           },
     76         }
     77     },
     78     {
     79       'target_name': 'resources',
     80       'type': 'static_library',
     81       'sources': [ '../tools/Resources.cpp' ],
     82       'dependencies': [
     83         'flags.gyp:flags',
     84         'skia_lib.gyp:skia_lib',
     85       ],
     86       'direct_dependent_settings': {
     87         'include_dirs': [ '../tools/', ],
     88       },
     89     },
     90     {
     91       'target_name' : 'timer',
     92       'type': 'static_library',
     93       'sources': [
     94         '../tools/timer/Timer.cpp',
     95         '../tools/timer/TimerData.cpp',
     96       ],
     97       'include_dirs': [
     98         '../src/core',
     99         '../src/gpu',
    100       ],
    101       'direct_dependent_settings': {
    102         'include_dirs': ['../tools/timer'],
    103       },
    104       'dependencies': [
    105         'skia_lib.gyp:skia_lib',
    106         'jsoncpp.gyp:jsoncpp',
    107       ],
    108       'conditions': [
    109         ['skia_gpu == 1', {
    110           'sources': [ '../tools/timer/GpuTimer.cpp' ],
    111         }],
    112         [ 'skia_os in ["mac", "ios"]', {
    113           'sources': [ '../tools/timer/SysTimer_mach.cpp' ],
    114         }],
    115         [ 'skia_os == "win"', {
    116           'sources': [ '../tools/timer/SysTimer_windows.cpp' ],
    117         }],
    118         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android", "chromeos"]', {
    119           'sources': [ '../tools/timer/SysTimer_posix.cpp' ],
    120         }],
    121         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
    122           'link_settings': { 'libraries': [ '-lrt' ] },
    123         }],
    124       ],
    125     },
    126     {
    127       'target_name': 'skdiff',
    128       'type': 'executable',
    129       'sources': [
    130         '../tools/skdiff.cpp',
    131         '../tools/skdiff.h',
    132         '../tools/skdiff_html.cpp',
    133         '../tools/skdiff_html.h',
    134         '../tools/skdiff_main.cpp',
    135         '../tools/skdiff_utils.cpp',
    136         '../tools/skdiff_utils.h',
    137       ],
    138       'dependencies': [
    139         'skia_lib.gyp:skia_lib',
    140       ],
    141     },
    142     {
    143       'target_name': 'skpdiff',
    144       'type': 'executable',
    145       'sources': [
    146         '../tools/skpdiff/skpdiff_main.cpp',
    147         '../tools/skpdiff/SkDiffContext.cpp',
    148         '../tools/skpdiff/SkImageDiffer.cpp',
    149         '../tools/skpdiff/SkPMetric.cpp',
    150         '../tools/skpdiff/skpdiff_util.cpp',
    151         '../tools/flags/SkCommandLineFlags.cpp',
    152       ],
    153       'include_dirs': [
    154         '../tools/flags',
    155         '../src/core/', # needed for SkTLList.h
    156       ],
    157       'dependencies': [
    158         'skia_lib.gyp:skia_lib',
    159       ],
    160       'cflags': [
    161         '-O3',
    162       ],
    163       'conditions': [
    164         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
    165           'link_settings': {
    166             'libraries': [
    167               '-lrt',
    168             ],
    169           },
    170         }],
    171         ['skia_opencl', {
    172           'sources': [
    173             '../tools/skpdiff/SkCLImageDiffer.cpp',
    174             '../tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp',
    175           ],
    176           'conditions': [
    177             [ 'skia_os == "mac"', {
    178               'link_settings': {
    179                 'libraries': [
    180                   '$(SDKROOT)/System/Library/Frameworks/OpenCL.framework',
    181                 ]
    182               }
    183             }, {
    184               'link_settings': {
    185                 'libraries': [
    186                   '-lOpenCL',
    187                 ],
    188               },
    189             }],
    190           ],
    191         }, { # !skia_opencl
    192           'sources': [
    193             '../tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp',
    194           ],
    195         }],
    196       ],
    197     },
    198     {
    199       'target_name': 'skpmaker',
    200       'type': 'executable',
    201       'sources': [
    202         '../tools/skpmaker.cpp',
    203       ],
    204       'include_dirs': [
    205         '../src/core',
    206       ],
    207       'dependencies': [
    208         'flags.gyp:flags',
    209         'skia_lib.gyp:skia_lib',
    210       ],
    211     },
    212     {
    213       'target_name': 'skimagediff',
    214       'type': 'executable',
    215       'sources': [
    216         '../tools/skdiff.cpp',
    217         '../tools/skdiff.h',
    218         '../tools/skdiff_html.cpp',
    219         '../tools/skdiff_html.h',
    220         '../tools/skdiff_image.cpp',
    221         '../tools/skdiff_utils.cpp',
    222         '../tools/skdiff_utils.h',
    223       ],
    224       'dependencies': [
    225         'skia_lib.gyp:skia_lib',
    226       ],
    227     },
    228     {
    229       'target_name': 'skhello',
    230       'type': 'executable',
    231       'dependencies': [
    232         'skia_lib.gyp:skia_lib',
    233       ],
    234       'conditions': [
    235         [ 'skia_os == "nacl"', {
    236           'sources': [
    237             '../platform_tools/nacl/src/nacl_hello.cpp',
    238           ],
    239         }, {
    240           'sources': [
    241             '../tools/skhello.cpp',
    242           ],
    243           'dependencies': [
    244             'flags.gyp:flags',
    245             'pdf.gyp:pdf',
    246           ],
    247         }],
    248       ],
    249     },
    250     {
    251       'target_name': 'skimage',
    252       'type': 'executable',
    253       'sources': [
    254         '../tools/skimage_main.cpp',
    255       ],
    256       'include_dirs': [
    257         # For SkBitmapHasher.h
    258         '../src/utils/',
    259       ],
    260       'dependencies': [
    261         'gm_expectations',
    262         'flags.gyp:flags',
    263         'jsoncpp.gyp:jsoncpp',
    264         'skia_lib.gyp:skia_lib',
    265       ],
    266     },
    267     {
    268       'target_name': 'skpinfo',
    269       'type': 'executable',
    270       'sources': [
    271         '../tools/skpinfo.cpp',
    272       ],
    273       'include_dirs': [
    274         '../tools/flags',
    275         '../src/core/',
    276       ],
    277       'dependencies': [
    278         'flags.gyp:flags',
    279         'skia_lib.gyp:skia_lib',
    280       ],
    281     },
    282     {
    283       'target_name': 'gpuveto',
    284       'type': 'executable',
    285       'sources': [
    286         '../tools/gpuveto.cpp',
    287         '../tools/LazyDecodeBitmap.cpp',
    288       ],
    289       'include_dirs': [
    290         '../src/core/',
    291         '../src/images',
    292         '../src/lazy',
    293         '../tools/flags',
    294       ],
    295       'dependencies': [
    296         'flags.gyp:flags',
    297         'skia_lib.gyp:skia_lib',
    298       ],
    299     },
    300     {
    301       'target_name': 'lua_app',
    302       'type': 'executable',
    303       'sources': [
    304         '../tools/lua/lua_app.cpp',
    305         '../src/utils/SkLua.cpp',
    306       ],
    307       'include_dirs': [
    308         # Lua exposes GrReduceClip which in turn requires src/core for SkTLList
    309         '../src/gpu/',
    310         '../src/core/',
    311       ],
    312       'dependencies': [
    313         'effects.gyp:effects',
    314         'images.gyp:images',
    315         'lua.gyp:lua',
    316         'pdf.gyp:pdf',
    317         'ports.gyp:ports',
    318         'skia_lib.gyp:skia_lib',
    319       ],
    320     },
    321     {
    322       'target_name': 'lua_pictures',
    323       'type': 'executable',
    324       'sources': [
    325         '../tools/lua/lua_pictures.cpp',
    326         '../src/utils/SkLuaCanvas.cpp',
    327         '../src/utils/SkLua.cpp',
    328       ],
    329       'include_dirs': [
    330         # Lua exposes GrReduceClip which in turn requires src/core for SkTLList
    331         '../src/gpu/',
    332         '../src/core/',
    333       ],
    334       'dependencies': [
    335         'effects.gyp:effects',
    336         'flags.gyp:flags',
    337         'images.gyp:images',
    338         'lua.gyp:lua',
    339         'tools.gyp:picture_renderer',
    340         'tools.gyp:picture_utils',
    341         'pdf.gyp:pdf',
    342         'ports.gyp:ports',
    343         'skia_lib.gyp:skia_lib',
    344       ],
    345     },
    346     {
    347       'target_name': 'render_pictures',
    348       'type': 'executable',
    349       'sources': [
    350         '../tools/render_pictures_main.cpp',
    351       ],
    352       'include_dirs': [
    353         '../src/core',
    354         '../src/images',
    355         '../src/lazy',
    356         '../src/pipe/utils/',
    357       ],
    358       'dependencies': [
    359         'flags.gyp:flags',
    360         'skia_lib.gyp:skia_lib',
    361         'tools.gyp:picture_renderer',
    362         'tools.gyp:picture_utils',
    363       ],
    364     },
    365     {
    366       'target_name': 'bench_pictures',
    367       'type': 'executable',
    368       'sources': [
    369         '../bench/BenchLogger.cpp',
    370         '../bench/BenchLogger.h',
    371         '../bench/ResultsWriter.cpp',
    372         '../tools/PictureBenchmark.cpp',
    373         '../tools/PictureResultsWriter.h',
    374         '../tools/bench_pictures_main.cpp',
    375       ],
    376       'include_dirs': [
    377         '../src/core/',
    378         '../bench',
    379         '../src/lazy/',
    380       ],
    381       'dependencies': [
    382         'timer',
    383         'crash_handler',
    384         'flags.gyp:flags',
    385         'jsoncpp.gyp:jsoncpp',
    386         'skia_lib.gyp:skia_lib',
    387         'tools.gyp:picture_renderer',
    388         'tools.gyp:picture_utils',
    389       ],
    390     },
    391     {
    392       'target_name': 'bench_record',
    393       'type': 'executable',
    394       'sources': [
    395         '../tools/bench_record.cpp',
    396         '../tools/LazyDecodeBitmap.cpp',
    397       ],
    398       'include_dirs': [
    399         '../src/core/',
    400         '../src/images',
    401         '../src/lazy',
    402       ],
    403       'dependencies': [
    404         'timer',
    405         'flags.gyp:flags',
    406         'skia_lib.gyp:skia_lib',
    407       ],
    408     },
    409     {
    410       'target_name': 'bench_playback',
    411       'type': 'executable',
    412       'sources': [
    413         '../tools/bench_playback.cpp',
    414       ],
    415       'include_dirs': [
    416         '../src/core/',
    417         '../src/images',
    418       ],
    419       'dependencies': [
    420         'timer',
    421         'flags.gyp:flags',
    422         'skia_lib.gyp:skia_lib',
    423       ],
    424     },
    425     {
    426       'target_name': 'dump_record',
    427       'type': 'executable',
    428       'sources': [
    429         '../tools/dump_record.cpp',
    430         '../tools/DumpRecord.cpp',
    431         '../tools/LazyDecodeBitmap.cpp',
    432       ],
    433       'include_dirs': [
    434         '../src/core/',
    435         '../src/images',
    436         '../src/lazy',
    437       ],
    438       'dependencies': [
    439         'timer',
    440         'flags.gyp:flags',
    441         'skia_lib.gyp:skia_lib',
    442       ],
    443     },
    444     {
    445       'target_name': 'picture_renderer',
    446       'type': 'static_library',
    447       'sources': [
    448         '../tools/image_expectations.h',
    449         '../tools/image_expectations.cpp',
    450         '../tools/LazyDecodeBitmap.cpp',
    451         '../tools/PictureRenderer.h',
    452         '../tools/PictureRenderer.cpp',
    453         '../tools/PictureRenderingFlags.h',
    454         '../tools/PictureRenderingFlags.cpp',
    455         '../tools/CopyTilesRenderer.h',
    456         '../tools/CopyTilesRenderer.cpp',
    457         '../src/pipe/utils/SamplePipeControllers.h',
    458         '../src/pipe/utils/SamplePipeControllers.cpp',
    459       ],
    460       'include_dirs': [
    461         '../src/core',
    462         '../src/images',
    463         '../src/lazy',
    464         '../src/pipe/utils/',
    465         '../src/utils/',
    466       ],
    467       'direct_dependent_settings': {
    468         'include_dirs': [
    469           # needed for JSON headers used within image_expectations.h
    470           '../third_party/externals/jsoncpp-chromium/overrides/include/',
    471           '../third_party/externals/jsoncpp/include/',
    472         ],
    473       },
    474       'dependencies': [
    475         'flags.gyp:flags',
    476         'jsoncpp.gyp:jsoncpp',
    477         'skia_lib.gyp:skia_lib',
    478         'tools.gyp:picture_utils',
    479       ],
    480       'conditions': [
    481         ['skia_gpu == 1',
    482           {
    483             'include_dirs' : [
    484               '../src/gpu',
    485             ],
    486             'dependencies': [
    487               'gputest.gyp:skgputest',
    488             ],
    489           },
    490         ],
    491       ],
    492     },
    493     {
    494       'target_name': 'render_pdfs',
    495       'type': 'executable',
    496       'sources': [
    497         '../tools/render_pdfs_main.cpp',
    498         '../tools/PdfRenderer.cpp',
    499         '../tools/PdfRenderer.h',
    500       ],
    501       'include_dirs': [
    502         '../src/pipe/utils/',
    503         '../src/utils/',
    504       ],
    505       'dependencies': [
    506         'pdf.gyp:pdf',
    507         'skia_lib.gyp:skia_lib',
    508         'tools.gyp:picture_utils',
    509       ],
    510       'conditions': [
    511         ['skia_win_debuggers_path and skia_os == "win"',
    512           {
    513             'dependencies': [
    514               'tools.gyp:win_dbghelp',
    515             ],
    516           },
    517         ],
    518         # VS static libraries don't have a linker option. We must set a global
    519         # project linker option, or add it to each executable.
    520         ['skia_win_debuggers_path and skia_os == "win" and '
    521          'skia_arch_width == 64',
    522           {
    523             'msvs_settings': {
    524               'VCLinkerTool': {
    525                 'AdditionalDependencies': [
    526                   '<(skia_win_debuggers_path)/x64/DbgHelp.lib',
    527                 ],
    528               },
    529             },
    530           },
    531         ],
    532         ['skia_win_debuggers_path and skia_os == "win" and '
    533          'skia_arch_width == 32',
    534           {
    535             'msvs_settings': {
    536               'VCLinkerTool': {
    537                 'AdditionalDependencies': [
    538                   '<(skia_win_debuggers_path)/DbgHelp.lib',
    539                 ],
    540               },
    541             },
    542           },
    543         ],
    544       ],
    545     },
    546     {
    547       'target_name': 'picture_utils',
    548       'type': 'static_library',
    549       'sources': [
    550         '../tools/picture_utils.cpp',
    551         '../tools/picture_utils.h',
    552       ],
    553       'dependencies': [
    554         'skia_lib.gyp:skia_lib',
    555       ],
    556       'direct_dependent_settings': {
    557         'include_dirs': [
    558           '../tools/',
    559         ],
    560       },
    561     },
    562     {
    563       'target_name': 'pinspect',
    564       'type': 'executable',
    565       'sources': [
    566         '../tools/pinspect.cpp',
    567       ],
    568       'dependencies': [
    569         'flags.gyp:flags',
    570         'skia_lib.gyp:skia_lib',
    571         'tools.gyp:picture_renderer',
    572       ],
    573     },
    574     {
    575       'target_name': 'bbh_shootout',
    576       'type': 'executable',
    577       'include_dirs': [
    578         '../bench',
    579         '../tools/'
    580       ],
    581       'sources': [
    582         '../tools/bbh_shootout.cpp',
    583 
    584         # Bench code:
    585       ],
    586       'dependencies': [
    587         'timer',
    588         'flags.gyp:flags',
    589         'skia_lib.gyp:skia_lib',
    590         'tools.gyp:picture_renderer',
    591         'tools.gyp:picture_utils',
    592       ],
    593     },
    594     {
    595       'target_name': 'filter',
    596       'type': 'executable',
    597       'include_dirs' : [
    598         '../src/core',
    599         '../src/utils/debugger',
    600       ],
    601       'sources': [
    602         '../tools/filtermain.cpp',
    603         '../src/utils/debugger/SkDrawCommand.h',
    604         '../src/utils/debugger/SkDrawCommand.cpp',
    605         '../src/utils/debugger/SkDebugCanvas.h',
    606         '../src/utils/debugger/SkDebugCanvas.cpp',
    607         '../src/utils/debugger/SkObjectParser.h',
    608         '../src/utils/debugger/SkObjectParser.cpp',
    609       ],
    610       'dependencies': [
    611         'skia_lib.gyp:skia_lib',
    612         'tools.gyp:picture_utils',
    613       ],
    614     },
    615     {
    616       'target_name': 'test_image_decoder',
    617       'type': 'executable',
    618       'sources': [
    619         '../tools/test_image_decoder.cpp',
    620       ],
    621       'dependencies': [
    622         'skia_lib.gyp:skia_lib',
    623       ],
    624     },
    625   ],
    626   'conditions': [
    627     ['skia_shared_lib',
    628       {
    629         'targets': [
    630           {
    631             'target_name': 'sklua',
    632             'product_name': 'skia',
    633             'product_prefix': '',
    634             'product_dir': '<(PRODUCT_DIR)/',
    635             'type': 'shared_library',
    636             'sources': [
    637               '../src/utils/SkLuaCanvas.cpp',
    638               '../src/utils/SkLua.cpp',
    639             ],
    640             'include_dirs': [
    641               # Lua exposes GrReduceClip which in turn requires src/core for SkTLList
    642               '../src/gpu/',
    643               '../src/core/',
    644               '../third_party/lua/src/',
    645             ],
    646             'dependencies': [
    647               'lua.gyp:lua',
    648               'pdf.gyp:pdf',
    649               'skia_lib.gyp:skia_lib',
    650             ],
    651             'conditions': [
    652               ['skia_os != "win"',
    653                 {
    654                   'ldflags': [
    655                     '-Wl,-rpath,\$$ORIGIN,--enable-new-dtags',
    656                   ],
    657                 },
    658               ],
    659             ],
    660           },
    661         ],
    662       },
    663     ],
    664     ['skia_win_debuggers_path and skia_os == "win"',
    665       {
    666         'targets': [
    667           {
    668             'target_name': 'win_dbghelp',
    669             'type': 'static_library',
    670             'defines': [
    671               'SK_CDB_PATH="<(skia_win_debuggers_path)"',
    672             ],
    673             'sources': [
    674               '../tools/win_dbghelp.h',
    675               '../tools/win_dbghelp.cpp',
    676             ],
    677           },
    678         ],
    679       },
    680     ],
    681     ['skia_os == "win"',
    682       {
    683         'targets': [
    684           {
    685             'target_name': 'win_lcid',
    686             'type': 'executable',
    687             'sources': [
    688               '../tools/win_lcid.cpp',
    689             ],
    690           },
    691         ],
    692       },
    693     ],
    694   ],
    695 }
    696