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