Export defines to dependents of the "pdfium" target.
Use GN's public_configs feature to do this.
PDFium embedders no longer need to manually define PDF_ENABLE_V8 or
PDF_ENABLE_XFA, for example. Remove redundant defines in samples/ and
testing/fuzzers/.
Change-Id: I2472316cf2e7e6af84e8e03f4f478db8ad27f5ce
Reviewed-on: https://pdfium-review.googlesource.com/c/46110
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index e9a87e0..e5f2066 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -25,14 +25,31 @@
"PNG_USE_READ_MACROS",
]
- if (pdf_enable_v8) {
- defines += [ "PDF_ENABLE_V8" ]
- }
-
if (pdf_enable_click_logging) {
defines += [ "PDF_ENABLE_CLICK_LOGGING" ]
}
+ if (pdf_use_skia) {
+ defines += [ "_SKIA_SUPPORT_" ]
+ }
+
+ if (pdf_use_skia_paths) {
+ defines += [ "_SKIA_SUPPORT_PATHS_" ]
+ }
+
+ if (is_win) {
+ # Assume UTF-8 by default to avoid code page dependencies.
+ cflags += [ "/utf-8" ]
+ }
+}
+
+config("pdfium_public_config") {
+ defines = []
+
+ if (pdf_enable_v8) {
+ defines += [ "PDF_ENABLE_V8" ]
+ }
+
if (pdf_enable_xfa) {
defines += [ "PDF_ENABLE_XFA" ]
if (pdf_enable_xfa_bmp) {
@@ -49,27 +66,17 @@
}
}
- if (pdf_use_skia) {
- defines += [ "_SKIA_SUPPORT_" ]
- }
-
- if (pdf_use_skia_paths) {
- defines += [ "_SKIA_SUPPORT_PATHS_" ]
- }
-
if (pdf_use_win32_gdi) {
defines += [ "PDFIUM_PRINT_TEXT_WITH_GDI" ]
}
-
- if (is_win) {
- # Assume UTF-8 by default to avoid code page dependencies.
- cflags += [ "/utf-8" ]
- }
}
config("pdfium_core_config") {
cflags = []
- configs = [ ":pdfium_common_config" ]
+ configs = [
+ ":pdfium_common_config",
+ ":pdfium_public_config",
+ ]
defines = [ "V8_DEPRECATION_WARNINGS" ]
if (is_clang) {
cflags += [ "-Wshadow" ]
@@ -115,6 +122,8 @@
"public/fpdf_transformpage.h",
"public/fpdfview.h",
]
+
+ public_configs = [ ":pdfium_public_config" ]
}
jumbo_static_library("pdfium") {