Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 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 | |
| 4 | cc_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: ["."], |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | // For the host and device platform |
| 77 | // ===================================================== |
| 78 | |
| 79 | cc_library { |
| 80 | name: "libpng", |
Vijay Venkatraman | bdd08fc | 2017-05-17 15:33:00 -0700 | [diff] [blame] | 81 | vendor_available: true, |
Justin Yun | 21693d7 | 2017-07-24 15:19:44 +0900 | [diff] [blame] | 82 | vndk: { |
| 83 | enabled: true, |
| 84 | }, |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 85 | host_supported: true, |
| 86 | defaults: ["libpng-defaults"], |
| 87 | target: { |
| 88 | windows: { |
| 89 | enabled: true, |
| 90 | }, |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 91 | }, |
| 92 | } |
| 93 | |
| 94 | // For the device (static) for NDK |
| 95 | // ===================================================== |
| 96 | |
| 97 | cc_library_static { |
| 98 | name: "libpng_ndk", |
| 99 | defaults: ["libpng-defaults"], |
| 100 | cflags: ["-ftrapv"], |
| 101 | |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 102 | shared_libs: ["libz"], |
| 103 | sdk_version: "14", |
| 104 | } |
| 105 | |
| 106 | // For testing |
| 107 | // ===================================================== |
| 108 | |
| 109 | cc_test { |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 110 | host_supported: true, |
| 111 | gtest: false, |
| 112 | srcs: ["pngtest.c"], |
| 113 | name: "pngtest", |
| 114 | shared_libs: [ |
| 115 | "libpng", |
| 116 | ], |
| 117 | target: { |
| 118 | android: { |
| 119 | shared_libs: ["libz"], |
| 120 | }, |
| 121 | host: { |
| 122 | shared_libs: ["libz-host"], |
| 123 | }, |
| 124 | }, |
| 125 | } |