[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 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 | |
[email protected] | a3c13435 | 2014-07-11 19:23:19 | [diff] [blame] | 5 | import("//build/config/features.gni") |
raphael.kubo.da.costa | 64f5280 | 2015-12-16 20:12:48 | [diff] [blame] | 6 | import("//build/config/sysroot.gni") |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 7 | import("//build/config/ui.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 8 | import("//testing/test.gni") |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 9 | if (is_mac) { |
| 10 | import("//build/config/mac/mac_sdk.gni") |
| 11 | } |
| 12 | if (is_android) { |
| 13 | import("//build/config/android/rules.gni") |
| 14 | } |
| 15 | |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 16 | component("printing") { |
| 17 | sources = [ |
| 18 | "backend/print_backend.cc", |
| 19 | "backend/print_backend.h", |
| 20 | "backend/print_backend_consts.cc", |
| 21 | "backend/print_backend_consts.h", |
| 22 | "backend/print_backend_dummy.cc", |
| 23 | "backend/printing_info_win.cc", |
| 24 | "backend/printing_info_win.h", |
| 25 | "emf_win.cc", |
| 26 | "emf_win.h", |
| 27 | "image.cc", |
| 28 | "image.h", |
| 29 | "image_android.cc", |
| 30 | "image_linux.cc", |
| 31 | "image_mac.cc", |
| 32 | "image_win.cc", |
vitalybuka | 5d129058 | 2014-09-12 09:19:59 | [diff] [blame] | 33 | "metafile.cc", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 34 | "metafile.h", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 35 | "metafile_skia_wrapper.cc", |
| 36 | "metafile_skia_wrapper.h", |
| 37 | "page_number.cc", |
| 38 | "page_number.h", |
| 39 | "page_range.cc", |
| 40 | "page_range.h", |
| 41 | "page_setup.cc", |
| 42 | "page_setup.h", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 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", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 48 | "print_dialog_gtk_interface.h", |
| 49 | "print_job_constants.cc", |
| 50 | "print_job_constants.h", |
| 51 | "print_settings.cc", |
| 52 | "print_settings.h", |
[email protected] | c95198b | 2014-06-12 16:56:55 | [diff] [blame] | 53 | "print_settings_conversion.cc", |
| 54 | "print_settings_conversion.h", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 55 | "print_settings_initializer_mac.cc", |
| 56 | "print_settings_initializer_mac.h", |
| 57 | "print_settings_initializer_win.cc", |
| 58 | "print_settings_initializer_win.h", |
| 59 | "printed_document.cc", |
| 60 | "printed_document.h", |
| 61 | "printed_document_linux.cc", |
| 62 | "printed_document_mac.cc", |
| 63 | "printed_document_win.cc", |
| 64 | "printed_page.cc", |
| 65 | "printed_page.h", |
| 66 | "printed_pages_source.h", |
| 67 | "printing_context.cc", |
| 68 | "printing_context.h", |
| 69 | "printing_utils.cc", |
| 70 | "printing_utils.h", |
| 71 | "units.cc", |
| 72 | "units.h", |
| 73 | ] |
| 74 | |
| 75 | cflags = [] |
| 76 | defines = [ "PRINTING_IMPLEMENTATION" ] |
| 77 | |
| 78 | deps = [ |
| 79 | "//base", |
| 80 | "//base:i18n", |
| 81 | "//base/third_party/dynamic_annotations", |
| 82 | "//skia", |
| 83 | "//third_party/icu", |
| 84 | "//ui/gfx", |
| 85 | "//ui/gfx/geometry", |
| 86 | "//url", |
| 87 | ] |
| 88 | |
| 89 | if (use_aura) { |
[email protected] | 55699f39 | 2014-08-20 22:16:30 | [diff] [blame] | 90 | deps += [ "//ui/aura" ] |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | if (is_mac) { |
| 94 | # Mac-Aura does not support printing. |
| 95 | if (use_aura) { |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 96 | sources -= [ "printed_document_mac.cc" ] |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 97 | } else { |
| 98 | sources += [ |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 99 | "printing_context_mac.h", |
scottmg | 7c7296f4 | 2015-02-28 02:23:09 | [diff] [blame] | 100 | "printing_context_mac.mm", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 101 | ] |
| 102 | } |
rsesek | 02aa51c | 2016-05-11 02:13:57 | [diff] [blame^] | 103 | libs = [ |
| 104 | "AppKit.framework", |
| 105 | "ApplicationServices.framework", |
| 106 | "CoreFoundation.framework", |
| 107 | "CoreGraphics.framework", |
| 108 | ] |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | if (is_win) { |
| 112 | # PRINT_BACKEND_AVAILABLE disables the default dummy implementation of the |
| 113 | # print backend and enables a custom implementation instead. |
| 114 | defines += [ "PRINT_BACKEND_AVAILABLE" ] |
| 115 | sources += [ |
scottmg | 7c7296f4 | 2015-02-28 02:23:09 | [diff] [blame] | 116 | "backend/print_backend_win.cc", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 117 | "backend/win_helper.cc", |
| 118 | "backend/win_helper.h", |
vchigrin | 5293352 | 2014-12-15 20:55:13 | [diff] [blame] | 119 | "printing_context_system_dialog_win.cc", |
| 120 | "printing_context_system_dialog_win.h", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 121 | "printing_context_win.cc", |
| 122 | "printing_context_win.h", |
| 123 | ] |
| 124 | } |
| 125 | |
| 126 | if (is_chromeos) { |
| 127 | sources += [ |
| 128 | "printing_context_no_system_dialog.cc", |
| 129 | "printing_context_no_system_dialog.h", |
| 130 | ] |
| 131 | } |
| 132 | |
| 133 | if (use_cups) { |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 134 | configs += [ ":cups" ] |
| 135 | |
| 136 | if (is_linux) { |
agoode | ed22971 | 2016-02-07 22:27:38 | [diff] [blame] | 137 | # rebase_path does not accept an empty string |
| 138 | if (use_sysroot) { |
| 139 | cups_sysroot = rebase_path(sysroot) |
| 140 | } else { |
| 141 | cups_sysroot = "" |
| 142 | } |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 143 | cups_version = exec_script("cups_config_helper.py", |
raphael.kubo.da.costa | 64f5280 | 2015-12-16 20:12:48 | [diff] [blame] | 144 | [ |
| 145 | "--api-version", |
agoode | ed22971 | 2016-02-07 22:27:38 | [diff] [blame] | 146 | cups_sysroot, |
raphael.kubo.da.costa | 64f5280 | 2015-12-16 20:12:48 | [diff] [blame] | 147 | ], |
[email protected] | eae20a21 | 2014-08-19 23:04:54 | [diff] [blame] | 148 | "trim string") |
| 149 | |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 150 | if (cups_version == "1.6" || cups_version == "1.7") { |
| 151 | cflags += [ |
| 152 | # CUPS 1.6 deprecated the PPD APIs, but we will stay with this |
| 153 | # API for now as supported Linux and Mac OS'es are still using |
| 154 | # older versions of CUPS. More info: crbug.com/226176 |
| 155 | "-Wno-deprecated-declarations", |
| 156 | # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section |
| 157 | # below. |
| 158 | ] |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | if (is_mac && mac_sdk_version == "10.9") { |
| 163 | # The 10.9 SDK includes cups 1.7, which deprecates |
| 164 | # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2() |
| 165 | # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we |
| 166 | # can't use it until 10.9 is our minimum system version. |
| 167 | # (cups_version isn't reliable on OS X, so key the check off of |
| 168 | # mac_sdk). |
| 169 | cflags += [ "-Wno-deprecated-declarations" ] |
| 170 | } |
| 171 | |
| 172 | # PRINT_BACKEND_AVAILABLE disables the default dummy implementation |
| 173 | # of the print backend and enables a custom implementation instead. |
| 174 | defines += [ "PRINT_BACKEND_AVAILABLE" ] |
| 175 | |
| 176 | sources += [ |
| 177 | "backend/cups_helper.cc", |
| 178 | "backend/cups_helper.h", |
| 179 | "backend/print_backend_cups.cc", |
| 180 | ] |
| 181 | } |
| 182 | |
| 183 | if (is_chromeos) { |
| 184 | # PRINT_BACKEND_AVAILABLE disables the default dummy implementation |
| 185 | # of the print backend and enables a custom implementation instead. |
| 186 | defines += [ "PRINT_BACKEND_AVAILABLE" ] |
| 187 | |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 188 | sources += [ "backend/print_backend_chromeos.cc" ] |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 189 | } else if (is_linux) { # Non-ChromeOS Linux. |
| 190 | sources += [ |
| 191 | "printing_context_linux.cc", |
| 192 | "printing_context_linux.h", |
| 193 | ] |
| 194 | } |
| 195 | |
| 196 | if (is_android) { |
| 197 | sources += [ |
| 198 | "printing_context_android.cc", |
| 199 | "printing_context_android.h", |
| 200 | ] |
| 201 | |
| 202 | deps += [ ":printing_jni_headers" ] |
thestig | 64c8e26 | 2015-10-28 19:04:26 | [diff] [blame] | 203 | } else { |
| 204 | sources += [ |
| 205 | "pdf_transform.cc", |
| 206 | "pdf_transform.h", |
| 207 | ] |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 208 | } |
| 209 | } |
| 210 | |
| 211 | test("printing_unittests") { |
| 212 | sources = [ |
| 213 | "emf_win_unittest.cc", |
| 214 | "page_number_unittest.cc", |
| 215 | "page_range_unittest.cc", |
| 216 | "page_setup_unittest.cc", |
| 217 | "pdf_metafile_cg_mac_unittest.cc", |
| 218 | "printed_page_unittest.cc", |
| 219 | "printing_context_win_unittest.cc", |
| 220 | "printing_test.h", |
| 221 | "printing_utils_unittest.cc", |
| 222 | "units_unittest.cc", |
| 223 | ] |
| 224 | |
dpranke | 8ec93a3a | 2015-02-20 23:36:08 | [diff] [blame] | 225 | configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 226 | |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 227 | deps = [ |
| 228 | ":printing", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 229 | "//base/test:run_all_unittests", |
| 230 | "//base/test:test_support", |
| 231 | "//testing/gtest", |
| 232 | "//ui/base", |
| 233 | "//ui/gfx", |
[email protected] | e54a1f52 | 2014-07-22 23:26:48 | [diff] [blame] | 234 | "//ui/gfx:test_support", |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 235 | "//ui/gfx/geometry", |
| 236 | ] |
thestig | 64c8e26 | 2015-10-28 19:04:26 | [diff] [blame] | 237 | |
| 238 | if (!is_android) { |
| 239 | sources += [ "pdf_transform_unittest.cc" ] |
| 240 | } |
| 241 | |
| 242 | if (use_cups) { |
| 243 | configs += [ ":cups" ] |
| 244 | sources += [ "backend/cups_helper_unittest.cc" ] |
| 245 | } |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | if (use_cups) { |
| 249 | config("cups") { |
| 250 | defines = [ "USE_CUPS" ] |
| 251 | |
| 252 | if (is_mac) { |
dpranke | 517335e | 2015-08-01 02:41:14 | [diff] [blame] | 253 | libs = [ "cups" ] |
| 254 | lib_dirs = [ "$mac_sdk_path/usr/lib" ] |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 255 | } else { |
agoode | ed22971 | 2016-02-07 22:27:38 | [diff] [blame] | 256 | # rebase_path does not accept an empty string |
| 257 | if (use_sysroot) { |
| 258 | cups_sysroot = rebase_path(sysroot) |
| 259 | } else { |
| 260 | cups_sysroot = "" |
| 261 | } |
raphael.kubo.da.costa | 64f5280 | 2015-12-16 20:12:48 | [diff] [blame] | 262 | libs = exec_script("cups_config_helper.py", |
| 263 | [ |
| 264 | "--libs-for-gn", |
agoode | ed22971 | 2016-02-07 22:27:38 | [diff] [blame] | 265 | cups_sysroot, |
raphael.kubo.da.costa | 64f5280 | 2015-12-16 20:12:48 | [diff] [blame] | 266 | ], |
| 267 | "value") |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | if (is_android) { |
cjhopman | 11a68cb | 2014-10-13 22:47:54 | [diff] [blame] | 273 | # GYP: //printing/printing.gyp:printing_jni_headers |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 274 | generate_jni("printing_jni_headers") { |
| 275 | sources = [ |
| 276 | "android/java/src/org/chromium/printing/PrintingContext.java", |
| 277 | ] |
| 278 | jni_package = "printing" |
| 279 | } |
| 280 | |
cjhopman | 11a68cb | 2014-10-13 22:47:54 | [diff] [blame] | 281 | # GYP: //printing/printing.gyp:printing_java |
| 282 | android_library("printing_java") { |
| 283 | deps = [ |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 284 | "//base:base_java", |
cjhopman | 11a68cb | 2014-10-13 22:47:54 | [diff] [blame] | 285 | ] |
agrieve | 696e6a5 | 2016-03-23 19:54:45 | [diff] [blame] | 286 | java_files = [ |
| 287 | "android/java/src/org/chromium/printing/PrintDocumentAdapterWrapper.java", |
| 288 | "android/java/src/org/chromium/printing/PrintManagerDelegate.java", |
| 289 | "android/java/src/org/chromium/printing/PrintManagerDelegateImpl.java", |
| 290 | "android/java/src/org/chromium/printing/Printable.java", |
| 291 | "android/java/src/org/chromium/printing/PrintingContext.java", |
| 292 | "android/java/src/org/chromium/printing/PrintingContextInterface.java", |
| 293 | "android/java/src/org/chromium/printing/PrintingController.java", |
| 294 | "android/java/src/org/chromium/printing/PrintingControllerImpl.java", |
| 295 | ] |
cjhopman | 11a68cb | 2014-10-13 22:47:54 | [diff] [blame] | 296 | } |
[email protected] | fc2020f | 2014-06-04 18:09:39 | [diff] [blame] | 297 | } |