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 "-Wall", 26 "-Werror", 27 "-Wno-unused-parameter", 28 ], 29 arch: { 30 arm: { 31 srcs: [ 32 "arm/arm_init.c", 33 "arm/filter_neon.S", 34 "arm/filter_neon_intrinsics.c", 35 ], 36 }, 37 arm64: { 38 srcs: [ 39 "arm/arm_init.c", 40 "arm/filter_neon.S", 41 "arm/filter_neon_intrinsics.c", 42 ], 43 }, 44 x86: { 45 srcs: [ 46 "intel/intel_init.c", 47 "intel/filter_sse2_intrinsics.c", 48 ], 49 // Disable optimizations because they crash on windows 50 // cflags: ["-DPNG_INTEL_SSE_OPT=1"], 51 }, 52 x86_64: { 53 srcs: [ 54 "intel/intel_init.c", 55 "intel/filter_sse2_intrinsics.c", 56 ], 57 // Disable optimizations because they crash on windows 58 // cflags: ["-DPNG_INTEL_SSE_OPT=1"], 59 }, 60 }, 61 shared_libs: ["libz"], 62 target: { 63 android_x86: { 64 cflags: ["-DPNG_INTEL_SSE_OPT=1"], 65 }, 66 android_x86_64: { 67 cflags: ["-DPNG_INTEL_SSE_OPT=1"], 68 }, 69 }, 70 export_include_dirs: ["."], 71} 72 73// For the host and device platform 74// ===================================================== 75 76cc_library { 77 name: "libpng", 78 vendor_available: true, 79 recovery_available: true, 80 vndk: { 81 enabled: true, 82 }, 83 double_loadable: true, 84 host_supported: true, 85 defaults: ["libpng-defaults"], 86 target: { 87 windows: { 88 enabled: true, 89 }, 90 }, 91} 92 93// For the device (static) for NDK 94// ===================================================== 95 96cc_library_static { 97 name: "libpng_ndk", 98 defaults: ["libpng-defaults"], 99 cflags: ["-ftrapv"], 100 101 shared_libs: ["libz"], 102 sdk_version: "14", 103} 104 105// For testing 106// ===================================================== 107 108cc_test { 109 host_supported: true, 110 gtest: false, 111 srcs: ["pngtest.c"], 112 name: "pngtest", 113 cflags: ["-Wall", "-Werror"], 114 shared_libs: [ 115 "libpng", 116 "libz", 117 ], 118} 119