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