• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// We need to build this for both the device (as a shared library)
2// and the host (as a static library for tools to use).
3
4cc_defaults {
5    name: "libpng-defaults",
6    srcs: [
7        "png.c",
8        "pngerror.c",
9        "pngget.c",
10        "pngmem.c",
11        "pngpread.c",
12        "pngread.c",
13        "pngrio.c",
14        "pngrtran.c",
15        "pngrutil.c",
16        "pngset.c",
17        "pngtrans.c",
18        "pngwio.c",
19        "pngwrite.c",
20        "pngwtran.c",
21        "pngwutil.c",
22    ],
23    cflags: [
24        "-std=gnu89",
25        "-Wno-unused-parameter",
26    ],
27    arch: {
28        arm: {
29            srcs: [
30                "arm/arm_init.c",
31                "arm/filter_neon.S",
32                "arm/filter_neon_intrinsics.c",
33            ],
34        },
35        arm64: {
36            srcs: [
37                "arm/arm_init.c",
38                "arm/filter_neon.S",
39                "arm/filter_neon_intrinsics.c",
40            ],
41        },
42        x86: {
43            srcs: [
44                "contrib/intel/intel_init.c",
45                "contrib/intel/filter_sse2_intrinsics.c",
46            ],
47            // Disable optimizations because they crash on windows
48            // cflags: ["-DPNG_INTEL_SSE_OPT=1"],
49        },
50        x86_64: {
51            srcs: [
52                "contrib/intel/intel_init.c",
53                "contrib/intel/filter_sse2_intrinsics.c",
54            ],
55            // Disable optimizations because they crash on windows
56            // cflags: ["-DPNG_INTEL_SSE_OPT=1"],
57        },
58    },
59    target: {
60        android: {
61            shared_libs: ["libz"],
62        },
63        android_x86: {
64            cflags: ["-DPNG_INTEL_SSE_OPT=1"],
65        },
66        android_x86_64: {
67            cflags: ["-DPNG_INTEL_SSE_OPT=1"],
68        },
69        host: {
70            shared_libs: ["libz-host"],
71        },
72    },
73    export_include_dirs: ["."],
74    clang: true,
75}
76
77// For the host and device platform
78// =====================================================
79
80cc_library {
81    name: "libpng",
82    vendor_available: true,
83    vndk: {
84        enabled: true,
85    },
86    host_supported: true,
87    defaults: ["libpng-defaults"],
88    target: {
89        windows: {
90            enabled: true,
91        },
92    },
93}
94
95// For the device (static) for NDK
96// =====================================================
97
98cc_library_static {
99    name: "libpng_ndk",
100    defaults: ["libpng-defaults"],
101    cflags: ["-ftrapv"],
102
103    shared_libs: ["libz"],
104    sdk_version: "14",
105}
106
107// For testing
108// =====================================================
109
110cc_test {
111    clang: true,
112    host_supported: true,
113    gtest: false,
114    srcs: ["pngtest.c"],
115    name: "pngtest",
116    shared_libs: [
117        "libpng",
118    ],
119    target: {
120        android: {
121            shared_libs: ["libz"],
122        },
123        host: {
124            shared_libs: ["libz-host"],
125        },
126    },
127}
128