summaryrefslogtreecommitdiff
path: root/BUILD.gn
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-09 12:45:15 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-09 12:45:15 -0700
commitf1c713663192368d26031a4caed1f9705f4510af (patch)
treed7078da243fe29c2ac9160ab21725bee3a349a7b /BUILD.gn
parentc9952e66c588aad6a5996796fb0c96b202e6de0a (diff)
downloadpdfium-f1c713663192368d26031a4caed1f9705f4510af.tar.xz
Allow compiling PDFium without V8.
Original patch from issue 1391843004 at patchset 1 (http://crrev.com/1391843004#ps1) Introduce a pdf_enable_v8 GYP variable, which controls a corresponding PDF_ENABLE_V8 #define, and bring in the real JS library when set. Otherwise, link against a stub JS runtime. BUG=pdfium:211 R=dml@google.com, jochen@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1395733006 .
Diffstat (limited to 'BUILD.gn')
-rw-r--r--BUILD.gn155
1 files changed, 72 insertions, 83 deletions
diff --git a/BUILD.gn b/BUILD.gn
index f048f9db3c..8ae5a085f0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -3,14 +3,7 @@
# found in the LICENSE file.
import("//testing/test.gni")
-
-pdf_use_skia = false
-
-declare_args() {
- # On Android there's no system FreeType. On Windows and Mac, only a few
- # methods are used from it.
- pdfium_bundle_freetype = !is_linux
-}
+import("pdfium.gni")
config("pdfium_config") {
cflags = []
@@ -25,6 +18,10 @@ config("pdfium_config") {
defines += [ "_SKIA_SUPPORT_" ]
}
+ if (pdf_enable_v8) {
+ defines += [ "PDF_ENABLE_V8" ]
+ }
+
if (is_linux) {
if (current_cpu == "x64") {
defines += [ "_FX_CPU_=_FX_X64_" ]
@@ -111,7 +108,6 @@ static_library("pdfium") {
":fxedit",
":fxge",
":javascript",
- ":jsapi",
":pdfwindow",
]
@@ -632,81 +628,66 @@ static_library("pdfwindow") {
static_library("javascript") {
sources = [
"fpdfsdk/include/javascript/IJavaScript.h",
- "fpdfsdk/src/javascript/Consts.cpp",
- "fpdfsdk/src/javascript/Consts.h",
- "fpdfsdk/src/javascript/Document.cpp",
- "fpdfsdk/src/javascript/Document.h",
- "fpdfsdk/src/javascript/Field.cpp",
- "fpdfsdk/src/javascript/Field.h",
- "fpdfsdk/src/javascript/Icon.cpp",
- "fpdfsdk/src/javascript/Icon.h",
- "fpdfsdk/src/javascript/JS_Context.cpp",
- "fpdfsdk/src/javascript/JS_Context.h",
- "fpdfsdk/src/javascript/JS_Define.h",
- "fpdfsdk/src/javascript/JS_EventHandler.cpp",
- "fpdfsdk/src/javascript/JS_EventHandler.h",
- "fpdfsdk/src/javascript/JS_GlobalData.cpp",
- "fpdfsdk/src/javascript/JS_GlobalData.h",
- "fpdfsdk/src/javascript/JS_Object.cpp",
- "fpdfsdk/src/javascript/JS_Object.h",
- "fpdfsdk/src/javascript/JS_Runtime.cpp",
- "fpdfsdk/src/javascript/JS_Runtime.h",
- "fpdfsdk/src/javascript/JS_Value.cpp",
- "fpdfsdk/src/javascript/JS_Value.h",
- "fpdfsdk/src/javascript/PublicMethods.cpp",
- "fpdfsdk/src/javascript/PublicMethods.h",
- "fpdfsdk/src/javascript/app.cpp",
- "fpdfsdk/src/javascript/app.h",
- "fpdfsdk/src/javascript/color.cpp",
- "fpdfsdk/src/javascript/color.h",
- "fpdfsdk/src/javascript/console.cpp",
- "fpdfsdk/src/javascript/console.h",
- "fpdfsdk/src/javascript/event.cpp",
- "fpdfsdk/src/javascript/event.h",
- "fpdfsdk/src/javascript/global.cpp",
- "fpdfsdk/src/javascript/global.h",
- "fpdfsdk/src/javascript/report.cpp",
- "fpdfsdk/src/javascript/report.h",
- "fpdfsdk/src/javascript/resource.cpp",
- "fpdfsdk/src/javascript/resource.h",
- "fpdfsdk/src/javascript/util.cpp",
- "fpdfsdk/src/javascript/util.h",
- ]
-
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- ":pdfium_config",
- "//build/config/compiler:no_chromium_code",
- ]
- include_dirs = [
- "//v8",
- "//v8/include",
- ]
-
- public_deps = [
- "//v8",
- ]
-}
-
-static_library("jsapi") {
- sources = [
- "fpdfsdk/include/jsapi/fxjs_v8.h",
- "fpdfsdk/src/jsapi/fxjs_v8.cpp",
]
-
+ if (pdf_enable_v8) {
+ sources += [
+ "fpdfsdk/src/javascript/Consts.cpp",
+ "fpdfsdk/src/javascript/Consts.h",
+ "fpdfsdk/src/javascript/Document.cpp",
+ "fpdfsdk/src/javascript/Document.h",
+ "fpdfsdk/src/javascript/Field.cpp",
+ "fpdfsdk/src/javascript/Field.h",
+ "fpdfsdk/src/javascript/Icon.cpp",
+ "fpdfsdk/src/javascript/Icon.h",
+ "fpdfsdk/src/javascript/JS_Context.cpp",
+ "fpdfsdk/src/javascript/JS_Context.h",
+ "fpdfsdk/src/javascript/JS_Define.h",
+ "fpdfsdk/src/javascript/JS_EventHandler.cpp",
+ "fpdfsdk/src/javascript/JS_EventHandler.h",
+ "fpdfsdk/src/javascript/JS_GlobalData.cpp",
+ "fpdfsdk/src/javascript/JS_GlobalData.h",
+ "fpdfsdk/src/javascript/JS_Object.cpp",
+ "fpdfsdk/src/javascript/JS_Object.h",
+ "fpdfsdk/src/javascript/JS_Runtime.cpp",
+ "fpdfsdk/src/javascript/JS_Runtime.h",
+ "fpdfsdk/src/javascript/JS_Value.cpp",
+ "fpdfsdk/src/javascript/JS_Value.h",
+ "fpdfsdk/src/javascript/PublicMethods.cpp",
+ "fpdfsdk/src/javascript/PublicMethods.h",
+ "fpdfsdk/src/javascript/app.cpp",
+ "fpdfsdk/src/javascript/app.h",
+ "fpdfsdk/src/javascript/color.cpp",
+ "fpdfsdk/src/javascript/color.h",
+ "fpdfsdk/src/javascript/console.cpp",
+ "fpdfsdk/src/javascript/console.h",
+ "fpdfsdk/src/javascript/event.cpp",
+ "fpdfsdk/src/javascript/event.h",
+ "fpdfsdk/src/javascript/global.cpp",
+ "fpdfsdk/src/javascript/global.h",
+ "fpdfsdk/src/javascript/report.cpp",
+ "fpdfsdk/src/javascript/report.h",
+ "fpdfsdk/src/javascript/resource.cpp",
+ "fpdfsdk/src/javascript/resource.h",
+ "fpdfsdk/src/javascript/util.cpp",
+ "fpdfsdk/src/javascript/util.h",
+ "fpdfsdk/include/jsapi/fxjs_v8.h",
+ "fpdfsdk/src/jsapi/fxjs_v8.cpp",
+ ]
+ include_dirs = [
+ "//v8",
+ "//v8/include",
+ ]
+ public_deps = [
+ "//v8",
+ ]
+ } else {
+ sources += [ "fpdfsdk/src/javascript/JS_Runtime_Stub.cpp" ]
+ }
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":pdfium_config",
"//build/config/compiler:no_chromium_code",
]
- include_dirs = [
- "//v8",
- "//v8/include",
- ]
-
- public_deps = [
- "//v8",
- ]
}
static_library("formfiller") {
@@ -778,7 +759,6 @@ test("pdfium_embeddertests") {
"fpdfsdk/src/fpdfview_c_api_test.c",
"fpdfsdk/src/fpdfview_c_api_test.h",
"fpdfsdk/src/fpdfview_embeddertest.cpp",
- "fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp",
"testing/embedder_test.cpp",
"testing/embedder_test.h",
"testing/embedder_test_mock_delegate.h",
@@ -789,15 +769,24 @@ test("pdfium_embeddertests") {
deps = [
"//testing/gmock",
"//testing/gtest",
- "//v8",
- "//v8:v8_libplatform",
":pdfium",
]
include_dirs = [
- "//v8",
- "//v8/include",
"."
]
+ if (pdf_enable_v8) {
+ sources += [
+ "fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp"
+ ]
+ deps += [
+ "//v8",
+ "//v8:v8_libplatform",
+ ]
+ include_dirs += [
+ "//v8",
+ "//v8/include",
+ ]
+ }
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":pdfium_config",