K. Moon | 8636cff | 2022-11-02 18:45:43 +0000 | [diff] [blame] | 1 | # Copyright 2016 The PDFium Authors |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Tom Sepez | c026b20 | 2021-04-08 22:06:57 +0000 | [diff] [blame] | 5 | import("//build/config/clang/clang.gni") |
K. Moon | 4948d0e | 2022-11-11 18:54:40 +0000 | [diff] [blame] | 6 | import("//build/config/gclient_args.gni") |
Tom Sepez | a32f760 | 2015-01-15 09:34:34 -0800 | [diff] [blame] | 7 | import("//testing/test.gni") |
dsinclair | 038bf0b | 2016-04-30 06:00:05 -0700 | [diff] [blame] | 8 | import("pdfium.gni") |
John Abd-El-Malek | ef4dce4 | 2015-02-02 16:52:07 -0800 | [diff] [blame] | 9 | |
Tom Sepez | c3451da | 2022-08-29 17:52:22 +0000 | [diff] [blame] | 10 | group("default") { |
| 11 | testonly = true |
Tom Sepez | d9e3f3f | 2023-07-24 23:29:11 +0000 | [diff] [blame] | 12 | deps = [ ":pdfium" ] |
| 13 | if (pdf_is_standalone) { |
| 14 | deps += [ ":pdfium_all" ] |
| 15 | } |
Tom Sepez | c3451da | 2022-08-29 17:52:22 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Dominik Röttsches | 4b0671a | 2017-03-30 11:07:43 +0300 | [diff] [blame] | 18 | group("freetype_common") { |
| 19 | public_deps = [] |
| 20 | if (pdf_bundle_freetype) { |
| 21 | public_deps += [ "third_party:fx_freetype" ] |
| 22 | } else { |
| 23 | public_deps += [ "//build/config/freetype" ] |
| 24 | } |
| 25 | } |
| 26 | |
weili | 0abe652 | 2016-06-06 14:41:22 -0700 | [diff] [blame] | 27 | config("pdfium_common_config") { |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 28 | cflags = [] |
Lei Zhang | 46d645f | 2021-10-11 21:13:27 +0000 | [diff] [blame] | 29 | cflags_cc = [] |
dsinclair | 6e162b5 | 2017-01-24 11:18:16 -0800 | [diff] [blame] | 30 | ldflags = [] |
Dominik Röttsches | 4b0671a | 2017-03-30 11:07:43 +0300 | [diff] [blame] | 31 | include_dirs = [ "." ] |
K. Moon | e666032 | 2022-11-15 23:24:08 +0000 | [diff] [blame] | 32 | defines = [] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 33 | |
Felix Kauselmann | 8d72a47 | 2019-02-13 23:44:56 +0000 | [diff] [blame] | 34 | if (!use_system_libopenjpeg2) { |
| 35 | defines += [ "OPJ_STATIC" ] |
| 36 | } |
| 37 | |
Ryan Harrison | 9ce75b8 | 2018-06-06 19:45:14 +0000 | [diff] [blame] | 38 | if (pdf_enable_click_logging) { |
| 39 | defines += [ "PDF_ENABLE_CLICK_LOGGING" ] |
| 40 | } |
| 41 | |
Alan Screen | f22325c | 2024-01-31 23:51:20 +0000 | [diff] [blame] | 42 | if (pdf_use_skia && pdf_enable_fontations) { |
| 43 | defines += [ "PDF_ENABLE_FONTATIONS" ] |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 44 | } |
| 45 | |
Tom Sepez | 907b459 | 2023-01-26 20:46:39 +0000 | [diff] [blame] | 46 | if (pdf_use_partition_alloc) { |
| 47 | defines += [ "PDF_USE_PARTITION_ALLOC" ] |
| 48 | } |
| 49 | |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 50 | if (is_win) { |
| 51 | # Assume UTF-8 by default to avoid code page dependencies. |
| 52 | cflags += [ "/utf-8" ] |
Lei Zhang | 46d645f | 2021-10-11 21:13:27 +0000 | [diff] [blame] | 53 | |
| 54 | if (!is_clang) { |
| 55 | cflags += [ |
| 56 | # Warnings permanently disabled: |
| 57 | |
| 58 | # C4091: 'typedef ': ignored on left of 'X' when no variable is |
| 59 | # declared. |
| 60 | # This happens in a number of Windows headers. Dumb. |
| 61 | "/wd4091", |
| 62 | |
| 63 | # C4127: conditional expression is constant |
| 64 | # This warning can in theory catch dead code and other problems, but |
| 65 | # triggers in far too many desirable cases where the conditional |
| 66 | # expression is either set by macros or corresponds some legitimate |
| 67 | # compile-time constant expression (due to constant template args, |
| 68 | # conditionals comparing the sizes of different types, etc.). Some of |
| 69 | # these can be worked around, but it's not worth it. |
| 70 | "/wd4127", |
| 71 | |
| 72 | # C4251: 'identifier' : class 'type' needs to have dll-interface to be |
| 73 | # used by clients of class 'type2' |
| 74 | # This is necessary for the shared library build. |
| 75 | "/wd4251", |
| 76 | |
| 77 | # C4275: non dll-interface class used as base for dll-interface class |
| 78 | # This points out a potential (but rare) problem with referencing static |
| 79 | # fields of a non-exported base, through the base's non-exported inline |
| 80 | # functions, or directly. The warning is subtle enough that people just |
| 81 | # suppressed it when they saw it, so it's not worth it. |
| 82 | "/wd4275", |
| 83 | |
| 84 | # C4312 is a VS 2015 64-bit warning for integer to larger pointer. |
| 85 | # TODO(brucedawson): fix warnings, crbug.com/554200 |
| 86 | "/wd4312", |
| 87 | |
| 88 | # C4324 warns when padding is added to fulfill alignas requirements, |
| 89 | # but can trigger in benign cases that are difficult to individually |
| 90 | # suppress. |
| 91 | "/wd4324", |
| 92 | |
| 93 | # C4351: new behavior: elements of array 'array' will be default |
| 94 | # initialized |
| 95 | # This is a silly "warning" that basically just alerts you that the |
| 96 | # compiler is going to actually follow the language spec like it's |
| 97 | # supposed to, instead of not following it like old buggy versions did. |
| 98 | # There's absolutely no reason to turn this on. |
| 99 | "/wd4351", |
| 100 | |
| 101 | # C4355: 'this': used in base member initializer list |
| 102 | # It's commonly useful to pass |this| to objects in a class' initializer |
| 103 | # list. While this warning can catch real bugs, most of the time the |
| 104 | # constructors in question don't attempt to call methods on the passed-in |
| 105 | # pointer (until later), and annotating every legit usage of this is |
| 106 | # simply more hassle than the warning is worth. |
| 107 | "/wd4355", |
| 108 | |
| 109 | # C4503: 'identifier': decorated name length exceeded, name was |
| 110 | # truncated |
| 111 | # This only means that some long error messages might have truncated |
| 112 | # identifiers in the presence of lots of templates. It has no effect on |
| 113 | # program correctness and there's no real reason to waste time trying to |
| 114 | # prevent it. |
| 115 | "/wd4503", |
| 116 | |
| 117 | # Warning C4589 says: "Constructor of abstract class ignores |
| 118 | # initializer for virtual base class." Disable this warning because it |
| 119 | # is flaky in VS 2015 RTM. It triggers on compiler generated |
| 120 | # copy-constructors in some cases. |
| 121 | "/wd4589", |
| 122 | |
| 123 | # C4611: interaction between 'function' and C++ object destruction is |
| 124 | # non-portable |
| 125 | # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN |
| 126 | # suggests using exceptions instead of setjmp/longjmp for C++, but |
| 127 | # Chromium code compiles without exception support. We therefore have to |
| 128 | # use setjmp/longjmp for e.g. JPEG decode error handling, which means we |
| 129 | # have to turn off this warning (and be careful about how object |
| 130 | # destruction happens in such cases). |
| 131 | "/wd4611", |
| 132 | |
| 133 | # Warnings to evaluate and possibly fix/reenable later: |
| 134 | |
| 135 | "/wd4100", # Unreferenced formal function parameter. |
| 136 | "/wd4121", # Alignment of a member was sensitive to packing. |
| 137 | "/wd4244", # Conversion: possible loss of data. |
| 138 | "/wd4505", # Unreferenced local function has been removed. |
| 139 | "/wd4510", # Default constructor could not be generated. |
| 140 | "/wd4512", # Assignment operator could not be generated. |
| 141 | "/wd4610", # Class can never be instantiated, constructor required. |
| 142 | "/wd4838", # Narrowing conversion. Doesn't seem to be very useful. |
| 143 | "/wd4995", # 'X': name was marked as #pragma deprecated |
| 144 | "/wd4996", # Deprecated function warning. |
| 145 | |
| 146 | # These are variable shadowing warnings that are new in VS2015. We |
| 147 | # should work through these at some point -- they may be removed from |
| 148 | # the RTM release in the /W4 set. |
| 149 | "/wd4456", |
| 150 | "/wd4457", |
| 151 | "/wd4458", |
| 152 | "/wd4459", |
| 153 | |
| 154 | # All of our compilers support the extensions below. |
| 155 | "/wd4200", # nonstandard extension used: zero-sized array in |
| 156 | # struct/union |
| 157 | "/wd4201", # nonstandard extension used: nameless struct/union |
| 158 | "/wd4204", # nonstandard extension used : non-constant aggregate |
| 159 | # initializer |
| 160 | |
| 161 | "/wd4221", # nonstandard extension used : 'identifier' : cannot be |
| 162 | # initialized using address of automatic variable |
| 163 | |
| 164 | # http://crbug.com/588506 - Conversion suppressions waiting on Clang |
| 165 | # -Wconversion. |
| 166 | "/wd4245", # 'conversion' : conversion from 'type1' to 'type2', |
| 167 | # signed/unsigned mismatch |
| 168 | |
| 169 | "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss |
Lei Zhang | b8df4c3 | 2023-06-16 23:29:34 +0000 | [diff] [blame] | 170 | # of data |
Lei Zhang | 46d645f | 2021-10-11 21:13:27 +0000 | [diff] [blame] | 171 | |
| 172 | "/wd4305", # 'identifier' : truncation from 'type1' to 'type2' |
| 173 | "/wd4389", # 'operator' : signed/unsigned mismatch |
| 174 | |
| 175 | "/wd4702", # unreachable code |
| 176 | |
| 177 | # http://crbug.com/848979 - MSVC is more conservative than Clang with |
| 178 | # regards to variables initialized and consumed in different branches. |
| 179 | "/wd4701", # Potentially uninitialized local variable 'name' used |
| 180 | "/wd4703", # Potentially uninitialized local pointer variable 'name' |
| 181 | # used |
| 182 | |
| 183 | # http://crbug.com/848979 - Remaining Clang permitted warnings. |
| 184 | "/wd4661", # 'identifier' : no suitable definition provided for |
| 185 | # explicit |
| 186 | # template instantiation request |
| 187 | |
| 188 | "/wd4706", # assignment within conditional expression |
| 189 | # MSVC is stricter and requires a boolean expression. |
| 190 | |
| 191 | "/wd4715", # 'function' : not all control paths return a value' |
| 192 | # MSVC does not analyze switch (enum) for completeness. |
| 193 | ] |
| 194 | |
| 195 | cflags_cc += [ |
| 196 | # Allow "noexcept" annotations even though we compile with exceptions |
| 197 | # disabled. |
| 198 | "/wd4577", |
| 199 | ] |
| 200 | |
| 201 | if (current_cpu == "x86") { |
Lei Zhang | 46d645f | 2021-10-11 21:13:27 +0000 | [diff] [blame] | 202 | if (msvc_use_sse2) { |
| 203 | cflags += [ "/arch:SSE2" ] |
| 204 | } |
| 205 | } |
Hui Yingst | 5c2b3be | 2021-08-27 20:19:07 +0000 | [diff] [blame] | 206 | } |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 207 | } |
Lei Zhang | 85e7dc6 | 2020-07-30 19:59:51 +0000 | [diff] [blame] | 208 | |
| 209 | if (is_clang) { |
| 210 | # Override -Wno-c++11-narrowing. |
| 211 | cflags += [ "-Wc++11-narrowing" ] |
Tom Sepez | c026b20 | 2021-04-08 22:06:57 +0000 | [diff] [blame] | 212 | |
Tom Sepez | 0496145 | 2022-01-12 21:11:43 +0000 | [diff] [blame] | 213 | # May flag some issues when converting int to size_t. |
| 214 | cflags += [ "-Wtautological-unsigned-zero-compare" ] |
Lei Zhang | 85e7dc6 | 2020-07-30 19:59:51 +0000 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | if (!is_win && !is_clang) { |
Lei Zhang | 0f286c2 | 2022-04-30 01:33:32 +0000 | [diff] [blame] | 218 | cflags += [ |
| 219 | # Override -Wno-narrowing for GCC. |
| 220 | "-Wnarrowing", |
| 221 | |
| 222 | # GCC assumes that control can get past an exhaustive switch and then |
| 223 | # warns if there's no return there. |
| 224 | "-Wno-return-type", |
| 225 | ] |
Lei Zhang | 85e7dc6 | 2020-07-30 19:59:51 +0000 | [diff] [blame] | 226 | } |
Tom Sepez | f0dc864 | 2024-04-10 01:01:47 +0000 | [diff] [blame] | 227 | |
| 228 | if (clang_use_chrome_plugins) { |
| 229 | defines += [ "PDF_USE_CHROME_PLUGINS" ] |
| 230 | |
| 231 | # Catch misuse of C-style pointers. |
| 232 | # TODO(crbug.com/1320670): enable for non-debug builds once this stops |
| 233 | # interfering with code generation. |
| 234 | # TODO(tsepez): enable for windows, too. |
| 235 | if (is_debug && !is_win) { |
| 236 | cflags += [ |
| 237 | "-Xclang", |
Takashi Sakamoto | 6b9d58e | 2024-06-24 17:28:22 +0000 | [diff] [blame] | 238 | "-plugin-arg-raw-ptr-plugin", |
Tom Sepez | f0dc864 | 2024-04-10 01:01:47 +0000 | [diff] [blame] | 239 | "-Xclang", |
| 240 | "check-raw-ptr-fields", |
| 241 | |
| 242 | "-Xclang", |
Takashi Sakamoto | 6b9d58e | 2024-06-24 17:28:22 +0000 | [diff] [blame] | 243 | "-plugin-arg-raw-ptr-plugin", |
Tom Sepez | f0dc864 | 2024-04-10 01:01:47 +0000 | [diff] [blame] | 244 | "-Xclang", |
| 245 | "raw-ptr-exclude-path=public", |
| 246 | |
| 247 | "-Xclang", |
Takashi Sakamoto | 6b9d58e | 2024-06-24 17:28:22 +0000 | [diff] [blame] | 248 | "-plugin-arg-raw-ptr-plugin", |
Tom Sepez | f0dc864 | 2024-04-10 01:01:47 +0000 | [diff] [blame] | 249 | "-Xclang", |
| 250 | "raw-ptr-exclude-path=test", |
| 251 | |
| 252 | # TODO(tsepez): enforce raw_ref<> as well. |
| 253 | # "-Xclang", |
Takashi Sakamoto | 6b9d58e | 2024-06-24 17:28:22 +0000 | [diff] [blame] | 254 | # "-plugin-arg-raw-ptr-plugin", |
Tom Sepez | f0dc864 | 2024-04-10 01:01:47 +0000 | [diff] [blame] | 255 | # "-Xclang", |
| 256 | # "check-raw-ref-fields", |
| 257 | ] |
| 258 | defines += [ "PDF_ENABLE_UNOWNED_PTR_EXCLUSION" ] |
| 259 | } |
| 260 | |
| 261 | # Catch misuse of cppgc in XFA. |
| 262 | if (pdf_enable_xfa) { |
| 263 | cflags += [ |
| 264 | "-Xclang", |
| 265 | "-add-plugin", |
| 266 | "-Xclang", |
| 267 | "blink-gc-plugin", |
| 268 | ] |
| 269 | |
| 270 | # Disable GC plugin forbidding off-heap collections of GCed: |
| 271 | cflags += [ |
| 272 | "-Xclang", |
| 273 | "-plugin-arg-blink-gc-plugin", |
| 274 | "-Xclang", |
| 275 | "disable-off-heap-collections-of-gced-check", |
| 276 | ] |
| 277 | } |
| 278 | } |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 279 | } |
| 280 | |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 281 | config("pdfium_implementation_config") { |
| 282 | defines = [ "FPDF_IMPLEMENTATION" ] |
| 283 | visibility = [ ":pdfium_public_headers" ] |
| 284 | } |
| 285 | |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 286 | config("pdfium_public_config") { |
| 287 | defines = [] |
| 288 | |
| 289 | if (pdf_enable_v8) { |
| 290 | defines += [ "PDF_ENABLE_V8" ] |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 291 | |
Lei Zhang | 7b5740a | 2018-11-30 19:02:59 +0000 | [diff] [blame] | 292 | if (pdf_enable_xfa) { |
| 293 | defines += [ "PDF_ENABLE_XFA" ] |
| 294 | if (pdf_enable_xfa_bmp) { |
| 295 | defines += [ "PDF_ENABLE_XFA_BMP" ] |
| 296 | } |
| 297 | if (pdf_enable_xfa_gif) { |
| 298 | defines += [ "PDF_ENABLE_XFA_GIF" ] |
| 299 | } |
| 300 | if (pdf_enable_xfa_png) { |
| 301 | defines += [ "PDF_ENABLE_XFA_PNG" ] |
| 302 | } |
| 303 | if (pdf_enable_xfa_tiff) { |
| 304 | defines += [ "PDF_ENABLE_XFA_TIFF" ] |
| 305 | } |
Tom Sepez | 73c9f3b | 2017-02-27 10:12:59 -0800 | [diff] [blame] | 306 | } |
Tom Sepez | a8a39e2 | 2015-10-12 15:47:07 -0700 | [diff] [blame] | 307 | } |
Alan Screen | f22325c | 2024-01-31 23:51:20 +0000 | [diff] [blame] | 308 | |
| 309 | if (pdf_use_skia) { |
| 310 | defines += [ "PDF_USE_SKIA" ] |
| 311 | } |
weili | 0abe652 | 2016-06-06 14:41:22 -0700 | [diff] [blame] | 312 | } |
Tom Sepez | a8a39e2 | 2015-10-12 15:47:07 -0700 | [diff] [blame] | 313 | |
weili | 0abe652 | 2016-06-06 14:41:22 -0700 | [diff] [blame] | 314 | config("pdfium_core_config") { |
| 315 | cflags = [] |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 316 | configs = [ |
| 317 | ":pdfium_common_config", |
| 318 | ":pdfium_public_config", |
Lei Zhang | f4d4fee | 2019-12-04 18:06:13 +0000 | [diff] [blame] | 319 | "//build/config/compiler:noshadowing", |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 320 | ] |
Lei Zhang | d565ca7 | 2019-01-10 00:23:55 +0000 | [diff] [blame] | 321 | defines = [] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 322 | if (is_win) { |
Tom Sepez | 3bb5751 | 2017-03-28 14:09:43 -0700 | [diff] [blame] | 323 | cflags += [ |
Tom Sepez | 5171a27 | 2017-06-01 12:29:09 -0700 | [diff] [blame] | 324 | "/wd4324", |
Tom Sepez | 3bb5751 | 2017-03-28 14:09:43 -0700 | [diff] [blame] | 325 | "/wd4577", |
| 326 | ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 327 | } |
Lei Zhang | c207ee2 | 2023-04-28 20:11:23 +0000 | [diff] [blame] | 328 | if (is_clang) { |
| 329 | cflags += [ "-Wcovered-switch-default" ] |
| 330 | } |
weili | dcc29b1 | 2016-05-27 17:58:23 -0700 | [diff] [blame] | 331 | } |
Lei Zhang | 476ac13 | 2015-11-05 20:07:27 -0800 | [diff] [blame] | 332 | |
Lei Zhang | 7a5f8ee | 2021-04-24 00:19:10 +0000 | [diff] [blame] | 333 | config("pdfium_strict_config") { |
| 334 | configs = [ |
| 335 | ":pdfium_core_config", |
| 336 | "//build/config/compiler:wexit_time_destructors", |
| 337 | "//build/config/compiler:wglobal_constructors", |
| 338 | ] |
| 339 | } |
| 340 | |
Tom Sepez | 926cd3c | 2022-02-14 20:38:35 +0000 | [diff] [blame] | 341 | config("pdfium_noshorten_config") { |
| 342 | cflags = [] |
| 343 | if (is_clang) { |
| 344 | cflags += [ "-Wshorten-64-to-32" ] |
| 345 | } |
| 346 | } |
| 347 | |
Daniel Hosseinian | 0fab9e6 | 2019-11-01 19:31:49 +0000 | [diff] [blame] | 348 | source_set("pdfium_public_headers_impl") { |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 349 | sources = [ |
| 350 | "public/cpp/fpdf_deleters.h", |
| 351 | "public/cpp/fpdf_scopers.h", |
| 352 | "public/fpdf_annot.h", |
| 353 | "public/fpdf_attachment.h", |
| 354 | "public/fpdf_catalog.h", |
| 355 | "public/fpdf_dataavail.h", |
| 356 | "public/fpdf_doc.h", |
| 357 | "public/fpdf_edit.h", |
| 358 | "public/fpdf_ext.h", |
| 359 | "public/fpdf_flatten.h", |
| 360 | "public/fpdf_formfill.h", |
| 361 | "public/fpdf_fwlevent.h", |
Lei Zhang | 25661d1 | 2019-08-01 21:57:23 +0000 | [diff] [blame] | 362 | "public/fpdf_javascript.h", |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 363 | "public/fpdf_ppo.h", |
| 364 | "public/fpdf_progressive.h", |
| 365 | "public/fpdf_save.h", |
| 366 | "public/fpdf_searchex.h", |
Miklos Vajna | 2b76bf9 | 2020-06-25 21:35:26 +0000 | [diff] [blame] | 367 | "public/fpdf_signature.h", |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 368 | "public/fpdf_structtree.h", |
| 369 | "public/fpdf_sysfontinfo.h", |
| 370 | "public/fpdf_text.h", |
| 371 | "public/fpdf_transformpage.h", |
| 372 | "public/fpdfview.h", |
| 373 | ] |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 374 | } |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 375 | |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 376 | group("pdfium_public_headers") { |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 377 | public_deps = [ ":pdfium_public_headers_impl" ] |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 378 | public_configs = [ |
| 379 | ":pdfium_public_config", |
| 380 | ":pdfium_implementation_config", |
| 381 | ] |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 382 | } |
| 383 | |
Daniel Hosseinian | 0fab9e6 | 2019-11-01 19:31:49 +0000 | [diff] [blame] | 384 | component("pdfium") { |
Alan Screen | 68b7871 | 2023-01-28 03:59:30 +0000 | [diff] [blame] | 385 | output_name = "pdfium" |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 386 | libs = [] |
Lei Zhang | 7a5f8ee | 2021-04-24 00:19:10 +0000 | [diff] [blame] | 387 | configs += [ ":pdfium_strict_config" ] |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 388 | public_configs = [ ":pdfium_public_config" ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 389 | |
| 390 | deps = [ |
Lei Zhang | 76833a6 | 2018-10-12 18:53:17 +0000 | [diff] [blame] | 391 | "constants", |
Lei Zhang | 21ce4ff | 2018-10-15 18:30:49 +0000 | [diff] [blame] | 392 | "core/fpdfapi/page", |
| 393 | "core/fpdfapi/parser", |
Lei Zhang | 8460088 | 2018-10-12 18:58:21 +0000 | [diff] [blame] | 394 | "core/fpdfdoc", |
Lei Zhang | 8460088 | 2018-10-12 18:58:21 +0000 | [diff] [blame] | 395 | "core/fxcodec", |
Lei Zhang | 995374a | 2018-10-12 19:52:04 +0000 | [diff] [blame] | 396 | "core/fxcrt", |
Lei Zhang | 8460088 | 2018-10-12 18:58:21 +0000 | [diff] [blame] | 397 | "core/fxge", |
Lei Zhang | dcab8cf | 2018-10-12 18:39:56 +0000 | [diff] [blame] | 398 | "fpdfsdk", |
| 399 | "fpdfsdk/formfiller", |
Lei Zhang | a7dec32 | 2018-10-12 18:36:51 +0000 | [diff] [blame] | 400 | "fxjs", |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 401 | ] |
| 402 | |
thestig | 73c4856 | 2016-09-06 14:07:17 -0700 | [diff] [blame] | 403 | public_deps = [ |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 404 | ":pdfium_public_headers_impl", |
Lei Zhang | 995374a | 2018-10-12 19:52:04 +0000 | [diff] [blame] | 405 | "core/fxcrt", |
thestig | 73c4856 | 2016-09-06 14:07:17 -0700 | [diff] [blame] | 406 | ] |
Tom Sepez | a8a39e2 | 2015-10-12 15:47:07 -0700 | [diff] [blame] | 407 | |
Lei Zhang | d7f51c7 | 2018-10-15 17:47:57 +0000 | [diff] [blame] | 408 | if (pdf_enable_xfa) { |
| 409 | deps += [ |
| 410 | "fpdfsdk/fpdfxfa", |
| 411 | "xfa/fxfa", |
| 412 | "xfa/fxfa/parser", |
| 413 | ] |
Lei Zhang | d7f51c7 | 2018-10-15 17:47:57 +0000 | [diff] [blame] | 414 | } |
| 415 | |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 416 | if (is_win) { |
Dan Sinclair | bc6c672 | 2015-10-22 14:58:54 -0400 | [diff] [blame] | 417 | libs += [ |
| 418 | "advapi32.lib", |
| 419 | "gdi32.lib", |
| 420 | "user32.lib", |
| 421 | ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | if (is_mac) { |
Sylvain Defresne | 7e78b97 | 2020-07-07 18:02:25 +0000 | [diff] [blame] | 425 | frameworks = [ |
Dan Sinclair | bc6c672 | 2015-10-22 14:58:54 -0400 | [diff] [blame] | 426 | "AppKit.framework", |
| 427 | "CoreFoundation.framework", |
| 428 | ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 429 | } |
John Abd-El-Malek | ef4dce4 | 2015-02-02 16:52:07 -0800 | [diff] [blame] | 430 | |
dan sinclair | fa171d2 | 2017-03-26 22:38:17 -0400 | [diff] [blame] | 431 | if (pdf_is_complete_lib) { |
Daniel Hosseinian | 1d0d0be | 2019-11-04 21:22:24 +0000 | [diff] [blame] | 432 | static_component_type = "static_library" |
dan sinclair | fa171d2 | 2017-03-26 22:38:17 -0400 | [diff] [blame] | 433 | complete_static_lib = true |
Tom Anderson | da89ac4 | 2018-03-21 03:56:15 +0000 | [diff] [blame] | 434 | configs -= [ "//build/config/compiler:thin_archive" ] |
dan sinclair | fa171d2 | 2017-03-26 22:38:17 -0400 | [diff] [blame] | 435 | } |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 436 | } |
| 437 | |
Dirk Pranke | f9562f5 | 2023-02-28 01:30:53 +0000 | [diff] [blame] | 438 | # Targets below this are only visible within this file. |
| 439 | visibility = [ ":*" ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 440 | |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 441 | group("pdfium_unittest_deps") { |
Lei Zhang | dbaf3b8 | 2018-10-11 17:02:43 +0000 | [diff] [blame] | 442 | testonly = true |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 443 | public_deps = [ |
| 444 | "core/fxcrt", |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 445 | "testing:unit_test_support", |
Tom Sepez | 16b9d77 | 2017-04-17 09:07:48 -0700 | [diff] [blame] | 446 | "//testing/gmock", |
Dan Sinclair | fffc963 | 2016-03-08 08:57:05 -0500 | [diff] [blame] | 447 | "//testing/gtest", |
Tom Sepez | 04681f3 | 2015-01-09 13:59:19 -0800 | [diff] [blame] | 448 | ] |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 449 | visibility += [ |
| 450 | "core/*", |
| 451 | "fpdfsdk/*", |
| 452 | "fxbarcode/*", |
| 453 | "fxjs/*", |
| 454 | "xfa/*", |
| 455 | ] |
| 456 | } |
| 457 | |
| 458 | test("pdfium_unittests") { |
| 459 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 460 | sources = [ "testing/unit_test_main.cpp" ] |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 461 | deps = [ |
| 462 | "core/fdrm:unittests", |
| 463 | "core/fpdfapi/edit:unittests", |
| 464 | "core/fpdfapi/font:unittests", |
| 465 | "core/fpdfapi/page:unittests", |
| 466 | "core/fpdfapi/parser:unittests", |
Lei Zhang | ac52015 | 2018-11-09 22:58:56 +0000 | [diff] [blame] | 467 | "core/fpdfapi/render:unittests", |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 468 | "core/fpdfdoc:unittests", |
| 469 | "core/fpdftext:unittests", |
| 470 | "core/fxcodec:unittests", |
| 471 | "core/fxcrt", |
| 472 | "core/fxcrt:unittests", |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 473 | "core/fxge:unittests", |
| 474 | "fpdfsdk:unittests", |
Lei Zhang | 220ef3d | 2019-02-05 20:40:54 +0000 | [diff] [blame] | 475 | "testing:unit_test_support", |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 476 | "//testing/gmock", |
| 477 | "//testing/gtest", |
| 478 | ] |
| 479 | configs += [ ":pdfium_core_config" ] |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 480 | if (is_android) { |
| 481 | use_raw_android_executable = true |
| 482 | } |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 483 | if (pdf_enable_v8) { |
| 484 | configs += [ "//v8:external_startup_data" ] |
| 485 | deps += [ |
| 486 | "fxjs:unittests", |
| 487 | "//v8", |
| 488 | ] |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 489 | if (pdf_enable_xfa) { |
| 490 | deps += [ |
| 491 | "core/fxcrt/css:unittests", |
| 492 | "fxbarcode:unittests", |
| 493 | "xfa/fde:unittests", |
Tom Sepez | a58a676 | 2020-10-14 00:14:53 +0000 | [diff] [blame] | 494 | "xfa/fgas/crt:unittests", |
Tom Sepez | 9290522 | 2021-12-07 00:03:27 +0000 | [diff] [blame] | 495 | "xfa/fgas/font:unittests", |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 496 | "xfa/fgas/layout:unittests", |
| 497 | "xfa/fxfa:unittests", |
Lei Zhang | 605b4e1 | 2022-02-24 01:43:24 +0000 | [diff] [blame] | 498 | "xfa/fxfa/formcalc:unittests", |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 499 | "xfa/fxfa/parser:unittests", |
| 500 | ] |
| 501 | } |
Tom Sepez | d2e023b | 2015-12-08 14:36:16 -0800 | [diff] [blame] | 502 | } |
Tom Sepez | 04681f3 | 2015-01-09 13:59:19 -0800 | [diff] [blame] | 503 | } |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 504 | |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 505 | group("pdfium_embeddertest_deps") { |
| 506 | testonly = true |
| 507 | public_deps = [ |
| 508 | ":pdfium_public_headers", |
| 509 | "core/fxcrt", |
| 510 | "testing:embedder_test_support", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 511 | "//testing/gmock", |
| 512 | "//testing/gtest", |
| 513 | ] |
| 514 | visibility += [ |
| 515 | "core/*", |
| 516 | "fpdfsdk/*", |
| 517 | "fxjs/*", |
| 518 | "xfa/*", |
| 519 | ] |
| 520 | } |
| 521 | |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 522 | test("pdfium_embeddertests") { |
Lei Zhang | dbaf3b8 | 2018-10-11 17:02:43 +0000 | [diff] [blame] | 523 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 524 | sources = [ "testing/embedder_test_main.cpp" ] |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 525 | deps = [ |
Tom Sepez | af33f51 | 2020-06-12 01:00:10 +0000 | [diff] [blame] | 526 | ":pdfium_embeddertest_deps", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 527 | "core/fpdfapi/edit:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 528 | "core/fpdfapi/parser:embeddertests", |
| 529 | "core/fpdfapi/render:embeddertests", |
| 530 | "core/fxcodec:embeddertests", |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 531 | "core/fxcrt", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 532 | "core/fxge:embeddertests", |
| 533 | "fpdfsdk:embeddertests", |
Tom Sepez | ec350d9 | 2022-10-26 15:52:36 +0000 | [diff] [blame] | 534 | "fpdfsdk/formfiller:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 535 | "fpdfsdk/pwl:embeddertests", |
Lei Zhang | 76833a6 | 2018-10-12 18:53:17 +0000 | [diff] [blame] | 536 | "testing/image_diff", |
Dan Sinclair | fffc963 | 2016-03-08 08:57:05 -0500 | [diff] [blame] | 537 | "//testing/gmock", |
| 538 | "//testing/gtest", |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 539 | ] |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 540 | include_dirs = [ "testing/gmock/include" ] |
thestig | c65e11e | 2016-08-30 21:56:33 -0700 | [diff] [blame] | 541 | configs += [ ":pdfium_core_config" ] |
| 542 | |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 543 | if (is_android) { |
| 544 | ignore_all_data_deps = true |
| 545 | use_raw_android_executable = true |
| 546 | } |
| 547 | |
Tom Sepez | 452b4f3 | 2015-10-13 09:27:27 -0700 | [diff] [blame] | 548 | if (pdf_enable_v8) { |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 549 | deps += [ |
| 550 | "fxjs:embeddertests", |
| 551 | "//v8", |
Lei Zhang | 1ac47eb | 2015-12-21 11:04:44 -0800 | [diff] [blame] | 552 | ] |
Jochen Eisinger | 7ed503d | 2015-12-10 14:38:06 +0100 | [diff] [blame] | 553 | configs += [ "//v8:external_startup_data" ] |
Tom Sepez | 452b4f3 | 2015-10-13 09:27:27 -0700 | [diff] [blame] | 554 | } |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 555 | |
Dan Sinclair | 14aacd5 | 2017-05-18 14:11:29 -0400 | [diff] [blame] | 556 | if (pdf_enable_xfa) { |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 557 | deps += [ |
Lei Zhang | 8345825 | 2019-03-14 20:07:20 +0000 | [diff] [blame] | 558 | "fpdfsdk/fpdfxfa:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 559 | "xfa/fwl:embeddertests", |
Tom Sepez | 6e4710a | 2019-05-08 17:23:18 +0000 | [diff] [blame] | 560 | "xfa/fxfa/layout:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 561 | "xfa/fxfa/parser:embeddertests", |
Dan Sinclair | 14aacd5 | 2017-05-18 14:11:29 -0400 | [diff] [blame] | 562 | ] |
| 563 | } |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 564 | } |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 565 | |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 566 | executable("pdfium_diff") { |
K. Moon | bce0a8f | 2023-07-13 20:12:24 +0000 | [diff] [blame] | 567 | visibility += [ "testing/tools:test_runner_py" ] |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 568 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 569 | sources = [ "testing/image_diff/image_diff.cpp" ] |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 570 | deps = [ |
Tom Anderson | 9310106 | 2019-05-07 02:08:43 +0000 | [diff] [blame] | 571 | "core/fxcrt", |
Lei Zhang | 2420447 | 2020-08-22 00:51:02 +0000 | [diff] [blame] | 572 | "testing:path_service", |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 573 | "testing/image_diff", |
| 574 | "//build/win:default_exe_manifest", |
| 575 | ] |
Lei Zhang | 7a5f8ee | 2021-04-24 00:19:10 +0000 | [diff] [blame] | 576 | configs += [ ":pdfium_strict_config" ] |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 577 | } |
| 578 | |
Lei Zhang | f02c8bf | 2017-04-01 01:35:01 -0700 | [diff] [blame] | 579 | group("pdfium_all") { |
| 580 | testonly = true |
| 581 | deps = [ |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 582 | ":pdfium_diff", |
Lei Zhang | f02c8bf | 2017-04-01 01:35:01 -0700 | [diff] [blame] | 583 | ":pdfium_embeddertests", |
| 584 | ":pdfium_unittests", |
Tom Sepez | 7c7b4c7 | 2024-05-09 07:21:41 +0000 | [diff] [blame] | 585 | "testing:pdfium_test", |
Tom Sepez | d9e3f3f | 2023-07-24 23:29:11 +0000 | [diff] [blame] | 586 | "testing/fuzzers", |
Lei Zhang | f02c8bf | 2017-04-01 01:35:01 -0700 | [diff] [blame] | 587 | ] |
K. Moon | 55e793a | 2023-07-31 22:48:35 +0000 | [diff] [blame] | 588 | |
| 589 | if (pdf_is_standalone) { |
| 590 | deps += [ "testing/tools:test_runner_py" ] |
| 591 | } |
Lei Zhang | f02c8bf | 2017-04-01 01:35:01 -0700 | [diff] [blame] | 592 | } |
K. Moon | 1852aa0 | 2022-11-10 18:56:52 +0000 | [diff] [blame] | 593 | |
| 594 | # Makes additional targets reachable only for "gn check". These are not always |
| 595 | # built by the "all" Ninja target, which uses the "default" group, which in turn |
| 596 | # depends on the "pdfium_all" group. |
| 597 | group("gn_check") { |
| 598 | deps = [] |
| 599 | |
| 600 | # TODO(crbug.com/pdfium/1832): Remove !is_android when //third_party/expat is |
| 601 | # available. |
K. Moon | a98c089 | 2022-11-12 00:44:23 +0000 | [diff] [blame] | 602 | if (defined(checkout_skia) && checkout_skia && !is_android) { |
K. Moon | 1852aa0 | 2022-11-10 18:56:52 +0000 | [diff] [blame] | 603 | deps += [ "//skia" ] |
| 604 | } |
| 605 | } |