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