printing.gyp revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
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        '../skia/skia.gyp:skia',
18        '../third_party/icu/icu.gyp:icui18n',
19        '../third_party/icu/icu.gyp:icuuc',
20        '../ui/ui.gyp:ui',
21        '../url/url.gyp:url_lib',
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        'backend/printing_info_win.cc',
36        'backend/printing_info_win.h',
37        'emf_win.cc',
38        'emf_win.h',
39        'image.cc',
40        'image_linux.cc',
41        'image_mac.cc',
42        'image_win.cc',
43        'image.h',
44        'metafile.h',
45        'metafile_impl.h',
46        'metafile_skia_wrapper.h',
47        'metafile_skia_wrapper.cc',
48        'page_number.cc',
49        'page_number.h',
50        'page_range.cc',
51        'page_range.h',
52        'page_setup.cc',
53        'page_setup.h',
54        'page_size_margins.cc',
55        'page_size_margins.h',
56        'pdf_metafile_cg_mac.cc',
57        'pdf_metafile_cg_mac.h',
58        'pdf_metafile_skia.h',
59        'pdf_metafile_skia.cc',
60        'print_destination_interface.h',
61        'print_destination_none.cc',
62        'print_destination_win.cc',
63        'printed_document_gtk.cc',
64        'printed_document.cc',
65        'printed_document.h',
66        'printed_document_mac.cc',
67        'printed_document_win.cc',
68        'printed_page.cc',
69        'printed_page.h',
70        'printed_pages_source.h',
71        'printing_context.cc',
72        'printing_context.h',
73        'print_dialog_gtk_interface.h',
74        'print_job_constants.cc',
75        'print_job_constants.h',
76        'print_settings.cc',
77        'print_settings.h',
78        'print_settings_initializer.cc',
79        'print_settings_initializer.h',
80        'print_settings_initializer_gtk.cc',
81        'print_settings_initializer_gtk.h',
82        'print_settings_initializer_mac.cc',
83        'print_settings_initializer_mac.h',
84        'print_settings_initializer_win.cc',
85        'print_settings_initializer_win.h',
86        'units.cc',
87        'units.h',
88      ],
89      'direct_dependent_settings': {
90        'include_dirs': [
91          '..',
92        ],
93      },
94      'conditions': [
95        ['enable_printing!=1', {
96          'sources/': [
97            ['exclude', '.'],
98          ],
99        }],
100        ['use_aura==1', {
101          'dependencies': [
102            '<(DEPTH)/ui/aura/aura.gyp:aura',
103          ],
104        }], 
105        ['toolkit_uses_gtk == 0',{
106            'sources/': [['exclude', '_cairo\\.cc$']]
107        }],
108        ['OS!="mac"', {'sources/': [['exclude', '_mac\\.(cc|mm?)$']]}],
109        ['OS!="win"', {'sources/': [['exclude', '_win\\.cc$']]
110          }, {  # else: OS=="win"
111            'sources/': [['exclude', '_posix\\.cc$']]
112        }],
113        ['toolkit_uses_gtk == 1', {
114          'dependencies': [
115            # For FT_Init_FreeType and friends.
116            '../build/linux/system.gyp:freetype2',
117            '../build/linux/system.gyp:gtk',
118            '../build/linux/system.gyp:gtkprint',
119          ],
120        }],
121        # Mac-Aura does not support printing.
122        ['OS=="mac" and use_aura==1',{
123          'sources!': [
124            'printed_document_mac.cc',
125            'printing_context_mac.mm',
126            'printing_context_mac.h',
127          ],
128        }],
129        ['OS=="mac" and use_aura==0',{
130          'sources': [
131            'printing_context_mac.mm',
132            'printing_context_mac.h',
133          ],
134        }],
135        ['OS=="win"', {
136          'dependencies': [
137            '../win8/win8.gyp:win8_util',
138          ],
139          'conditions': [
140            ['use_aura==1', {
141              'dependencies': [
142                '<(DEPTH)/ui/aura/aura.gyp:aura',
143              ],
144          }]],
145          'defines': [
146            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
147            # of the print backend and enables a custom implementation instead.
148            'PRINT_BACKEND_AVAILABLE',
149          ],
150          'sources': [
151            'backend/win_helper.cc',
152            'backend/win_helper.h',
153            'backend/print_backend_win.cc',
154            'printing_context_win.cc',
155            'printing_context_win.h',
156          ],
157          'sources!': [
158            'print_destination_none.cc',
159          ],
160        }],
161        ['chromeos==1 or (use_aura==1 and OS!="win")',{
162          'sources': [
163            'printing_context_no_system_dialog.cc',
164            'printing_context_no_system_dialog.h',
165          ],
166        }],
167        ['use_cups==1', {
168          'dependencies': [
169            'cups',
170          ],
171          'variables': {
172            'cups_version': '<!(cups-config --api-version)',
173          },
174          'conditions': [
175            ['OS!="mac"', {
176              'dependencies': [
177                '../build/linux/system.gyp:libgcrypt',
178              ],
179            }],
180            ['cups_version in ["1.6", "1.7"]', {
181              'cflags': [
182                # CUPS 1.6 deprecated the PPD APIs, but we will stay with this
183                # API for now as supported Linux and Mac OS'es are still using
184                # older versions of CUPS. More info: crbug.com/226176
185                '-Wno-deprecated-declarations',
186                # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section
187                # below.
188              ],
189            }],
190            ['OS=="mac" and mac_sdk=="10.9"', {
191              # The 10.9 SDK includes cups 1.7, which deprecates
192              # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2()
193              # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we
194              # can't use it until 10.9 is our minimum system version.
195              # (cups_version isn't reliable on OS X, so key the check off of
196              # mac_sdk).
197              'xcode_settings': {
198                'WARNING_CFLAGS':  [
199                  '-Wno-deprecated-declarations',
200                ],
201              },
202            }],
203          ],
204          'defines': [
205            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
206            # of the print backend and enables a custom implementation instead.
207            'PRINT_BACKEND_AVAILABLE',
208          ],
209          'sources': [
210            'backend/cups_helper.cc',
211            'backend/cups_helper.h',
212            'backend/print_backend_cups.cc',
213          ],
214        }],
215        ['OS=="linux" and chromeos==1', {
216          'defines': [
217            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
218            # of the print backend and enables a custom implementation instead.
219            'PRINT_BACKEND_AVAILABLE',
220          ],
221          'sources': [
222            'backend/print_backend_chromeos.cc',
223          ],
224        }],
225        ['toolkit_uses_gtk==1 and chromeos==0', {
226          'sources': [
227            'printing_context_gtk.cc',
228            'printing_context_gtk.h',
229          ],
230        }],
231      ],
232    },
233    {
234      'target_name': 'printing_unittests',
235      'type': 'executable',
236      'dependencies': [
237        'printing',
238        '../testing/gtest.gyp:gtest',
239        '../base/base.gyp:test_support_base',
240        '../ui/ui.gyp:ui',
241      ],
242      'sources': [
243        'backend/print_backend_unittest.cc',
244        'emf_win_unittest.cc',
245        'printing_test.h',
246        'page_number_unittest.cc',
247        'page_range_unittest.cc',
248        'page_setup_unittest.cc',
249        'pdf_metafile_cg_mac_unittest.cc',
250        'printed_page_unittest.cc',
251        'run_all_unittests.cc',
252        'units_unittest.cc',
253      ],
254      'conditions': [
255        ['enable_printing!=1', {
256          'sources/': [
257            ['exclude', '.'],
258            ['include', 'run_all_unittests.cc'],
259          ],
260        }],
261        ['toolkit_uses_gtk == 0', {'sources/': [['exclude', '_gtk_unittest\\.cc$']]}],
262        ['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
263        ['OS!="win"', {'sources/': [['exclude', '_win_unittest\\.cc$']]}],
264        ['OS=="win" and use_aura == 0', {
265          'sources': [
266            'printing_context_win_unittest.cc',
267          ]
268        }],
269        ['use_cups==1', {
270          'defines': [
271            'USE_CUPS',
272          ],
273          'sources': [
274            'backend/cups_helper_unittest.cc',
275          ],
276        }],
277        ['toolkit_uses_gtk == 1', {
278          'dependencies': [
279            '../build/linux/system.gyp:gtk',
280          ],
281        }],
282        [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
283          'conditions': [
284            ['linux_use_tcmalloc == 1', {
285              'dependencies': [
286                '../base/allocator/allocator.gyp:allocator',
287              ],
288            }],
289          ],
290        }],
291      ],
292      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
293      'msvs_disabled_warnings': [ 4267, ],
294    },
295    {
296      'target_name': 'cups',
297      'type': 'none',
298      'conditions': [
299        ['use_cups==1', {
300          'direct_dependent_settings': {
301            'defines': [
302              'USE_CUPS',
303            ],
304            'conditions': [
305              ['OS=="mac"', {
306                'link_settings': {
307                  'libraries': [
308                    '$(SDKROOT)/usr/lib/libcups.dylib',
309                  ]
310                },
311              }, {
312                'link_settings': {
313                  'libraries': [
314                    '<!@(python cups_config_helper.py --libs)',
315                  ],
316                },
317              }],
318              [ 'os_bsd==1', {
319                'cflags': [
320                  '<!@(python cups_config_helper.py --cflags)',
321                ],
322              }],
323            ],
324          },
325        }],
326      ],
327    },
328  ],
329}
330