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    'gcc_cflags': [
8      '-ggdb',
9      '-W',
10      '-Wall',
11      '-Werror',
12      '-Wno-unused-parameter',
13      '-fPIE',
14      '-fstack-protector',
15    ],
16    'gcc_ldflags': [
17      '-ggdb',
18      '-fpie',
19      '-Wl,-z,relro',
20      '-Wl,-z,now',
21    ],
22  },
23  'includes': [
24    'ots-common.gypi',
25  ],
26  'target_defaults': {
27    'conditions': [
28      ['OS=="linux"', {
29        'cflags': [
30          '<@(gcc_cflags)',
31        ],
32        'ldflags': [
33          '<@(gcc_ldflags)',
34        ],
35        'defines': [
36          '_FORTIFY_SOURCE=2',
37        ],
38        'link_settings': {
39          'libraries': ['-lz'],
40        },
41      }],
42      ['OS=="mac"', {
43        'xcode_settings': {
44          'GCC_DYNAMIC_NO_PIC': 'NO',            # No -mdynamic-no-pic
45          'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',   # -fvisibility=hidden
46          'OTHER_CFLAGS': [
47            '<@(gcc_cflags)',
48          ],
49        },
50        'link_settings': {
51          'libraries': [
52            '/System/Library/Frameworks/ApplicationServices.framework',
53            '/usr/lib/libz.dylib'
54          ],
55        },
56      }],
57      ['OS=="win"', {
58        'link_settings': {
59          'libraries': [
60            '-lzdll.lib',
61          ],
62        },
63        'msvs_settings': {
64          'VCLinkerTool': {
65            'AdditionalLibraryDirectories': ['third_party/zlib'],
66            'DelayLoadDLLs': ['zlib1.dll'],
67          },
68        },
69        'include_dirs': [
70          'third_party/zlib'
71        ],
72        'defines': [
73          'NOMINMAX', # To suppress max/min macro definition.
74          'WIN32',
75        ],
76      }],
77    ],
78  },
79  'targets': [
80    {
81      'target_name': 'ots',
82      'type': 'static_library',
83      'sources': [
84        '<@(ots_sources)',
85      ],
86      'defines': [
87        'OTS_DEBUG',
88      ],
89      'dependencies': [
90        'third_party/lzma_sdk/lzma_sdk.gyp:ots_lzma_sdk',
91      ],
92      'include_dirs': [
93        '<@(ots_include_dirs)',
94      ],
95      'direct_dependent_settings': {
96        'include_dirs': [
97          '<@(ots_include_dirs)',
98        ],
99      },
100    },
101    {
102      'target_name': 'freetype2',
103      'type': 'none',
104      'conditions': [
105        ['OS=="linux"', {
106          'direct_dependent_settings': {
107            'cflags': [
108              '<!(pkg-config freetype2 --cflags)',
109            ],
110            'link_settings': {
111              'libraries': [
112                '<!(pkg-config freetype2 --libs)',
113              ],
114            },
115          },
116        }],
117      ],
118    },
119    {
120      'target_name': 'idempotent',
121      'type': 'executable',
122      'sources': [
123        'test/idempotent.cc',
124      ],
125      'dependencies': [
126        'ots',
127      ],
128      'conditions': [
129        ['OS=="linux"', {
130          'dependencies': [
131            'freetype2',
132          ]
133        }],
134        ['OS=="win"', {
135          'link_settings': {
136            'libraries': [
137              '-lgdi32.lib',
138            ],
139          },
140        }],
141      ],
142    },
143    {
144      'target_name': 'ot-sanitise',
145      'type': 'executable',
146      'sources': [
147        'test/ot-sanitise.cc',
148        'test/file-stream.h',
149      ],
150      'dependencies': [
151        'ots',
152      ],
153    },
154  ],
155  'conditions': [
156    ['OS=="linux" or OS=="mac"', {
157      'targets': [
158        {
159          'target_name': 'validator_checker',
160          'type': 'executable',
161          'sources': [
162            'test/validator-checker.cc',
163          ],
164          'dependencies': [
165            'ots',
166          ],
167          'conditions': [
168            ['OS=="linux"', {
169              'dependencies': [
170                'freetype2',
171              ]
172            }],
173          ],
174        },
175        {
176          'target_name': 'perf',
177          'type': 'executable',
178          'sources': [
179            'test/perf.cc',
180          ],
181          'dependencies': [
182            'ots',
183          ],
184        },
185      ],
186    }],
187    ['OS=="linux"', {
188      'targets': [
189        {
190          'target_name': 'side_by_side',
191          'type': 'executable',
192          'sources': [
193            'test/side-by-side.cc',
194          ],
195          'dependencies': [
196            'freetype2',
197            'ots',
198          ],
199        },
200      ],
201    }],
202  ],
203}
204