printing.gyp revision 5821806d5e7f356e8fa4b058a389a808ea183019
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    'chromium_code': 1,
8  },
9  'targets': [
10    {
11      'target_name': 'printing',
12      'type': '<(component)',
13      'dependencies': [
14        '../base/base.gyp:base',
15        '../base/base.gyp:base_i18n',
16        '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
17        '../build/temp_gyp/googleurl.gyp:googleurl',
18        '../skia/skia.gyp:skia',
19        '../third_party/icu/icu.gyp:icui18n',
20        '../third_party/icu/icu.gyp:icuuc',
21        '../ui/ui.gyp:ui',
22      ],
23      'defines': [
24        'PRINTING_IMPLEMENTATION',
25      ],
26      'include_dirs': [
27        '..',
28      ],
29      'sources': [
30        'backend/print_backend.cc',
31        'backend/print_backend.h',
32        'backend/print_backend_consts.cc',
33        'backend/print_backend_consts.h',
34        'backend/print_backend_dummy.cc',
35        'emf_win.cc',
36        'emf_win.h',
37        'image.cc',
38        'image_linux.cc',
39        'image_mac.cc',
40        'image_win.cc',
41        'image.h',
42        'metafile.h',
43        'metafile_impl.h',
44        'metafile_skia_wrapper.h',
45        'metafile_skia_wrapper.cc',
46        'page_number.cc',
47        'page_number.h',
48        'page_range.cc',
49        'page_range.h',
50        'page_setup.cc',
51        'page_setup.h',
52        'page_size_margins.cc',
53        'page_size_margins.h',
54        'pdf_metafile_cg_mac.cc',
55        'pdf_metafile_cg_mac.h',
56        'pdf_metafile_skia.h',
57        'pdf_metafile_skia.cc',
58        'print_destination_interface.h',
59        'print_destination_none.cc',
60        'print_destination_win.cc',
61        'printed_document_gtk.cc',
62        'printed_document.cc',
63        'printed_document.h',
64        'printed_document_mac.cc',
65        'printed_document_win.cc',
66        'printed_page.cc',
67        'printed_page.h',
68        'printed_pages_source.h',
69        'printing_context.cc',
70        'printing_context.h',
71        'print_dialog_gtk_interface.h',
72        'print_job_constants.cc',
73        'print_job_constants.h',
74        'print_settings.cc',
75        'print_settings.h',
76        'print_settings_initializer.cc',
77        'print_settings_initializer.h',
78        'print_settings_initializer_gtk.cc',
79        'print_settings_initializer_gtk.h',
80        'print_settings_initializer_mac.cc',
81        'print_settings_initializer_mac.h',
82        'print_settings_initializer_win.cc',
83        'print_settings_initializer_win.h',
84        'units.cc',
85        'units.h',
86      ],
87      'direct_dependent_settings': {
88        'include_dirs': [
89          '..',
90        ],
91      },
92      'conditions': [
93        ['enable_printing!=1', {
94          'sources/': [
95            ['exclude', '.'],
96          ],
97        }],
98        ['toolkit_uses_gtk == 0',{
99            'sources/': [['exclude', '_cairo\\.cc$']]
100        }],
101        ['OS!="mac"', {'sources/': [['exclude', '_mac\\.(cc|mm?)$']]}],
102        ['OS!="win"', {'sources/': [['exclude', '_win\\.cc$']]
103          }, {  # else: OS=="win"
104            'sources/': [['exclude', '_posix\\.cc$']]
105        }],
106        ['toolkit_uses_gtk == 1', {
107          'dependencies': [
108            # For FT_Init_FreeType and friends.
109            '../build/linux/system.gyp:freetype2',
110            '../build/linux/system.gyp:gtk',
111            '../build/linux/system.gyp:gtkprint',
112          ],
113        }],
114        ['OS=="mac" and use_skia==0', {
115          'sources/': [
116            ['exclude', 'pdf_metafile_skia\\.(cc|h)$'],
117            ['exclude', 'metafile_skia_wrapper\\.(cc|h)$'],
118          ],
119        }],
120        # Mac-Aura does not support printing.
121        ['OS=="mac" and use_aura==1',{
122          'sources!': [
123            'printed_document_mac.cc',
124            'printing_context_mac.mm',
125            'printing_context_mac.h',
126          ],
127        }],
128        ['OS=="mac" and use_aura==0',{
129          'sources': [
130            'printing_context_mac.mm',
131            'printing_context_mac.h',
132          ],
133        }],
134        ['OS=="win"', {
135          'conditions': [
136            ['use_aura==0', {
137              'sources': [
138                'printing_context_win.cc',
139                'printing_context_win.h',
140              ],
141          }]],
142          'defines': [
143            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
144            # of the print backend and enables a custom implementation instead.
145            'PRINT_BACKEND_AVAILABLE',
146          ],
147          'sources': [
148            'backend/win_helper.cc',
149            'backend/win_helper.h',
150            'backend/print_backend_win.cc',
151          ],
152          'sources!': [
153            'print_destination_none.cc',
154          ],
155        }],
156        ['chromeos==1 or use_aura==1',{
157          'sources': [
158            'printing_context_no_system_dialog.cc',
159            'printing_context_no_system_dialog.h',
160          ],
161        }],
162        ['use_cups==1', {
163          'dependencies': [
164            'cups',
165          ],
166          'conditions': [
167            ['OS!="mac"', {
168              'dependencies': [
169                '../build/linux/system.gyp:libgcrypt',
170              ],
171            }],
172          ],
173          'defines': [
174            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
175            # of the print backend and enables a custom implementation instead.
176            'PRINT_BACKEND_AVAILABLE',
177          ],
178          'sources': [
179            'backend/cups_helper.cc',
180            'backend/cups_helper.h',
181            'backend/print_backend_cups.cc',
182          ],
183        }],
184        ['OS=="linux" and chromeos==1', {
185          'defines': [
186            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
187            # of the print backend and enables a custom implementation instead.
188            'PRINT_BACKEND_AVAILABLE',
189          ],
190          'sources': [
191            'backend/print_backend_chromeos.cc',
192          ],
193        }],
194        ['toolkit_uses_gtk==1 and chromeos==0', {
195          'sources': [
196            'printing_context_gtk.cc',
197            'printing_context_gtk.h',
198          ],
199        }],
200      ],
201    },
202    {
203      'target_name': 'printing_unittests',
204      'type': 'executable',
205      'dependencies': [
206        'printing',
207        '../testing/gtest.gyp:gtest',
208        '../base/base.gyp:test_support_base',
209        '../ui/ui.gyp:ui',
210      ],
211      'sources': [
212        'backend/print_backend_unittest.cc',
213        'emf_win_unittest.cc',
214        'printing_test.h',
215        'page_number_unittest.cc',
216        'page_range_unittest.cc',
217        'page_setup_unittest.cc',
218        'pdf_metafile_cg_mac_unittest.cc',
219        'printed_page_unittest.cc',
220        'run_all_unittests.cc',
221        'units_unittest.cc',
222      ],
223      'conditions': [
224        ['enable_printing!=1', {
225          'sources/': [
226            ['exclude', '.'],
227            ['include', 'run_all_unittests.cc'],
228          ],
229        }],
230        ['toolkit_uses_gtk == 0', {'sources/': [['exclude', '_gtk_unittest\\.cc$']]}],
231        ['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
232        ['OS!="win"', {'sources/': [['exclude', '_win_unittest\\.cc$']]}],
233        ['OS=="win" and use_aura == 0', {
234          'sources': [
235            'printing_context_win_unittest.cc',
236          ]
237        }],
238        ['use_cups==1', {
239          'defines': [
240            'USE_CUPS',
241          ],
242          'sources': [
243            'backend/cups_helper_unittest.cc',
244          ],
245        }],
246        ['toolkit_uses_gtk == 1', {
247          'dependencies': [
248            '../build/linux/system.gyp:gtk',
249          ],
250        }],
251        [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
252          'conditions': [
253            ['linux_use_tcmalloc == 1', {
254              'dependencies': [
255                '../base/allocator/allocator.gyp:allocator',
256              ],
257            }],
258          ],
259        }],
260      ],
261    },
262    {
263      'target_name': 'cups',
264      'type': 'none',
265      'conditions': [
266        ['use_cups==1', {
267          'direct_dependent_settings': {
268            'defines': [
269              'USE_CUPS',
270            ],
271            'conditions': [
272              ['OS=="mac"', {
273                'link_settings': {
274                  'libraries': [
275                    '$(SDKROOT)/usr/lib/libcups.dylib',
276                  ]
277                },
278              }, {
279                'link_settings': {
280                  'libraries': [
281                    '<!@(python cups_config_helper.py --libs)',
282                  ],
283                },
284              }],
285              [ 'os_bsd==1', {
286                'cflags': [
287                  '<!@(python cups_config_helper.py --cflags)',
288                ],
289              }],
290            ],
291          },
292        }],
293      ],
294    },
295  ],
296}
297