Chromium Code Reviews| 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_mac) | |
|
Lei Zhang
2014/06/03 23:48:28
In GN, is there an equivalent to build/common.gypi
brettw
2014/06/04 17:09:38
You can do that kind of thing, but this is the onl
| |
| 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) { | |
| 149 if (mac_sdk_version == "10.9") { | |
|
Lei Zhang
2014/06/03 23:48:28
can this be combined with the previous line?
| |
| 150 # The 10.9 SDK includes cups 1.7, which deprecates | |
| 151 # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2() | |
| 152 # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we | |
| 153 # can't use it until 10.9 is our minimum system version. | |
| 154 # (cups_version isn't reliable on OS X, so key the check off of | |
| 155 # mac_sdk). | |
| 156 cflags += [ "-Wno-deprecated-declarations" ] | |
| 157 } | |
| 158 } | |
| 159 | |
| 160 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation | |
| 161 # of the print backend and enables a custom implementation instead. | |
| 162 defines += [ "PRINT_BACKEND_AVAILABLE" ] | |
| 163 | |
| 164 sources += [ | |
| 165 "backend/cups_helper.cc", | |
| 166 "backend/cups_helper.h", | |
| 167 "backend/print_backend_cups.cc", | |
| 168 ] | |
| 169 } | |
| 170 | |
| 171 if (is_chromeos) { | |
| 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/print_backend_chromeos.cc", | |
| 178 ] | |
| 179 } else if (is_linux) { # Non-ChromeOS Linux. | |
| 180 sources += [ | |
| 181 "printing_context_linux.cc", | |
| 182 "printing_context_linux.h", | |
| 183 ] | |
| 184 } | |
| 185 | |
| 186 if (is_android) { | |
| 187 sources += [ | |
| 188 "printing_context_android.cc", | |
| 189 "printing_context_android.h", | |
| 190 ] | |
| 191 | |
| 192 deps += [ ":printing_jni_headers" ] | |
| 193 } | |
| 194 } | |
| 195 | |
| 196 test("printing_unittests") { | |
| 197 sources = [ | |
| 198 "emf_win_unittest.cc", | |
| 199 "page_number_unittest.cc", | |
| 200 "page_range_unittest.cc", | |
| 201 "page_setup_unittest.cc", | |
| 202 "pdf_metafile_cg_mac_unittest.cc", | |
| 203 "printed_page_unittest.cc", | |
| 204 "printing_context_win_unittest.cc", | |
| 205 "printing_test.h", | |
| 206 "printing_utils_unittest.cc", | |
| 207 "units_unittest.cc", | |
| 208 ] | |
| 209 | |
| 210 if (use_cups) { | |
| 211 configs += [ ":cups" ] | |
| 212 sources += [ "backend/cups_helper_unittest.cc" ] | |
| 213 } | |
| 214 | |
| 215 deps = [ | |
| 216 ":printing", | |
| 217 "//base/allocator", | |
| 218 "//base/test:run_all_unittests", | |
| 219 "//base/test:test_support", | |
| 220 "//testing/gtest", | |
| 221 "//ui/base", | |
| 222 "//ui/gfx", | |
| 223 "//ui/gfx/geometry", | |
| 224 ] | |
| 225 } | |
| 226 | |
| 227 if (use_cups) { | |
| 228 config("cups") { | |
| 229 defines = [ "USE_CUPS" ] | |
| 230 | |
| 231 if (is_mac) { | |
| 232 libs = [ "libcups.dylib" ] | |
| 233 } else { | |
| 234 libs = exec_script("cups_config_helper.py", [ "--libs-for-gn" ], "value") | |
| 235 } | |
| 236 } | |
| 237 } | |
| 238 | |
| 239 if (is_android) { | |
| 240 generate_gni("printing_jni_headers") { | |
| 241 sources = [ | |
| 242 "android/java/src/org/chromium/printing/PrintingContext.java", | |
| 243 ] | |
| 244 jni_package = "printing" | |
| 245 } | |
| 246 | |
| 247 # TODO(GYP) | |
| 248 #{ | |
| 249 # 'target_name': 'printing_java', | |
| 250 # 'type': 'none', | |
| 251 # 'variables': { | |
| 252 # 'java_in_dir': '../printing/android/java', | |
| 253 # }, | |
| 254 # 'dependencies': [ | |
| 255 # '../base/base.gyp:base_java', | |
| 256 # ], | |
| 257 # 'includes': [ '../build/java.gypi' ], | |
| 258 #} | |
| 259 } | |
| OLD | NEW |