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