summaryrefslogtreecommitdiffstats
path: root/printing/printing.gyp
blob: 6e5c06d63c5e2d0512cddbca697ad0aed1e71333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'variables': {
    'chromium_code': 1,
  },
  'targets': [
    {
      'target_name': 'printing',
      'type': '<(component)',
      'dependencies': [
        '../base/base.gyp:base',
        '../base/base.gyp:base_i18n',
        '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
        '../skia/skia.gyp:skia',
        '../third_party/icu/icu.gyp:icui18n',
        '../third_party/icu/icu.gyp:icuuc',
        '../ui/gfx/gfx.gyp:gfx',
        '../ui/gfx/gfx.gyp:gfx_geometry',
        '../url/url.gyp:url_lib',
      ],
      'defines': [
        'PRINTING_IMPLEMENTATION',
      ],
      'include_dirs': [
        '..',
      ],
      'sources': [
        'backend/print_backend.cc',
        'backend/print_backend.h',
        'backend/print_backend_consts.cc',
        'backend/print_backend_consts.h',
        'backend/print_backend_dummy.cc',
        'backend/print_backend_win.cc',
        'backend/printing_info_win.cc',
        'backend/printing_info_win.h',
        'emf_win.cc',
        'emf_win.h',
        'image.cc',
        'image.h',
        'image_android.cc',
        'image_linux.cc',
        'image_mac.cc',
        'image_win.cc',
        'metafile.cc',
        'metafile.h',
        'metafile_skia_wrapper.cc',
        'metafile_skia_wrapper.h',
        'page_number.cc',
        'page_number.h',
        'page_range.cc',
        'page_range.h',
        'page_setup.cc',
        'page_setup.h',
        'page_size_margins.h',
        'pdf_metafile_cg_mac.cc',
        'pdf_metafile_cg_mac.h',
        'pdf_metafile_skia.cc',
        'pdf_metafile_skia.h',
        'print_dialog_gtk_interface.h',
        'print_job_constants.cc',
        'print_job_constants.h',
        'print_settings.cc',
        'print_settings.h',
        'print_settings_conversion.cc',
        'print_settings_conversion.h',
        'print_settings_initializer_mac.cc',
        'print_settings_initializer_mac.h',
        'print_settings_initializer_win.cc',
        'print_settings_initializer_win.h',
        'printed_document.cc',
        'printed_document.h',
        'printed_document_linux.cc',
        'printed_document_mac.cc',
        'printed_document_win.cc',
        'printed_page.cc',
        'printed_page.h',
        'printed_pages_source.h',
        'printing_context.cc',
        'printing_context.h',
        'printing_context_system_dialog_win.cc',
        'printing_context_system_dialog_win.h',
        'printing_context_win.cc',
        'printing_context_win.h',
        'printing_utils.cc',
        'printing_utils.h',
        'units.cc',
        'units.h',
      ],
      'direct_dependent_settings': {
        'include_dirs': [
          '..',
        ],
      },
      'conditions': [
        ['use_aura==1', {
          'dependencies': [
            '<(DEPTH)/ui/aura/aura.gyp:aura',
          ],
        }],
        # Mac-Aura does not support printing.
        ['OS=="mac" and use_aura==1',{
          'sources!': [
            'printed_document_mac.cc',
            'printing_context_mac.mm',
            'printing_context_mac.h',
          ],
        }],
        ['OS=="mac" and use_aura==0',{
          'sources': [
            'printing_context_mac.mm',
            'printing_context_mac.h',
          ],
        }],
        ['OS=="win"', {
          'dependencies': [
            '<(DEPTH)/ui/aura/aura.gyp:aura',
          ],
          'defines': [
            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
            # of the print backend and enables a custom implementation instead.
            'PRINT_BACKEND_AVAILABLE',
          ],
          'sources': [
            'backend/win_helper.cc',
            'backend/win_helper.h',
          ],
        }],
        ['chromeos==1',{
          'sources': [
            'printing_context_no_system_dialog.cc',
            'printing_context_no_system_dialog.h',
          ],
        }],
        ['use_cups==1', {
          'dependencies': [
            'cups',
          ],
          'variables': {
            'cups_version': '<!(python cups_config_helper.py --api-version <(sysroot))',
          },
          'conditions': [
            ['cups_version in ["1.6", "1.7"]', {
              'cflags': [
                # CUPS 1.6 deprecated the PPD APIs, but we will stay with this
                # API for now as supported Linux and Mac OS'es are still using
                # older versions of CUPS. More info: crbug.com/226176
                '-Wno-deprecated-declarations',
                # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section
                # below.
              ],
            }],
            ['OS=="mac" and mac_sdk=="10.9"', {
              # The 10.9 SDK includes cups 1.7, which deprecates
              # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2()
              # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we
              # can't use it until 10.9 is our minimum system version.
              # (cups_version isn't reliable on OS X, so key the check off of
              # mac_sdk).
              'xcode_settings': {
                'WARNING_CFLAGS':  [
                  '-Wno-deprecated-declarations',
                ],
              },
            }],
          ],
          'defines': [
            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
            # of the print backend and enables a custom implementation instead.
            'PRINT_BACKEND_AVAILABLE',
          ],
          'sources': [
            'backend/cups_helper.cc',
            'backend/cups_helper.h',
            'backend/print_backend_cups.cc',
          ],
        }],
        ['OS=="linux" and chromeos==1', {
          'defines': [
            # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
            # of the print backend and enables a custom implementation instead.
            'PRINT_BACKEND_AVAILABLE',
          ],
          'sources': [
            'backend/print_backend_chromeos.cc',
          ],
        }],
        ['OS=="linux" and chromeos==0', {
          'sources': [
            'printing_context_linux.cc',
            'printing_context_linux.h',
          ],
        }],
        ['OS=="android"', {
          'sources': [
            'printing_context_android.cc',
            'printing_context_android.h',
          ],
          'dependencies': [
            'printing_jni_headers',
          ],
        }, {
          'sources': [
            'pdf_transform.cc',
            'pdf_transform.h',
          ],
        }],
      ],
    },
    {
      'target_name': 'printing_unittests',
      'type': 'executable',
      'dependencies': [
        '../base/base.gyp:run_all_unittests',
        '../base/base.gyp:test_support_base',
        '../testing/gtest.gyp:gtest',
        '../ui/base/ui_base.gyp:ui_base',
        '../ui/gfx/gfx.gyp:gfx',
        '../ui/gfx/gfx.gyp:gfx_geometry',
        '../ui/gfx/gfx.gyp:gfx_test_support',
        'printing',
      ],
      'sources': [
        'emf_win_unittest.cc',
        'page_number_unittest.cc',
        'page_range_unittest.cc',
        'page_setup_unittest.cc',
        'pdf_metafile_cg_mac_unittest.cc',
        'printed_page_unittest.cc',
        'printing_context_win_unittest.cc',
        'printing_test.h',
        'printing_utils_unittest.cc',
        'units_unittest.cc',
      ],
      'conditions': [
        ['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
        ['OS!="win"', {'sources/': [['exclude', '_win_unittest\\.cc$']]}],
        ['OS!="android"', {
          'sources': ['pdf_transform_unittest.cc']
        }],
        ['use_cups==1', {
          'defines': [
            'USE_CUPS',
          ],
          'sources': [
            'backend/cups_helper_unittest.cc',
          ],
        }],
      ],
      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
      'msvs_disabled_warnings': [ 4267, ],
    },
    {
      # GN version: //printing:cups (config, not a target).
      'target_name': 'cups',
      'type': 'none',
      'conditions': [
        ['use_cups==1', {
          'direct_dependent_settings': {
            'defines': [
              'USE_CUPS',
            ],
            'conditions': [
              ['OS=="mac"', {
                'link_settings': {
                  'libraries': [
                    '$(SDKROOT)/usr/lib/libcups.dylib',
                  ]
                },
              }, {
                'link_settings': {
                  'libraries': [
                    '<!@(python cups_config_helper.py --libs <(sysroot))',
                  ],
                },
              }],
              ['os_bsd==1', {
                'cflags': [
                  '<!@(python cups_config_helper.py --cflags <(sysroot))',
                ],
              }],
            ],
          },
        }],
      ],
    },
  ],
  'conditions': [
    ['OS == "android"', {
      'targets': [
        {
          # GN: //printing:printing_jni_headers
          'target_name': 'printing_jni_headers',
          'type': 'none',
          'sources': [
            'android/java/src/org/chromium/printing/PrintingContext.java',
          ],
          'variables': {
            'jni_gen_package': 'printing',
          },
          'includes': [ '../build/jni_generator.gypi' ],
        },
        {
          # GN: //printing:printing_java
          'target_name': 'printing_java',
          'type': 'none',
          'variables': {
            'java_in_dir': '../printing/android/java',
          },
          'dependencies': [
            '../base/base.gyp:base_java',
          ],
          'includes': [ '../build/java.gypi'  ],
        }
      ]
    }],
    ['test_isolation_mode != "noop"', {
      'targets': [
        {
          'target_name': 'printing_unittests_run',
          'type': 'none',
          'dependencies': [
            'printing_unittests',
          ],
          'includes': [
            '../build/isolate.gypi',
          ],
          'sources': [
            'printing_unittests.isolate',
          ],
        },
      ],
    }],
  ]
}