printing.gyp revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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_destination_win.cc',
65        'print_dialog_gtk_interface.h',
66        'print_job_constants.cc',
67        'print_job_constants.h',
68        'print_settings.cc',
69        'print_settings.h',
70        'print_settings_initializer.cc',
71        'print_settings_initializer.h',
72        'print_settings_initializer_gtk.cc',
73        'print_settings_initializer_gtk.h',
74        'print_settings_initializer_mac.cc',
75        'print_settings_initializer_mac.h',
76        'print_settings_initializer_win.cc',
77        'print_settings_initializer_win.h',
78        'printed_document.cc',
79        'printed_document.h',
80        'printed_document_linux.cc',
81        'printed_document_mac.cc',
82        'printed_document_win.cc',
83        'printed_page.cc',
84        'printed_page.h',
85        'printed_pages_source.h',
86        'printing_context.cc',
87        'printing_context.h',
88        'printing_utils.cc',
89        'printing_utils.h',
90        'units.cc',
91        'units.h',
92      ],
93      'direct_dependent_settings': {
94        'include_dirs': [
95          '..',
96        ],
97      },
98      'conditions': [
99        ['use_aura==1', {
100          'dependencies': [
101            '<(DEPTH)/ui/aura/aura.gyp:aura',
102          ],
103        }], 
104        ['toolkit_uses_gtk == 0',{
105            'sources/': [['exclude', '_cairo\\.cc$']]
106          }, {  # else: 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        # Mac-Aura does not support printing.
115        ['OS=="mac" and use_aura==1',{
116          'sources!': [
117            'printed_document_mac.cc',
118            'printing_context_mac.mm',
119            'printing_context_mac.h',
120          ],
121        }],
122        ['OS=="mac" and use_aura==0',{
123          'sources': [
124            'printing_context_mac.mm',
125            'printing_context_mac.h',
126          ],
127        }],
128        ['OS=="win"', {
129          'dependencies': [
130            '../win8/win8.gyp:win8_util',
131          ],
132          'conditions': [
133            ['use_aura==1', {
134              'dependencies': [
135                '<(DEPTH)/ui/aura/aura.gyp:aura',
136              ],
137          }]],
138          'defines': [
139            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
140            # of the print backend and enables a custom implementation instead.
141            'PRINT_BACKEND_AVAILABLE',
142          ],
143          'sources': [
144            'backend/win_helper.cc',
145            'backend/win_helper.h',
146            'backend/print_backend_win.cc',
147            'printing_context_win.cc',
148            'printing_context_win.h',
149          ],
150          'sources!': [
151            'print_destination_none.cc',
152          ],
153        }],
154        ['chromeos==1',{
155          'sources': [
156            'printing_context_no_system_dialog.cc',
157            'printing_context_no_system_dialog.h',
158          ],
159        }],
160        ['use_cups==1', {
161          'dependencies': [
162            'cups',
163          ],
164          'variables': {
165            'cups_version': '<!(cups-config --api-version)',
166          },
167          'conditions': [
168            ['OS!="mac"', {
169              'dependencies': [
170                '../build/linux/system.gyp:libgcrypt',
171              ],
172            }],
173            ['cups_version in ["1.6", "1.7"]', {
174              'cflags': [
175                # CUPS 1.6 deprecated the PPD APIs, but we will stay with this
176                # API for now as supported Linux and Mac OS'es are still using
177                # older versions of CUPS. More info: crbug.com/226176
178                '-Wno-deprecated-declarations',
179                # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section
180                # below.
181              ],
182            }],
183            ['OS=="mac" and mac_sdk=="10.9"', {
184              # The 10.9 SDK includes cups 1.7, which deprecates
185              # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2()
186              # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we
187              # can't use it until 10.9 is our minimum system version.
188              # (cups_version isn't reliable on OS X, so key the check off of
189              # mac_sdk).
190              'xcode_settings': {
191                'WARNING_CFLAGS':  [
192                  '-Wno-deprecated-declarations',
193                ],
194              },
195            }],
196          ],
197          'defines': [
198            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
199            # of the print backend and enables a custom implementation instead.
200            'PRINT_BACKEND_AVAILABLE',
201          ],
202          'sources': [
203            'backend/cups_helper.cc',
204            'backend/cups_helper.h',
205            'backend/print_backend_cups.cc',
206          ],
207        }],
208        ['OS=="linux" and chromeos==1', {
209          'defines': [
210            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
211            # of the print backend and enables a custom implementation instead.
212            'PRINT_BACKEND_AVAILABLE',
213          ],
214          'sources': [
215            'backend/print_backend_chromeos.cc',
216          ],
217        }],
218        ['OS=="linux" and chromeos==0', {
219          'sources': [
220            'printing_context_linux.cc',
221            'printing_context_linux.h',
222          ],
223        }],
224        ['OS=="android"', {
225          'sources': [
226            'printing_context_android.cc',
227            'printing_context_android.h',
228          ],
229          'dependencies': [
230            'printing_jni_headers',
231          ],
232        }],
233      ],
234    },
235    {
236      'target_name': 'printing_unittests',
237      'type': 'executable',
238      'dependencies': [
239        '../base/base.gyp:run_all_unittests',
240        '../base/base.gyp:test_support_base',
241        '../testing/gtest.gyp:gtest',
242        '../ui/base/ui_base.gyp:ui_base',
243        '../ui/gfx/gfx.gyp:gfx',
244        '../ui/gfx/gfx.gyp:gfx_geometry',
245        'printing',
246      ],
247      'sources': [
248        'emf_win_unittest.cc',
249        'page_number_unittest.cc',
250        'page_range_unittest.cc',
251        'page_setup_unittest.cc',
252        'pdf_metafile_cg_mac_unittest.cc',
253        'printed_page_unittest.cc',
254        'printing_context_win_unittest.cc',
255        'printing_test.h',
256        'printing_utils_unittest.cc',
257        'units_unittest.cc',
258      ],
259      'conditions': [
260        ['toolkit_uses_gtk == 0', {'sources/': [['exclude', '_gtk_unittest\\.cc$']]}],
261        ['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
262        ['OS!="win"', {'sources/': [['exclude', '_win_unittest\\.cc$']]}],
263        ['use_cups==1', {
264          'defines': [
265            'USE_CUPS',
266          ],
267          'sources': [
268            'backend/cups_helper_unittest.cc',
269          ],
270        }],
271        ['toolkit_uses_gtk == 1', {
272          'dependencies': [
273            '../build/linux/system.gyp:gtk',
274          ],
275        }],
276        [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
277          'conditions': [
278            # TODO(dmikurube): Kill linux_use_tcmalloc. http://crbug.com/345554
279            ['(use_allocator!="none" and use_allocator!="see_use_tcmalloc") or (use_allocator=="see_use_tcmalloc" and linux_use_tcmalloc==1)', {
280              'dependencies': [
281                '../base/allocator/allocator.gyp:allocator',
282              ],
283            }],
284          ],
285        }],
286      ],
287      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
288      'msvs_disabled_warnings': [ 4267, ],
289    },
290    {
291      'target_name': 'cups',
292      'type': 'none',
293      'conditions': [
294        ['use_cups==1', {
295          'direct_dependent_settings': {
296            'defines': [
297              'USE_CUPS',
298            ],
299            'conditions': [
300              ['OS=="mac"', {
301                'link_settings': {
302                  'libraries': [
303                    '$(SDKROOT)/usr/lib/libcups.dylib',
304                  ]
305                },
306              }, {
307                'link_settings': {
308                  'libraries': [
309                    '<!@(python cups_config_helper.py --libs)',
310                  ],
311                },
312              }],
313              [ 'os_bsd==1', {
314                'cflags': [
315                  '<!@(python cups_config_helper.py --cflags)',
316                ],
317              }],
318            ],
319          },
320        }],
321      ],
322    },
323  ],
324  'conditions': [
325    ['OS == "android"', {
326      'targets': [
327        {
328          'target_name': 'printing_jni_headers',
329          'type': 'none',
330          'sources': [
331            'android/java/src/org/chromium/printing/PrintingContext.java',
332          ],
333          'variables': {
334            'jni_gen_package': 'printing',
335            'jni_generator_ptr_type': 'long',
336          },
337          'includes': [ '../build/jni_generator.gypi' ],
338        },
339	{
340	  'target_name': 'printing_java',
341          'type': 'none',
342          'variables': {
343            'java_in_dir': '../printing/android/java',
344          },
345          'dependencies': [
346            '../base/base.gyp:base_java',
347          ],
348          'includes': [ '../build/java.gypi'  ],
349	}
350      ]
351    }],
352  ]
353}
354