Home | History | Annotate | Download | only in expat
      1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 {
      6   'variables': {
      7     'conditions': [
      8       # On Linux, we implicitly already depend on expat via fontconfig;
      9       # let's not pull it in twice.
     10       ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
     11         'use_system_expat%': 1,
     12       }, {
     13         'use_system_expat%': 0,
     14       }],
     15     ],
     16   },
     17   'target_defaults': {
     18     'defines': [
     19       '_LIB',
     20       'XML_STATIC',  # Compile for static linkage.
     21     ],
     22     'include_dirs': [
     23       'files/lib',
     24     ],
     25   },
     26   'conditions': [
     27     ['use_system_expat == 1', {
     28       'targets': [
     29         {
     30           'target_name': 'expat',
     31           'type': 'none',
     32           'link_settings': {
     33             'libraries': [
     34               '-lexpat',
     35             ],
     36           },
     37         },
     38       ],
     39     }, {  # else: use_system_expat != 1
     40       'targets': [
     41         {
     42           'target_name': 'expat',
     43           'type': 'static_library',
     44           'sources': [
     45             'files/lib/expat.h',
     46             'files/lib/xmlparse.c',
     47             'files/lib/xmlrole.c',
     48             'files/lib/xmltok.c',
     49           ],
     50 
     51           # Prefer adding a dependency to expat and relying on the following
     52           # direct_dependent_settings rule over manually adding the include
     53           # path.  This is because you'll want any translation units that
     54           # #include these files to pick up the #defines as well.
     55           'direct_dependent_settings': {
     56             'include_dirs': [
     57               'files/lib'
     58             ],
     59             'defines': [
     60               'XML_STATIC',  # Tell dependants to expect static linkage.
     61             ],
     62           },
     63           'conditions': [
     64             ['OS=="win"', {
     65               'defines': [
     66                 'COMPILED_FROM_DSP',
     67               ],
     68             }],
     69             ['OS=="mac" or OS=="ios" or OS=="android" or os_bsd==1', {
     70               'defines': [
     71                 'HAVE_EXPAT_CONFIG_H',
     72               ],
     73             }],
     74           ],
     75         },
     76       ],
     77     }],
     78   ],
     79 }
     80