• 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    host_supported: true,
84    defaults: ["libpng-defaults"],
85    target: {
86        windows: {
87            enabled: true,
88        },
89    },
90}
91
92// For the device (static) for NDK
93// =====================================================
94
95cc_library_static {
96    name: "libpng_ndk",
97    defaults: ["libpng-defaults"],
98    cflags: ["-ftrapv"],
99
100    shared_libs: ["libz"],
101    sdk_version: "14",
102}
103
104// For testing
105// =====================================================
106
107cc_test {
108    clang: true,
109    host_supported: true,
110    gtest: false,
111    srcs: ["pngtest.c"],
112    name: "pngtest",
113    shared_libs: [
114        "libpng",
115    ],
116    target: {
117        android: {
118            shared_libs: ["libz"],
119        },
120        host: {
121            shared_libs: ["libz-host"],
122        },
123    },
124}
125