OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 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 import("//build/config/ui.gni") |
| 6 if (is_mac) { |
| 7 import("//build/config/mac/mac_sdk.gni") |
| 8 } |
| 9 if (is_android) { |
| 10 import("//build/config/android/rules.gni") |
| 11 } |
| 12 |
| 13 use_cups = ((is_linux && !is_chromeos) || is_mac) |
| 14 |
| 15 component("printing") { |
| 16 sources = [ |
| 17 "backend/print_backend.cc", |
| 18 "backend/print_backend.h", |
| 19 "backend/print_backend_consts.cc", |
| 20 "backend/print_backend_consts.h", |
| 21 "backend/print_backend_dummy.cc", |
| 22 "backend/printing_info_win.cc", |
| 23 "backend/printing_info_win.h", |
| 24 "emf_win.cc", |
| 25 "emf_win.h", |
| 26 "image.cc", |
| 27 "image.h", |
| 28 "image_android.cc", |
| 29 "image_linux.cc", |
| 30 "image_mac.cc", |
| 31 "image_win.cc", |
| 32 "metafile.h", |
| 33 "metafile_impl.h", |
| 34 "metafile_skia_wrapper.cc", |
| 35 "metafile_skia_wrapper.h", |
| 36 "page_number.cc", |
| 37 "page_number.h", |
| 38 "page_range.cc", |
| 39 "page_range.h", |
| 40 "page_setup.cc", |
| 41 "page_setup.h", |
| 42 "page_size_margins.cc", |
| 43 "page_size_margins.h", |
| 44 "pdf_metafile_cg_mac.cc", |
| 45 "pdf_metafile_cg_mac.h", |
| 46 "pdf_metafile_skia.cc", |
| 47 "pdf_metafile_skia.h", |
| 48 "print_destination_interface.h", |
| 49 "print_destination_none.cc", |
| 50 "print_dialog_gtk_interface.h", |
| 51 "print_job_constants.cc", |
| 52 "print_job_constants.h", |
| 53 "print_settings.cc", |
| 54 "print_settings.h", |
| 55 "print_settings_initializer.cc", |
| 56 "print_settings_initializer.h", |
| 57 "print_settings_initializer_mac.cc", |
| 58 "print_settings_initializer_mac.h", |
| 59 "print_settings_initializer_win.cc", |
| 60 "print_settings_initializer_win.h", |
| 61 "printed_document.cc", |
| 62 "printed_document.h", |
| 63 "printed_document_linux.cc", |
| 64 "printed_document_mac.cc", |
| 65 "printed_document_win.cc", |
| 66 "printed_page.cc", |
| 67 "printed_page.h", |
| 68 "printed_pages_source.h", |
| 69 "printing_context.cc", |
| 70 "printing_context.h", |
| 71 "printing_utils.cc", |
| 72 "printing_utils.h", |
| 73 "units.cc", |
| 74 "units.h", |
| 75 ] |
| 76 |
| 77 cflags = [] |
| 78 defines = [ "PRINTING_IMPLEMENTATION" ] |
| 79 |
| 80 deps = [ |
| 81 "//base", |
| 82 "//base:i18n", |
| 83 "//base/third_party/dynamic_annotations", |
| 84 "//skia", |
| 85 "//third_party/icu", |
| 86 "//ui/gfx", |
| 87 "//ui/gfx/geometry", |
| 88 "//url", |
| 89 ] |
| 90 |
| 91 if (use_aura) { |
| 92 # deps += [ "//ui/aura" ] TODO(GYP) |
| 93 } |
| 94 |
| 95 if (is_mac) { |
| 96 # Mac-Aura does not support printing. |
| 97 if (use_aura) { |
| 98 sources -= [ |
| 99 "printed_document_mac.cc", |
| 100 ] |
| 101 } else { |
| 102 sources += [ |
| 103 "printing_context_mac.mm", |
| 104 "printing_context_mac.h", |
| 105 ] |
| 106 } |
| 107 } |
| 108 |
| 109 if (is_win) { |
| 110 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation of the |
| 111 # print backend and enables a custom implementation instead. |
| 112 defines += [ "PRINT_BACKEND_AVAILABLE" ] |
| 113 sources += [ |
| 114 "backend/win_helper.cc", |
| 115 "backend/win_helper.h", |
| 116 "backend/print_backend_win.cc", |
| 117 "printing_context_win.cc", |
| 118 "printing_context_win.h", |
| 119 ] |
| 120 } |
| 121 |
| 122 if (is_chromeos) { |
| 123 sources += [ |
| 124 "printing_context_no_system_dialog.cc", |
| 125 "printing_context_no_system_dialog.h", |
| 126 ] |
| 127 } |
| 128 |
| 129 if (use_cups) { |
| 130 cups_version = exec_script("cups_config_helper.py", [ "--api-version" ], |
| 131 "trim string") |
| 132 |
| 133 configs += [ ":cups" ] |
| 134 |
| 135 if (is_linux) { |
| 136 if (cups_version == "1.6" || cups_version == "1.7") { |
| 137 cflags += [ |
| 138 # CUPS 1.6 deprecated the PPD APIs, but we will stay with this |
| 139 # API for now as supported Linux and Mac OS'es are still using |
| 140 # older versions of CUPS. More info: crbug.com/226176 |
| 141 "-Wno-deprecated-declarations", |
| 142 # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section |
| 143 # below. |
| 144 ] |
| 145 } |
| 146 } |
| 147 |
| 148 if (is_mac && mac_sdk_version == "10.9") { |
| 149 # The 10.9 SDK includes cups 1.7, which deprecates |
| 150 # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2() |
| 151 # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we |
| 152 # can't use it until 10.9 is our minimum system version. |
| 153 # (cups_version isn't reliable on OS X, so key the check off of |
| 154 # mac_sdk). |
| 155 cflags += [ "-Wno-deprecated-declarations" ] |
| 156 } |
| 157 |
| 158 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation |
| 159 # of the print backend and enables a custom implementation instead. |
| 160 defines += [ "PRINT_BACKEND_AVAILABLE" ] |
| 161 |
| 162 sources += [ |
| 163 "backend/cups_helper.cc", |
| 164 "backend/cups_helper.h", |
| 165 "backend/print_backend_cups.cc", |
| 166 ] |
| 167 } |
| 168 |
| 169 if (is_chromeos) { |
| 170 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation |
| 171 # of the print backend and enables a custom implementation instead. |
| 172 defines += [ "PRINT_BACKEND_AVAILABLE" ] |
| 173 |
| 174 sources += [ |
| 175 "backend/print_backend_chromeos.cc", |
| 176 ] |
| 177 } else if (is_linux) { # Non-ChromeOS Linux. |
| 178 sources += [ |
| 179 "printing_context_linux.cc", |
| 180 "printing_context_linux.h", |
| 181 ] |
| 182 } |
| 183 |
| 184 if (is_android) { |
| 185 sources += [ |
| 186 "printing_context_android.cc", |
| 187 "printing_context_android.h", |
| 188 ] |
| 189 |
| 190 deps += [ ":printing_jni_headers" ] |
| 191 } |
| 192 } |
| 193 |
| 194 test("printing_unittests") { |
| 195 sources = [ |
| 196 "emf_win_unittest.cc", |
| 197 "page_number_unittest.cc", |
| 198 "page_range_unittest.cc", |
| 199 "page_setup_unittest.cc", |
| 200 "pdf_metafile_cg_mac_unittest.cc", |
| 201 "printed_page_unittest.cc", |
| 202 "printing_context_win_unittest.cc", |
| 203 "printing_test.h", |
| 204 "printing_utils_unittest.cc", |
| 205 "units_unittest.cc", |
| 206 ] |
| 207 |
| 208 if (use_cups) { |
| 209 configs += [ ":cups" ] |
| 210 sources += [ "backend/cups_helper_unittest.cc" ] |
| 211 } |
| 212 |
| 213 deps = [ |
| 214 ":printing", |
| 215 "//base/allocator", |
| 216 "//base/test:run_all_unittests", |
| 217 "//base/test:test_support", |
| 218 "//testing/gtest", |
| 219 "//ui/base", |
| 220 "//ui/gfx", |
| 221 "//ui/gfx/geometry", |
| 222 ] |
| 223 } |
| 224 |
| 225 if (use_cups) { |
| 226 config("cups") { |
| 227 defines = [ "USE_CUPS" ] |
| 228 |
| 229 if (is_mac) { |
| 230 libs = [ "libcups.dylib" ] |
| 231 } else { |
| 232 libs = exec_script("cups_config_helper.py", [ "--libs-for-gn" ], "value") |
| 233 } |
| 234 } |
| 235 } |
| 236 |
| 237 if (is_android) { |
| 238 generate_jni("printing_jni_headers") { |
| 239 sources = [ |
| 240 "android/java/src/org/chromium/printing/PrintingContext.java", |
| 241 ] |
| 242 jni_package = "printing" |
| 243 } |
| 244 |
| 245 # TODO(GYP) |
| 246 #{ |
| 247 # 'target_name': 'printing_java', |
| 248 # 'type': 'none', |
| 249 # 'variables': { |
| 250 # 'java_in_dir': '../printing/android/java', |
| 251 # }, |
| 252 # 'dependencies': [ |
| 253 # '../base/base.gyp:base_java', |
| 254 # ], |
| 255 # 'includes': [ '../build/java.gypi' ], |
| 256 #} |
| 257 } |
OLD | NEW |