printing.gyp revision 0529e5d033099cbfc42635f6f6183833b09dff6e
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/gfx/gfx.gyp:gfx',
21        '../ui/gfx/gfx.gyp:gfx_geometry',
22        '../url/url.gyp:url_lib',
23      ],
24      'defines': [
25        'PRINTING_IMPLEMENTATION',
26      ],
27      'include_dirs': [
28        '..',
29      ],
30      'sources': [
31        'backend/print_backend.cc',
32        'backend/print_backend.h',
33        'backend/print_backend_consts.cc',
34        'backend/print_backend_consts.h',
35        'backend/print_backend_dummy.cc',
36        'backend/printing_info_win.cc',
37        'backend/printing_info_win.h',
38        'emf_win.cc',
39        'emf_win.h',
40        'image.cc',
41        'image.h',
42        'image_android.cc',
43        'image_linux.cc',
44        'image_mac.cc',
45        'image_win.cc',
46        'metafile.h',
47        'metafile_impl.h',
48        'metafile_skia_wrapper.cc',
49        'metafile_skia_wrapper.h',
50        'page_number.cc',
51        'page_number.h',
52        'page_range.cc',
53        'page_range.h',
54        'page_setup.cc',
55        'page_setup.h',
56        'page_size_margins.cc',
57        'page_size_margins.h',
58        'pdf_metafile_cg_mac.cc',
59        'pdf_metafile_cg_mac.h',
60        'pdf_metafile_skia.cc',
61        'pdf_metafile_skia.h',
62        'print_destination_interface.h',
63        'print_destination_none.cc',
64        'print_dialog_gtk_interface.h',
65        'print_job_constants.cc',
66        'print_job_constants.h',
67        'print_settings.cc',
68        'print_settings.h',
69        'print_settings_initializer.cc',
70        'print_settings_initializer.h',
71        'print_settings_initializer_mac.cc',
72        'print_settings_initializer_mac.h',
73        'print_settings_initializer_win.cc',
74        'print_settings_initializer_win.h',
75        'printed_document.cc',
76        'printed_document.h',
77        'printed_document_linux.cc',
78        'printed_document_mac.cc',
79        'printed_document_win.cc',
80        'printed_page.cc',
81        'printed_page.h',
82        'printed_pages_source.h',
83        'printing_context.cc',
84        'printing_context.h',
85        'printing_utils.cc',
86        'printing_utils.h',
87        'units.cc',
88        'units.h',
89      ],
90      'direct_dependent_settings': {
91        'include_dirs': [
92          '..',
93        ],
94      },
95      'conditions': [
96        ['use_aura==1', {
97          'dependencies': [
98            '<(DEPTH)/ui/aura/aura.gyp:aura',
99          ],
100        }],
101        # Mac-Aura does not support printing.
102        ['OS=="mac" and use_aura==1',{
103          'sources!': [
104            'printed_document_mac.cc',
105            'printing_context_mac.mm',
106            'printing_context_mac.h',
107          ],
108        }],
109        ['OS=="mac" and use_aura==0',{
110          'sources': [
111            'printing_context_mac.mm',
112            'printing_context_mac.h',
113          ],
114        }],
115        ['OS=="win"', {
116          'dependencies': [
117            '<(DEPTH)/ui/aura/aura.gyp:aura',
118          ],
119          'defines': [
120            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
121            # of the print backend and enables a custom implementation instead.
122            'PRINT_BACKEND_AVAILABLE',
123          ],
124          'sources': [
125            'backend/win_helper.cc',
126            'backend/win_helper.h',
127            'backend/print_backend_win.cc',
128            'printing_context_win.cc',
129            'printing_context_win.h',
130          ],
131        }],
132        ['chromeos==1',{
133          'sources': [
134            'printing_context_no_system_dialog.cc',
135            'printing_context_no_system_dialog.h',
136          ],
137        }],
138        ['use_cups==1', {
139          'dependencies': [
140            'cups',
141          ],
142          'variables': {
143            'cups_version': '<!(cups-config --api-version)',
144          },
145          'conditions': [
146            ['OS!="mac"', {
147              'dependencies': [
148                '../build/linux/system.gyp:libgcrypt',
149              ],
150            }],
151            ['cups_version in ["1.6", "1.7"]', {
152              'cflags': [
153                # CUPS 1.6 deprecated the PPD APIs, but we will stay with this
154                # API for now as supported Linux and Mac OS'es are still using
155                # older versions of CUPS. More info: crbug.com/226176
156                '-Wno-deprecated-declarations',
157                # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section
158                # below.
159              ],
160            }],
161            ['OS=="mac" and mac_sdk=="10.9"', {
162              # The 10.9 SDK includes cups 1.7, which deprecates
163              # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2()
164              # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we
165              # can't use it until 10.9 is our minimum system version.
166              # (cups_version isn't reliable on OS X, so key the check off of
167              # mac_sdk).
168              'xcode_settings': {
169                'WARNING_CFLAGS':  [
170                  '-Wno-deprecated-declarations',
171                ],
172              },
173            }],
174          ],
175          'defines': [
176            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
177            # of the print backend and enables a custom implementation instead.
178            'PRINT_BACKEND_AVAILABLE',
179          ],
180          'sources': [
181            'backend/cups_helper.cc',
182            'backend/cups_helper.h',
183            'backend/print_backend_cups.cc',
184          ],
185        }],
186        ['OS=="linux" and chromeos==1', {
187          'defines': [
188            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
189            # of the print backend and enables a custom implementation instead.
190            'PRINT_BACKEND_AVAILABLE',
191          ],
192          'sources': [
193            'backend/print_backend_chromeos.cc',
194          ],
195        }],
196        ['OS=="linux" and chromeos==0', {
197          'sources': [
198            'printing_context_linux.cc',
199            'printing_context_linux.h',
200          ],
201        }],
202        ['OS=="android"', {
203          'sources': [
204            'printing_context_android.cc',
205            'printing_context_android.h',
206          ],
207          'dependencies': [
208            'printing_jni_headers',
209          ],
210        }],
211      ],
212    },
213    {
214      'target_name': 'printing_unittests',
215      'type': 'executable',
216      'dependencies': [
217        '../base/base.gyp:run_all_unittests',
218        '../base/base.gyp:test_support_base',
219        '../testing/gtest.gyp:gtest',
220        '../ui/base/ui_base.gyp:ui_base',
221        '../ui/gfx/gfx.gyp:gfx',
222        '../ui/gfx/gfx.gyp:gfx_geometry',
223        'printing',
224      ],
225      'sources': [
226        'emf_win_unittest.cc',
227        'page_number_unittest.cc',
228        'page_range_unittest.cc',
229        'page_setup_unittest.cc',
230        'pdf_metafile_cg_mac_unittest.cc',
231        'printed_page_unittest.cc',
232        'printing_context_win_unittest.cc',
233        'printing_test.h',
234        'printing_utils_unittest.cc',
235        'units_unittest.cc',
236      ],
237      'conditions': [
238        ['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
239        ['OS!="win"', {'sources/': [['exclude', '_win_unittest\\.cc$']]}],
240        ['use_cups==1', {
241          'defines': [
242            'USE_CUPS',
243          ],
244          'sources': [
245            'backend/cups_helper_unittest.cc',
246          ],
247        }],
248        [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
249          'conditions': [
250            # TODO(dmikurube): Kill linux_use_tcmalloc. http://crbug.com/345554
251            ['(use_allocator!="none" and use_allocator!="see_use_tcmalloc") or (use_allocator=="see_use_tcmalloc" and linux_use_tcmalloc==1)', {
252              'dependencies': [
253                '../base/allocator/allocator.gyp:allocator',
254              ],
255            }],
256          ],
257        }],
258      ],
259      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
260      'msvs_disabled_warnings': [ 4267, ],
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  'conditions': [
297    ['OS == "android"', {
298      'targets': [
299        {
300          'target_name': 'printing_jni_headers',
301          'type': 'none',
302          'sources': [
303            'android/java/src/org/chromium/printing/PrintingContext.java',
304          ],
305          'variables': {
306            'jni_gen_package': 'printing',
307            'jni_generator_ptr_type': 'long',
308          },
309          'includes': [ '../build/jni_generator.gypi' ],
310        },
311	{
312	  'target_name': 'printing_java',
313          'type': 'none',
314          'variables': {
315            'java_in_dir': '../printing/android/java',
316          },
317          'dependencies': [
318            '../base/base.gyp:base_java',
319          ],
320          'includes': [ '../build/java.gypi'  ],
321	}
322      ]
323    }],
324  ]
325}
326