Check if document was opened during testing.
[pdfium.git] / BUILD.gn
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("//testing/test.gni")
6 import("pdfium.gni")
7
8 config("pdfium_config") {
9   cflags = []
10   include_dirs = [ "third_party/freetype/include" ]
11   defines = [
12     "OPJ_STATIC",
13     "V8_DEPRECATION_WARNINGS",
14     "_CRT_SECURE_NO_WARNINGS",
15   ]
16
17   if (pdf_use_skia) {
18     defines += [ "_SKIA_SUPPORT_" ]
19   }
20
21   if (pdf_enable_v8) {
22     defines += [ "PDF_ENABLE_V8" ]
23   }
24
25   if (is_linux) {
26     if (current_cpu == "x64") {
27       defines += [ "_FX_CPU_=_FX_X64_" ]
28       cflags += [ "-fPIC" ]
29     } else if (current_cpu == "x86") {
30       defines += [ "_FX_CPU_=_FX_X86_" ]
31     }
32   }
33
34   if (is_win) {
35     cflags += [
36       "/wd4005",
37       "/wd4018",
38       "/wd4146",
39       "/wd4333",
40       "/wd4345",
41     ]
42   }
43 }
44
45 static_library("pdfium") {
46   sources = [
47     "fpdfsdk/include/fsdk_actionhandler.h",
48     "fpdfsdk/include/fsdk_annothandler.h",
49     "fpdfsdk/include/fsdk_baseannot.h",
50     "fpdfsdk/include/fsdk_baseform.h",
51     "fpdfsdk/src/fpdf_dataavail.cpp",
52     "fpdfsdk/src/fpdf_ext.cpp",
53     "fpdfsdk/src/fpdf_flatten.cpp",
54     "fpdfsdk/src/fpdf_progressive.cpp",
55     "fpdfsdk/src/fpdf_searchex.cpp",
56     "fpdfsdk/src/fpdf_sysfontinfo.cpp",
57     "fpdfsdk/src/fpdf_transformpage.cpp",
58     "fpdfsdk/src/fpdfdoc.cpp",
59     "fpdfsdk/src/fpdfeditimg.cpp",
60     "fpdfsdk/src/fpdfeditpage.cpp",
61     "fpdfsdk/src/fpdfformfill.cpp",
62     "fpdfsdk/src/fpdfppo.cpp",
63     "fpdfsdk/src/fpdfsave.cpp",
64     "fpdfsdk/src/fpdftext.cpp",
65     "fpdfsdk/src/fpdfview.cpp",
66     "fpdfsdk/src/fsdk_actionhandler.cpp",
67     "fpdfsdk/src/fsdk_annothandler.cpp",
68     "fpdfsdk/src/fsdk_baseannot.cpp",
69     "fpdfsdk/src/fsdk_baseform.cpp",
70     "fpdfsdk/src/fsdk_mgr.cpp",
71     "fpdfsdk/src/fsdk_rendercontext.cpp",
72     "public/fpdf_dataavail.h",
73     "public/fpdf_doc.h",
74     "public/fpdf_edit.h",
75     "public/fpdf_ext.h",
76     "public/fpdf_flatten.h",
77     "public/fpdf_formfill.h",
78     "public/fpdf_fwlevent.h",
79     "public/fpdf_ppo.h",
80     "public/fpdf_progressive.h",
81     "public/fpdf_save.h",
82     "public/fpdf_searchex.h",
83     "public/fpdf_sysfontinfo.h",
84     "public/fpdf_text.h",
85     "public/fpdf_transformpage.h",
86     "public/fpdfview.h",
87   ]
88
89   libs = []
90   configs -= [ "//build/config/compiler:chromium_code" ]
91   configs += [
92     ":pdfium_config",
93     "//build/config/compiler:no_chromium_code",
94   ]
95
96   deps = [
97     "third_party:bigint",
98     "third_party:pdfium_base",
99     ":fdrm",
100     ":formfiller",
101     ":fpdfapi",
102     ":fpdfdoc",
103     ":fpdftext",
104     ":fxcodec",
105     ":fxcrt",
106     ":fxedit",
107     ":fxge",
108     ":javascript",
109     ":pdfwindow",
110   ]
111
112   if (is_win) {
113     libs += [
114       "advapi32.lib",
115       "gdi32.lib",
116       "user32.lib",
117     ]
118   }
119
120   if (is_mac) {
121     libs += [
122       "AppKit.framework",
123       "CoreFoundation.framework",
124     ]
125   }
126
127   if (pdfium_bundle_freetype) {
128     deps += [ "third_party:fx_freetype" ]
129   } else {
130     libs += [ "freetype" ]
131   }
132 }
133
134 source_set("test_support") {
135   testonly = true
136   sources = [
137     "testing/fx_string_testhelpers.cpp",
138     "testing/fx_string_testhelpers.h",
139     "testing/test_support.cpp",
140     "testing/test_support.h",
141   ]
142   deps = [
143     "//testing/gmock",
144     "//testing/gtest",
145     ":pdfium",
146   ]
147   include_dirs = [
148     "."
149   ]
150   if (pdf_enable_v8) {
151     deps += [
152       "//v8",
153       "//v8:v8_libplatform",
154     ]
155     include_dirs += [
156       "//v8",
157       "//v8/include",
158     ]
159   }
160   configs -= [ "//build/config/compiler:chromium_code" ]
161   configs += [
162     ":pdfium_config",
163     "//build/config/compiler:no_chromium_code",
164   ]
165 }
166
167 # Targets below this are only visible within this file (and to the
168 # top-level gn_visibility target used to help gn_all build everything).
169 visibility = [
170   ":*",
171   "//:gn_visibility",
172 ]
173
174 static_library("fdrm") {
175   sources = [
176     "core/include/fdrm/fx_crypt.h",
177     "core/src/fdrm/crypto/fx_crypt.cpp",
178     "core/src/fdrm/crypto/fx_crypt_aes.cpp",
179     "core/src/fdrm/crypto/fx_crypt_sha.cpp",
180   ]
181   configs -= [ "//build/config/compiler:chromium_code" ]
182   configs += [
183     ":pdfium_config",
184     "//build/config/compiler:no_chromium_code",
185   ]
186 }
187
188 static_library("fpdfdoc") {
189   sources = [
190     "core/include/fpdfdoc/fpdf_ap.h",
191     "core/include/fpdfdoc/fpdf_doc.h",
192     "core/include/fpdfdoc/fpdf_tagged.h",
193     "core/include/fpdfdoc/fpdf_vt.h",
194     "core/src/fpdfdoc/doc_action.cpp",
195     "core/src/fpdfdoc/doc_annot.cpp",
196     "core/src/fpdfdoc/doc_ap.cpp",
197     "core/src/fpdfdoc/doc_basic.cpp",
198     "core/src/fpdfdoc/doc_bookmark.cpp",
199     "core/src/fpdfdoc/doc_form.cpp",
200     "core/src/fpdfdoc/doc_formcontrol.cpp",
201     "core/src/fpdfdoc/doc_formfield.cpp",
202     "core/src/fpdfdoc/doc_link.cpp",
203     "core/src/fpdfdoc/doc_metadata.cpp",
204     "core/src/fpdfdoc/doc_ocg.cpp",
205     "core/src/fpdfdoc/doc_tagged.cpp",
206     "core/src/fpdfdoc/doc_utils.cpp",
207     "core/src/fpdfdoc/doc_utils.h",
208     "core/src/fpdfdoc/doc_viewerPreferences.cpp",
209     "core/src/fpdfdoc/doc_vt.cpp",
210     "core/src/fpdfdoc/doc_vtmodule.cpp",
211     "core/src/fpdfdoc/pdf_vt.h",
212     "core/src/fpdfdoc/tagged_int.h",
213   ]
214   configs -= [ "//build/config/compiler:chromium_code" ]
215   configs += [
216     ":pdfium_config",
217     "//build/config/compiler:no_chromium_code",
218   ]
219 }
220
221 static_library("fpdfapi") {
222   sources = [
223     "core/include/fpdfapi/fpdf_module.h",
224     "core/include/fpdfapi/fpdf_objects.h",
225     "core/include/fpdfapi/fpdf_page.h",
226     "core/include/fpdfapi/fpdf_pageobj.h",
227     "core/include/fpdfapi/fpdf_parser.h",
228     "core/include/fpdfapi/fpdf_render.h",
229     "core/include/fpdfapi/fpdf_resource.h",
230     "core/include/fpdfapi/fpdf_serial.h",
231     "core/include/fpdfapi/fpdfapi.h",
232     "core/src/fpdfapi/fpdf_basic_module.cpp",
233     "core/src/fpdfapi/fpdf_cmaps/CNS1/Adobe-CNS1-UCS2_5.cpp",
234     "core/src/fpdfapi/fpdf_cmaps/CNS1/B5pc-H_0.cpp",
235     "core/src/fpdfapi/fpdf_cmaps/CNS1/B5pc-V_0.cpp",
236     "core/src/fpdfapi/fpdf_cmaps/CNS1/CNS-EUC-H_0.cpp",
237     "core/src/fpdfapi/fpdf_cmaps/CNS1/CNS-EUC-V_0.cpp",
238     "core/src/fpdfapi/fpdf_cmaps/CNS1/ETen-B5-H_0.cpp",
239     "core/src/fpdfapi/fpdf_cmaps/CNS1/ETen-B5-V_0.cpp",
240     "core/src/fpdfapi/fpdf_cmaps/CNS1/ETenms-B5-H_0.cpp",
241     "core/src/fpdfapi/fpdf_cmaps/CNS1/ETenms-B5-V_0.cpp",
242     "core/src/fpdfapi/fpdf_cmaps/CNS1/HKscs-B5-H_5.cpp",
243     "core/src/fpdfapi/fpdf_cmaps/CNS1/HKscs-B5-V_5.cpp",
244     "core/src/fpdfapi/fpdf_cmaps/CNS1/UniCNS-UCS2-H_3.cpp",
245     "core/src/fpdfapi/fpdf_cmaps/CNS1/UniCNS-UCS2-V_3.cpp",
246     "core/src/fpdfapi/fpdf_cmaps/CNS1/UniCNS-UTF16-H_0.cpp",
247     "core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp",
248     "core/src/fpdfapi/fpdf_cmaps/GB1/Adobe-GB1-UCS2_5.cpp",
249     "core/src/fpdfapi/fpdf_cmaps/GB1/GB-EUC-H_0.cpp",
250     "core/src/fpdfapi/fpdf_cmaps/GB1/GB-EUC-V_0.cpp",
251     "core/src/fpdfapi/fpdf_cmaps/GB1/GBK-EUC-H_2.cpp",
252     "core/src/fpdfapi/fpdf_cmaps/GB1/GBK-EUC-V_2.cpp",
253     "core/src/fpdfapi/fpdf_cmaps/GB1/GBK2K-H_5.cpp",
254     "core/src/fpdfapi/fpdf_cmaps/GB1/GBK2K-V_5.cpp",
255     "core/src/fpdfapi/fpdf_cmaps/GB1/GBKp-EUC-H_2.cpp",
256     "core/src/fpdfapi/fpdf_cmaps/GB1/GBKp-EUC-V_2.cpp",
257     "core/src/fpdfapi/fpdf_cmaps/GB1/GBpc-EUC-H_0.cpp",
258     "core/src/fpdfapi/fpdf_cmaps/GB1/GBpc-EUC-V_0.cpp",
259     "core/src/fpdfapi/fpdf_cmaps/GB1/UniGB-UCS2-H_4.cpp",
260     "core/src/fpdfapi/fpdf_cmaps/GB1/UniGB-UCS2-V_4.cpp",
261     "core/src/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp",
262     "core/src/fpdfapi/fpdf_cmaps/Japan1/83pv-RKSJ-H_1.cpp",
263     "core/src/fpdfapi/fpdf_cmaps/Japan1/90ms-RKSJ-H_2.cpp",
264     "core/src/fpdfapi/fpdf_cmaps/Japan1/90ms-RKSJ-V_2.cpp",
265     "core/src/fpdfapi/fpdf_cmaps/Japan1/90msp-RKSJ-H_2.cpp",
266     "core/src/fpdfapi/fpdf_cmaps/Japan1/90msp-RKSJ-V_2.cpp",
267     "core/src/fpdfapi/fpdf_cmaps/Japan1/90pv-RKSJ-H_1.cpp",
268     "core/src/fpdfapi/fpdf_cmaps/Japan1/Add-RKSJ-H_1.cpp",
269     "core/src/fpdfapi/fpdf_cmaps/Japan1/Add-RKSJ-V_1.cpp",
270     "core/src/fpdfapi/fpdf_cmaps/Japan1/Adobe-Japan1-UCS2_4.cpp",
271     "core/src/fpdfapi/fpdf_cmaps/Japan1/EUC-H_1.cpp",
272     "core/src/fpdfapi/fpdf_cmaps/Japan1/EUC-V_1.cpp",
273     "core/src/fpdfapi/fpdf_cmaps/Japan1/Ext-RKSJ-H_2.cpp",
274     "core/src/fpdfapi/fpdf_cmaps/Japan1/Ext-RKSJ-V_2.cpp",
275     "core/src/fpdfapi/fpdf_cmaps/Japan1/H_1.cpp",
276     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-HW-H_4.cpp",
277     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-HW-V_4.cpp",
278     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-H_4.cpp",
279     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-V_4.cpp",
280     "core/src/fpdfapi/fpdf_cmaps/Japan1/V_1.cpp",
281     "core/src/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp",
282     "core/src/fpdfapi/fpdf_cmaps/Korea1/Adobe-Korea1-UCS2_2.cpp",
283     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSC-EUC-H_0.cpp",
284     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSC-EUC-V_0.cpp",
285     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSCms-UHC-HW-H_1.cpp",
286     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSCms-UHC-HW-V_1.cpp",
287     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSCms-UHC-H_1.cpp",
288     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSCms-UHC-V_1.cpp",
289     "core/src/fpdfapi/fpdf_cmaps/Korea1/KSCpc-EUC-H_0.cpp",
290     "core/src/fpdfapi/fpdf_cmaps/Korea1/UniKS-UCS2-H_1.cpp",
291     "core/src/fpdfapi/fpdf_cmaps/Korea1/UniKS-UCS2-V_1.cpp",
292     "core/src/fpdfapi/fpdf_cmaps/Korea1/UniKS-UTF16-H_0.cpp",
293     "core/src/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp",
294     "core/src/fpdfapi/fpdf_cmaps/cmap_int.h",
295     "core/src/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp",
296     "core/src/fpdfapi/fpdf_edit/editint.h",
297     "core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp",
298     "core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp",
299     "core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp",
300     "core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp",
301     "core/src/fpdfapi/fpdf_font/common.h",
302     "core/src/fpdfapi/fpdf_font/font_int.h",
303     "core/src/fpdfapi/fpdf_font/fpdf_font.cpp",
304     "core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp",
305     "core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp",
306     "core/src/fpdfapi/fpdf_font/ttgsubtable.cpp",
307     "core/src/fpdfapi/fpdf_font/ttgsubtable.h",
308     "core/src/fpdfapi/fpdf_page/fpdf_page.cpp",
309     "core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp",
310     "core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp",
311     "core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp",
312     "core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp",
313     "core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp",
314     "core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp",
315     "core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp",
316     "core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp",
317     "core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp",
318     "core/src/fpdfapi/fpdf_page/pageint.h",
319     "core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp",
320     "core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp",
321     "core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp",
322     "core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp",
323     "core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp",
324     "core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp",
325     "core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp",
326     "core/src/fpdfapi/fpdf_render/fpdf_render.cpp",
327     "core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp",
328     "core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp",
329     "core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp",
330     "core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp",
331     "core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp",
332     "core/src/fpdfapi/fpdf_render/render_int.h",
333   ]
334   configs -= [ "//build/config/compiler:chromium_code" ]
335   configs += [
336     ":pdfium_config",
337     "//build/config/compiler:no_chromium_code",
338   ]
339 }
340
341 static_library("fpdftext") {
342   sources = [
343     "core/include/fpdftext/fpdf_text.h",
344     "core/src/fpdftext/fpdf_text.cpp",
345     "core/src/fpdftext/fpdf_text_int.cpp",
346     "core/src/fpdftext/fpdf_text_search.cpp",
347     "core/src/fpdftext/text_int.h",
348     "core/src/fpdftext/txtproc.h",
349     "core/src/fpdftext/unicodenormalization.cpp",
350     "core/src/fpdftext/unicodenormalizationdata.cpp",
351     "core/src/fpdftext/unicodenormalizationdata.h",
352   ]
353   configs -= [ "//build/config/compiler:chromium_code" ]
354   configs += [
355     ":pdfium_config",
356     "//build/config/compiler:no_chromium_code",
357   ]
358 }
359
360 static_library("fxcodec") {
361   deps = [
362     "third_party:fx_lcms2",
363     "third_party:fx_libjpeg",
364     "third_party:fx_libopenjpeg",
365     "third_party:fx_zlib",
366   ]
367   sources = [
368     "core/include/fxcodec/fx_codec.h",
369     "core/include/fxcodec/fx_codec_def.h",
370     "core/include/fxcodec/fx_codec_flate.h",
371     "core/include/fxcodec/fx_codec_provider.h",
372     "core/src/fxcodec/codec/codec_int.h",
373     "core/src/fxcodec/codec/fx_codec.cpp",
374     "core/src/fxcodec/codec/fx_codec_fax.cpp",
375     "core/src/fxcodec/codec/fx_codec_flate.cpp",
376     "core/src/fxcodec/codec/fx_codec_icc.cpp",
377     "core/src/fxcodec/codec/fx_codec_jbig.cpp",
378     "core/src/fxcodec/codec/fx_codec_jbig_enc.cpp",
379     "core/src/fxcodec/codec/fx_codec_jpeg.cpp",
380     "core/src/fxcodec/codec/fx_codec_jpx_opj.cpp",
381     "core/src/fxcodec/jbig2/JBig2_ArithDecoder.cpp",
382     "core/src/fxcodec/jbig2/JBig2_ArithDecoder.h",
383     "core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp",
384     "core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h",
385     "core/src/fxcodec/jbig2/JBig2_BitStream.cpp",
386     "core/src/fxcodec/jbig2/JBig2_BitStream.h",
387     "core/src/fxcodec/jbig2/JBig2_Context.cpp",
388     "core/src/fxcodec/jbig2/JBig2_Context.h",
389     "core/src/fxcodec/jbig2/JBig2_Define.h",
390     "core/src/fxcodec/jbig2/JBig2_GrdProc.cpp",
391     "core/src/fxcodec/jbig2/JBig2_GrdProc.h",
392     "core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp",
393     "core/src/fxcodec/jbig2/JBig2_GrrdProc.h",
394     "core/src/fxcodec/jbig2/JBig2_GsidProc.cpp",
395     "core/src/fxcodec/jbig2/JBig2_GsidProc.h",
396     "core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp",
397     "core/src/fxcodec/jbig2/JBig2_HtrdProc.h",
398     "core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp",
399     "core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.h",
400     "core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp",
401     "core/src/fxcodec/jbig2/JBig2_HuffmanTable.h",
402     "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h",
403     "core/src/fxcodec/jbig2/JBig2_Image.cpp",
404     "core/src/fxcodec/jbig2/JBig2_Image.h",
405     "core/src/fxcodec/jbig2/JBig2_List.h",
406     "core/src/fxcodec/jbig2/JBig2_Page.h",
407     "core/src/fxcodec/jbig2/JBig2_PatternDict.cpp",
408     "core/src/fxcodec/jbig2/JBig2_PatternDict.h",
409     "core/src/fxcodec/jbig2/JBig2_PddProc.cpp",
410     "core/src/fxcodec/jbig2/JBig2_PddProc.h",
411     "core/src/fxcodec/jbig2/JBig2_SddProc.cpp",
412     "core/src/fxcodec/jbig2/JBig2_SddProc.h",
413     "core/src/fxcodec/jbig2/JBig2_Segment.cpp",
414     "core/src/fxcodec/jbig2/JBig2_Segment.h",
415     "core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp",
416     "core/src/fxcodec/jbig2/JBig2_SymbolDict.h",
417     "core/src/fxcodec/jbig2/JBig2_TrdProc.cpp",
418     "core/src/fxcodec/jbig2/JBig2_TrdProc.h",
419   ]
420   configs -= [ "//build/config/compiler:chromium_code" ]
421
422   if (is_posix) {
423     # core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c does an pointer-to-int
424     # conversion to check that an address is 16-bit aligned (benign).
425     cflags_c = [ "-Wno-pointer-to-int-cast" ]
426   }
427   configs += [
428     ":pdfium_config",
429     "//build/config/compiler:no_chromium_code",
430   ]
431 }
432
433 config("fxge_warnings") {
434   if (is_clang) {
435     cflags = [
436       # http://code.google.com/p/pdfium/issues/detail?id=188
437       "-Wno-switch",
438     ]
439   }
440 }
441
442 static_library("fxcrt") {
443   sources = [
444     "core/include/fxcrt/fx_basic.h",
445     "core/include/fxcrt/fx_bidi.h",
446     "core/include/fxcrt/fx_coordinates.h",
447     "core/include/fxcrt/fx_ext.h",
448     "core/include/fxcrt/fx_memory.h",
449     "core/include/fxcrt/fx_safe_types.h",
450     "core/include/fxcrt/fx_stream.h",
451     "core/include/fxcrt/fx_string.h",
452     "core/include/fxcrt/fx_system.h",
453     "core/include/fxcrt/fx_ucd.h",
454     "core/include/fxcrt/fx_xml.h",
455     "core/src/fxcrt/extension.h",
456     "core/src/fxcrt/fx_basic_array.cpp",
457     "core/src/fxcrt/fx_basic_bstring.cpp",
458     "core/src/fxcrt/fx_basic_buffer.cpp",
459     "core/src/fxcrt/fx_basic_coords.cpp",
460     "core/src/fxcrt/fx_basic_gcc.cpp",
461     "core/src/fxcrt/fx_basic_list.cpp",
462     "core/src/fxcrt/fx_basic_maps.cpp",
463     "core/src/fxcrt/fx_basic_memmgr.cpp",
464     "core/src/fxcrt/fx_basic_plex.cpp",
465     "core/src/fxcrt/fx_basic_utf.cpp",
466     "core/src/fxcrt/fx_basic_util.cpp",
467     "core/src/fxcrt/fx_basic_wstring.cpp",
468     "core/src/fxcrt/fx_bidi.cpp",
469     "core/src/fxcrt/fx_extension.cpp",
470     "core/src/fxcrt/fx_ucddata.cpp",
471     "core/src/fxcrt/fx_unicode.cpp",
472     "core/src/fxcrt/fx_xml_composer.cpp",
473     "core/src/fxcrt/fx_xml_parser.cpp",
474     "core/src/fxcrt/fxcrt_platforms.cpp",
475     "core/src/fxcrt/fxcrt_platforms.h",
476     "core/src/fxcrt/fxcrt_posix.cpp",
477     "core/src/fxcrt/fxcrt_posix.h",
478     "core/src/fxcrt/fxcrt_windows.cpp",
479     "core/src/fxcrt/fxcrt_windows.h",
480     "core/src/fxcrt/plex.h",
481     "core/src/fxcrt/xml_int.h",
482   ]
483   configs -= [ "//build/config/compiler:chromium_code" ]
484   configs += [
485     ":pdfium_config",
486     "//build/config/compiler:no_chromium_code",
487   ]
488 }
489
490 static_library("fxge") {
491   deps = [
492     "third_party:fx_agg",
493   ]
494   sources = [
495     "core/include/fxge/fpf.h",
496     "core/include/fxge/fx_dib.h",
497     "core/include/fxge/fx_font.h",
498     "core/include/fxge/fx_freetype.h",
499     "core/include/fxge/fx_ge.h",
500     "core/include/fxge/fx_ge_apple.h",
501     "core/include/fxge/fx_ge_win32.h",
502     "core/src/fxge/agg/include/fx_agg_driver.h",
503     "core/src/fxge/agg/src/fx_agg_driver.cpp",
504     "core/src/fxge/android/fpf_skiafont.cpp",
505     "core/src/fxge/android/fpf_skiafont.h",
506     "core/src/fxge/android/fpf_skiafontmgr.cpp",
507     "core/src/fxge/android/fpf_skiafontmgr.h",
508     "core/src/fxge/android/fpf_skiamodule.cpp",
509     "core/src/fxge/android/fpf_skiamodule.h",
510     "core/src/fxge/android/fx_android_font.cpp",
511     "core/src/fxge/android/fx_android_font.h",
512     "core/src/fxge/android/fx_android_imp.cpp",
513     "core/src/fxge/android/fx_fpf.h",
514     "core/src/fxge/apple/apple_int.h",
515     "core/src/fxge/apple/fx_apple_platform.cpp",
516     "core/src/fxge/apple/fx_mac_imp.cpp",
517     "core/src/fxge/apple/fx_quartz_device.cpp",
518     "core/src/fxge/dib/dib_int.h",
519     "core/src/fxge/dib/fx_dib_composite.cpp",
520     "core/src/fxge/dib/fx_dib_convert.cpp",
521     "core/src/fxge/dib/fx_dib_engine.cpp",
522     "core/src/fxge/dib/fx_dib_main.cpp",
523     "core/src/fxge/dib/fx_dib_transform.cpp",
524     "core/src/fxge/fontdata/chromefontdata/chromefontdata.h",
525     "core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c",
526     "core/src/fxge/fontdata/chromefontdata/FoxitFixed.c",
527     "core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c",
528     "core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c",
529     "core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c",
530     "core/src/fxge/fontdata/chromefontdata/FoxitSans.c",
531     "core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c",
532     "core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c",
533     "core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c",
534     "core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c",
535     "core/src/fxge/fontdata/chromefontdata/FoxitSerif.c",
536     "core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c",
537     "core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c",
538     "core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c",
539     "core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c",
540     "core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c",
541     "core/src/fxge/freetype/fx_freetype.c",
542     "core/src/fxge/ge/fx_ge.cpp",
543     "core/src/fxge/ge/fx_ge_device.cpp",
544     "core/src/fxge/ge/fx_ge_font.cpp",
545     "core/src/fxge/ge/fx_ge_fontmap.cpp",
546     "core/src/fxge/ge/fx_ge_linux.cpp",
547     "core/src/fxge/ge/fx_ge_path.cpp",
548     "core/src/fxge/ge/fx_ge_ps.cpp",
549     "core/src/fxge/ge/fx_ge_text.cpp",
550     "core/src/fxge/ge/text_int.h",
551   ]
552
553   configs -= [ "//build/config/compiler:chromium_code" ]
554   configs += [
555     ":pdfium_config",
556     "//build/config/compiler:no_chromium_code",
557     # As of this writing, this needs to be last to suppress a -Wswitch warning.
558     # https://crbug.com/547906
559     ":fxge_warnings",
560   ]
561
562   if (pdf_use_skia) {
563     sources = [
564       "core/src/fxge/skia/fx_skia_blitter_new.cpp",
565       "core/src/fxge/skia/fx_skia_device.cpp",
566     ]
567     include_dirs = [
568       "//third_party/skia/include/config",
569       "//third_party/skia/include/core",
570       "//third_party/skia/include/effects",
571       "//third_party/skia/include/images",
572       "//third_party/skia/include/lazy",
573       "//third_party/skia/include/pathops",
574       "//third_party/skia/include/utils",
575       "//third_party/skia/src/core",
576     ]
577     deps = [ "//skia" ]
578   }
579
580   if (is_win) {
581     sources += [
582       "core/src/fxge/win32/dwrite_int.h",
583       "core/src/fxge/win32/fx_win32_device.cpp",
584       "core/src/fxge/win32/fx_win32_dib.cpp",
585       "core/src/fxge/win32/fx_win32_dwrite.cpp",
586       "core/src/fxge/win32/fx_win32_gdipext.cpp",
587       "core/src/fxge/win32/fx_win32_print.cpp",
588       "core/src/fxge/win32/win32_int.h",
589     ]
590     configs -= [ "//build/config/win:lean_and_mean" ]
591   }
592 }
593
594 static_library("fxedit") {
595   sources = [
596     "fpdfsdk/include/fxedit/fx_edit.h",
597     "fpdfsdk/include/fxedit/fxet_edit.h",
598     "fpdfsdk/include/fxedit/fxet_list.h",
599     "fpdfsdk/include/fxedit/fxet_stub.h",
600     "fpdfsdk/src/fxedit/fxet_ap.cpp",
601     "fpdfsdk/src/fxedit/fxet_edit.cpp",
602     "fpdfsdk/src/fxedit/fxet_list.cpp",
603     "fpdfsdk/src/fxedit/fxet_module.cpp",
604     "fpdfsdk/src/fxedit/fxet_pageobjs.cpp",
605   ]
606   configs -= [ "//build/config/compiler:chromium_code" ]
607   configs += [
608     ":pdfium_config",
609     "//build/config/compiler:no_chromium_code",
610   ]
611 }
612
613 static_library("pdfwindow") {
614   sources = [
615     "fpdfsdk/include/pdfwindow/IPDFWindow.h",
616     "fpdfsdk/include/pdfwindow/PDFWindow.h",
617     "fpdfsdk/include/pdfwindow/PWL_Button.h",
618     "fpdfsdk/include/pdfwindow/PWL_Caret.h",
619     "fpdfsdk/include/pdfwindow/PWL_ComboBox.h",
620     "fpdfsdk/include/pdfwindow/PWL_Edit.h",
621     "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h",
622     "fpdfsdk/include/pdfwindow/PWL_FontMap.h",
623     "fpdfsdk/include/pdfwindow/PWL_Icon.h",
624     "fpdfsdk/include/pdfwindow/PWL_IconList.h",
625     "fpdfsdk/include/pdfwindow/PWL_Label.h",
626     "fpdfsdk/include/pdfwindow/PWL_ListBox.h",
627     "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h",
628     "fpdfsdk/include/pdfwindow/PWL_Note.h",
629     "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h",
630     "fpdfsdk/include/pdfwindow/PWL_Signature.h",
631     "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h",
632     "fpdfsdk/include/pdfwindow/PWL_Utils.h",
633     "fpdfsdk/include/pdfwindow/PWL_Wnd.h",
634     "fpdfsdk/src/pdfwindow/PWL_Button.cpp",
635     "fpdfsdk/src/pdfwindow/PWL_Caret.cpp",
636     "fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp",
637     "fpdfsdk/src/pdfwindow/PWL_Edit.cpp",
638     "fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp",
639     "fpdfsdk/src/pdfwindow/PWL_FontMap.cpp",
640     "fpdfsdk/src/pdfwindow/PWL_Icon.cpp",
641     "fpdfsdk/src/pdfwindow/PWL_IconList.cpp",
642     "fpdfsdk/src/pdfwindow/PWL_Label.cpp",
643     "fpdfsdk/src/pdfwindow/PWL_ListBox.cpp",
644     "fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp",
645     "fpdfsdk/src/pdfwindow/PWL_Note.cpp",
646     "fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp",
647     "fpdfsdk/src/pdfwindow/PWL_Signature.cpp",
648     "fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp",
649     "fpdfsdk/src/pdfwindow/PWL_Utils.cpp",
650     "fpdfsdk/src/pdfwindow/PWL_Wnd.cpp",
651   ]
652   configs -= [ "//build/config/compiler:chromium_code" ]
653   configs += [
654     ":pdfium_config",
655     "//build/config/compiler:no_chromium_code",
656   ]
657 }
658
659 static_library("javascript") {
660   sources = [
661     "fpdfsdk/include/javascript/IJavaScript.h",
662   ]
663   if (pdf_enable_v8) {
664     sources += [
665       "fpdfsdk/src/javascript/Consts.cpp",
666       "fpdfsdk/src/javascript/Consts.h",
667       "fpdfsdk/src/javascript/Document.cpp",
668       "fpdfsdk/src/javascript/Document.h",
669       "fpdfsdk/src/javascript/Field.cpp",
670       "fpdfsdk/src/javascript/Field.h",
671       "fpdfsdk/src/javascript/Icon.cpp",
672       "fpdfsdk/src/javascript/Icon.h",
673       "fpdfsdk/src/javascript/JS_Context.cpp",
674       "fpdfsdk/src/javascript/JS_Context.h",
675       "fpdfsdk/src/javascript/JS_Define.h",
676       "fpdfsdk/src/javascript/JS_EventHandler.cpp",
677       "fpdfsdk/src/javascript/JS_EventHandler.h",
678       "fpdfsdk/src/javascript/JS_GlobalData.cpp",
679       "fpdfsdk/src/javascript/JS_GlobalData.h",
680       "fpdfsdk/src/javascript/JS_Object.cpp",
681       "fpdfsdk/src/javascript/JS_Object.h",
682       "fpdfsdk/src/javascript/JS_Runtime.cpp",
683       "fpdfsdk/src/javascript/JS_Runtime.h",
684       "fpdfsdk/src/javascript/JS_Value.cpp",
685       "fpdfsdk/src/javascript/JS_Value.h",
686       "fpdfsdk/src/javascript/PublicMethods.cpp",
687       "fpdfsdk/src/javascript/PublicMethods.h",
688       "fpdfsdk/src/javascript/app.cpp",
689       "fpdfsdk/src/javascript/app.h",
690       "fpdfsdk/src/javascript/color.cpp",
691       "fpdfsdk/src/javascript/color.h",
692       "fpdfsdk/src/javascript/console.cpp",
693       "fpdfsdk/src/javascript/console.h",
694       "fpdfsdk/src/javascript/event.cpp",
695       "fpdfsdk/src/javascript/event.h",
696       "fpdfsdk/src/javascript/global.cpp",
697       "fpdfsdk/src/javascript/global.h",
698       "fpdfsdk/src/javascript/report.cpp",
699       "fpdfsdk/src/javascript/report.h",
700       "fpdfsdk/src/javascript/resource.cpp",
701       "fpdfsdk/src/javascript/resource.h",
702       "fpdfsdk/src/javascript/util.cpp",
703       "fpdfsdk/src/javascript/util.h",
704       "fpdfsdk/include/jsapi/fxjs_v8.h",
705       "fpdfsdk/src/jsapi/fxjs_v8.cpp",
706     ]
707     include_dirs = [
708       "//v8",
709       "//v8/include",
710     ]
711     public_deps = [
712       "//v8",
713     ]
714   } else {
715     sources += [ "fpdfsdk/src/javascript/JS_Runtime_Stub.cpp" ]
716   }
717   configs -= [ "//build/config/compiler:chromium_code" ]
718   configs += [
719     ":pdfium_config",
720     "//build/config/compiler:no_chromium_code",
721   ]
722 }
723
724 static_library("formfiller") {
725   sources = [
726     "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h",
727     "fpdfsdk/include/formfiller/FFL_CheckBox.h",
728     "fpdfsdk/include/formfiller/FFL_ComboBox.h",
729     "fpdfsdk/include/formfiller/FFL_FormFiller.h",
730     "fpdfsdk/include/formfiller/FFL_IFormFiller.h",
731     "fpdfsdk/include/formfiller/FFL_ListBox.h",
732     "fpdfsdk/include/formfiller/FFL_PushButton.h",
733     "fpdfsdk/include/formfiller/FFL_RadioButton.h",
734     "fpdfsdk/include/formfiller/FFL_TextField.h",
735     "fpdfsdk/include/formfiller/FormFiller.h",
736     "fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp",
737     "fpdfsdk/src/formfiller/FFL_CheckBox.cpp",
738     "fpdfsdk/src/formfiller/FFL_ComboBox.cpp",
739     "fpdfsdk/src/formfiller/FFL_FormFiller.cpp",
740     "fpdfsdk/src/formfiller/FFL_IFormFiller.cpp",
741     "fpdfsdk/src/formfiller/FFL_ListBox.cpp",
742     "fpdfsdk/src/formfiller/FFL_PushButton.cpp",
743     "fpdfsdk/src/formfiller/FFL_RadioButton.cpp",
744     "fpdfsdk/src/formfiller/FFL_TextField.cpp",
745   ]
746   configs -= [ "//build/config/compiler:chromium_code" ]
747   configs += [
748     ":pdfium_config",
749     "//build/config/compiler:no_chromium_code",
750   ]
751 }
752
753 test("pdfium_unittests") {
754   sources = [
755     "core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp",
756     "core/src/fxcrt/fx_basic_bstring_unittest.cpp",
757     "core/src/fxcrt/fx_basic_memmgr_unittest.cpp",
758     "core/src/fxcrt/fx_basic_wstring_unittest.cpp",
759     "core/src/fxcrt/fx_bidi_unittest.cpp",
760     "core/src/fxcrt/fx_system_unittest.cpp",
761     "third_party/base/nonstd_unique_ptr_unittest.cpp",
762   ]
763   deps = [
764     "//testing/gtest",
765     "//testing/gtest:gtest_main",
766     ":pdfium",
767     ":test_support",
768   ]
769   include_dirs = [ "." ]
770   configs -= [ "//build/config/compiler:chromium_code" ]
771   configs += [
772     ":pdfium_config",
773     "//build/config/compiler:no_chromium_code",
774   ]
775 }
776
777 test("pdfium_embeddertests") {
778   sources = [
779     "core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp",
780     "core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp",
781     "core/src/fpdfapi/fpdf_render/fpdf_render_pattern_embeddertest.cpp",
782     "fpdfsdk/src/fpdf_dataavail_embeddertest.cpp",
783     "fpdfsdk/src/fpdfdoc_embeddertest.cpp",
784     "fpdfsdk/src/fpdfformfill_embeddertest.cpp",
785     "fpdfsdk/src/fpdftext_embeddertest.cpp",
786     "fpdfsdk/src/fpdfview_c_api_test.c",
787     "fpdfsdk/src/fpdfview_c_api_test.h",
788     "fpdfsdk/src/fpdfview_embeddertest.cpp",
789     "testing/embedder_test.cpp",
790     "testing/embedder_test.h",
791     "testing/embedder_test_mock_delegate.h",
792     "testing/embedder_test_timer_handling_delegate.h",
793   ]
794   deps = [
795     "//testing/gmock",
796     "//testing/gtest",
797     ":pdfium",
798     ":test_support",
799   ]
800   include_dirs = [
801     "."
802   ]
803   if (pdf_enable_v8) {
804     sources += [
805      "fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp"
806     ]
807     deps += [
808       "//v8",
809       "//v8:v8_libplatform",
810     ]
811     include_dirs += [
812       "//v8",
813       "//v8/include",
814     ]
815   }
816   configs -= [ "//build/config/compiler:chromium_code" ]
817   configs += [
818     ":pdfium_config",
819     "//build/config/compiler:no_chromium_code",
820   ]
821 }