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