Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: pdf/BUILD.gn

Issue 2576573002: Move enable_pdf to a buildflag header. (Closed)
Patch Set: No Chromecast Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | pdf/features.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/BUILD.gn
diff --git a/pdf/BUILD.gn b/pdf/BUILD.gn
index 4e4d94655484680ba9b56b98c959e4fd31fc66d2..8afa86c07d5f7cea3b23967ffd8849c9a329f1f4 100644
--- a/pdf/BUILD.gn
+++ b/pdf/BUILD.gn
@@ -2,86 +2,99 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/buildflag_header.gni")
import("//build/config/features.gni")
+import("//pdf/features.gni")
import("//testing/test.gni")
import("//third_party/pdfium/pdfium.gni")
-assert(enable_pdf)
-
-pdf_engine = 0 # 0 PDFium
-
-static_library("pdf") {
- deps = [
- "//base",
- "//gin",
- "//net",
- "//ppapi/cpp:objects",
- "//ppapi/cpp/private:internal_module",
- "//ui/base",
- ]
+# Generate a buildflag header for compile-time checking of PDF support.
+buildflag_header("features") {
+ header = "features.h"
+ flags = [ "ENABLE_PDF=$enable_pdf" ]
+}
- sources = [
- "chunk_stream.cc",
- "chunk_stream.h",
- "document_loader.cc",
- "document_loader.h",
- "draw_utils.cc",
- "draw_utils.h",
- "out_of_process_instance.cc",
- "out_of_process_instance.h",
- "paint_aggregator.cc",
- "paint_aggregator.h",
- "paint_manager.cc",
- "paint_manager.h",
- "pdf.cc",
- "pdf.h",
- "pdf_engine.h",
- "preview_mode_client.cc",
- "preview_mode_client.h",
- ]
+if (enable_pdf) {
+ pdf_engine = 0 # 0 PDFium
- if (pdf_engine == 0) {
- deps += [
- "//pdf/pdfium/fuzzers",
- "//third_party/pdfium",
+ static_library("pdf") {
+ deps = [
+ "//base",
+ "//gin",
+ "//net",
+ "//ppapi/cpp:objects",
+ "//ppapi/cpp/private:internal_module",
+ "//ui/base",
]
- sources += [
- "pdfium/pdfium_api_string_buffer_adapter.cc",
- "pdfium/pdfium_api_string_buffer_adapter.h",
- "pdfium/pdfium_assert_matching_enums.cc",
- "pdfium/pdfium_engine.cc",
- "pdfium/pdfium_engine.h",
- "pdfium/pdfium_mem_buffer_file_read.cc",
- "pdfium/pdfium_mem_buffer_file_read.h",
- "pdfium/pdfium_mem_buffer_file_write.cc",
- "pdfium/pdfium_mem_buffer_file_write.h",
- "pdfium/pdfium_page.cc",
- "pdfium/pdfium_page.h",
- "pdfium/pdfium_range.cc",
- "pdfium/pdfium_range.h",
+ sources = [
+ "chunk_stream.cc",
+ "chunk_stream.h",
+ "document_loader.cc",
+ "document_loader.h",
+ "draw_utils.cc",
+ "draw_utils.h",
+ "out_of_process_instance.cc",
+ "out_of_process_instance.h",
+ "paint_aggregator.cc",
+ "paint_aggregator.h",
+ "paint_manager.cc",
+ "paint_manager.h",
+ "pdf.cc",
+ "pdf.h",
+ "pdf_engine.h",
+ "preview_mode_client.cc",
+ "preview_mode_client.h",
]
- }
- defines = [ "PDFIUM_PRINT_TEXT_WITH_GDI" ]
- if (pdf_enable_xfa) {
- defines += [ "PDF_ENABLE_XFA" ]
+ if (pdf_engine == 0) {
+ deps += [
+ "//pdf/pdfium/fuzzers",
+ "//third_party/pdfium",
+ ]
+
+ sources += [
+ "pdfium/pdfium_api_string_buffer_adapter.cc",
+ "pdfium/pdfium_api_string_buffer_adapter.h",
+ "pdfium/pdfium_assert_matching_enums.cc",
+ "pdfium/pdfium_engine.cc",
+ "pdfium/pdfium_engine.h",
+ "pdfium/pdfium_mem_buffer_file_read.cc",
+ "pdfium/pdfium_mem_buffer_file_read.h",
+ "pdfium/pdfium_mem_buffer_file_write.cc",
+ "pdfium/pdfium_mem_buffer_file_write.h",
+ "pdfium/pdfium_page.cc",
+ "pdfium/pdfium_page.h",
+ "pdfium/pdfium_range.cc",
+ "pdfium/pdfium_range.h",
+ ]
+ }
+
+ defines = [ "PDFIUM_PRINT_TEXT_WITH_GDI" ]
+ if (pdf_enable_xfa) {
+ defines += [ "PDF_ENABLE_XFA" ]
+ }
}
-}
-test("pdf_unittests") {
- sources = [
- "chunk_stream_unittest.cc",
- "run_all_unittests.cc",
- ]
+ test("pdf_unittests") {
+ sources = [
+ "chunk_stream_unittest.cc",
+ "run_all_unittests.cc",
+ ]
- deps = [
- ":pdf",
- "//base",
- "//base/test:test_support",
- "//ppapi/c",
- "//ppapi/cpp",
- "//testing/gmock",
- "//testing/gtest",
- ]
+ deps = [
+ ":pdf",
+ "//base",
+ "//base/test:test_support",
+ "//ppapi/c",
+ "//ppapi/cpp",
+ "//testing/gmock",
+ "//testing/gtest",
+ ]
+ }
+} else {
+ # Dummy group when PDF support is disabled so targets can unconditionally
+ # depend on it.
+ group("pdf") {
+ }
}
« no previous file with comments | « chrome/test/BUILD.gn ('k') | pdf/features.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698