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 'conditions': [ 38 ['OS=="android"', { 39 'direct_dependent_settings': { 40 'include_dirs': [ 41 '<(android_src)/external/expat/lib', 42 ], 43 }, 44 }], 45 ], 46 }, 47 ], 48 }, { # else: use_system_expat != 1 49 'targets': [ 50 { 51 'target_name': 'expat', 52 'type': 'static_library', 53 'sources': [ 54 'files/lib/expat.h', 55 'files/lib/xmlparse.c', 56 'files/lib/xmlrole.c', 57 'files/lib/xmltok.c', 58 ], 59 60 # Prefer adding a dependency to expat and relying on the following 61 # direct_dependent_settings rule over manually adding the include 62 # path. This is because you'll want any translation units that 63 # #include these files to pick up the #defines as well. 64 'direct_dependent_settings': { 65 'include_dirs': [ 66 'files/lib' 67 ], 68 'defines': [ 69 'XML_STATIC', # Tell dependants to expect static linkage. 70 ], 71 }, 72 'conditions': [ 73 ['OS=="win"', { 74 'defines': [ 75 'COMPILED_FROM_DSP', 76 ], 77 }], 78 ['OS=="mac" or OS=="ios" or OS=="android" or os_bsd==1', { 79 'defines': [ 80 'HAVE_EXPAT_CONFIG_H', 81 ], 82 }], 83 ], 84 }, 85 ], 86 }], 87 ], 88} 89