aboutsummaryrefslogtreecommitdiff
path: root/Android.bp
blob: 85f449bf8d04db9de5bb5701336506552d5d566e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
//     CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
//     DEPENDING ON IT IN YOUR PROJECT. ***
package {
    default_applicable_licenses: ["external_pdfium_license"],
}

// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
    name: "external_pdfium_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
        "SPDX-license-identifier-Artistic",
        "SPDX-license-identifier-BSD",
        "SPDX-license-identifier-FTL",
        "SPDX-license-identifier-MIT",
        "SPDX-license-identifier-OFL", // by exception only
        "SPDX-license-identifier-Zlib",
        "SPDX-license-identifier-libtiff",
        "legacy_unencumbered",
    ],
    license_text: [
        "LICENSE",
    ],
}

cc_defaults {
    name: "pdfium-common",
    cflags: [
        "-O3",
        "-fstrict-aliasing",
        "-fprefetch-loop-arrays",
        "-fexceptions",

        "-Wno-implicit-fallthrough",
        "-Wno-missing-field-initializers",
        "-Wno-non-virtual-dtor",
        "-Wno-unused-parameter",

        // pdfium_common_config
        "-DOPJ_STATIC",
        "-DPNG_PREFIX",
        "-DPNG_USE_READ_MACROS",

        // Do not export functions by default. Export only functions annotated
        // with FPDF_EXPORT.
        "-fvisibility=hidden",

        // Macro definitions to enable FPDF_EXPORT.
        "-DCOMPONENT_BUILD",
        "-DFPDF_IMPLEMENTATION",
    ],

    arch: {
        arm: {
            instruction_set: "arm",
        },
    },

    include_dirs: [
        "external/freetype/include",
    ],

    header_libs: [
        "pdfium-headers",
        "pdfium-third-party-headers"
    ],
}

cc_defaults {
    name: "pdfium-core",

    defaults: [
        "pdfium-common"
    ],

    exclude_srcs: [
        "**/*_unittest.cpp",
        "**/*_embeddertest.cpp",
    ],
}


cc_library_headers {
    name: "pdfium-headers",
    export_include_dirs: ["."],
}

cc_library_headers {
    name: "pdfium-third-party-headers",
    export_include_dirs: ["third_party"],
}

cc_library_shared {
    name: "libpdfium",
    defaults: ["pdfium-core"],

    whole_static_libs: [
        "libpdfium-fpdfsdk",
    ],

    // Transitivity is not supported for static libraries (yet).
    // Lists the whole transitivity closure here.
    static_libs: [
        "libpdfium-agg",
        "libpdfium-cmaps",
        "libpdfium-constants",
        "libpdfium-edit",
        "libpdfium-fdrm",
        "libpdfium-font",
        "libpdfium-formfiller",
        "libpdfium-fpdfdoc",
        "libpdfium-fpdftext",
        "libpdfium-fxcodec",
        "libpdfium-fxcrt",
        "libpdfium-fxge",
        "libpdfium-fxjs",
        "libpdfium-libopenjpeg2",
        "libpdfium-page",
        "libpdfium-parser",
        "libpdfium-pwl",
        "libpdfium-render",
        "libpdfium-skia_shared",
        "libpdfium-third_party-base",
        "libpdfium-lcms2",
    ],

    // TODO: figure out why turning on exceptions requires manually linking libdl
    shared_libs: [
        "libdl",
        "libft2",
        "libicu",
        "libjpeg",
        "libz",
    ],

    ldflags: [
      "-Wl,-icf=all",
    ],

    export_include_dirs: ["public"],

}

subdirs = ["third_party"]