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