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", |
Chih-Hung Hsieh | 76670a0 | 2017-09-28 14:42:50 -0700 | [diff] [blame^] | 25 | "-Wall", |
| 26 | "-Werror", |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 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 | "contrib/intel/intel_init.c", |
| 47 | "contrib/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 | "contrib/intel/intel_init.c", |
| 55 | "contrib/intel/filter_sse2_intrinsics.c", |
| 56 | ], |
| 57 | // Disable optimizations because they crash on windows |
| 58 | // cflags: ["-DPNG_INTEL_SSE_OPT=1"], |
| 59 | }, |
| 60 | }, |
| 61 | target: { |
| 62 | android: { |
| 63 | shared_libs: ["libz"], |
| 64 | }, |
| 65 | android_x86: { |
| 66 | cflags: ["-DPNG_INTEL_SSE_OPT=1"], |
| 67 | }, |
| 68 | android_x86_64: { |
| 69 | cflags: ["-DPNG_INTEL_SSE_OPT=1"], |
| 70 | }, |
| 71 | host: { |
| 72 | shared_libs: ["libz-host"], |
| 73 | }, |
| 74 | }, |
| 75 | export_include_dirs: ["."], |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | // For the host and device platform |
| 79 | // ===================================================== |
| 80 | |
| 81 | cc_library { |
| 82 | name: "libpng", |
Vijay Venkatraman | bdd08fc | 2017-05-17 15:33:00 -0700 | [diff] [blame] | 83 | vendor_available: true, |
Justin Yun | 21693d7 | 2017-07-24 15:19:44 +0900 | [diff] [blame] | 84 | vndk: { |
| 85 | enabled: true, |
| 86 | }, |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 87 | host_supported: true, |
| 88 | defaults: ["libpng-defaults"], |
| 89 | target: { |
| 90 | windows: { |
| 91 | enabled: true, |
| 92 | }, |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 93 | }, |
| 94 | } |
| 95 | |
| 96 | // For the device (static) for NDK |
| 97 | // ===================================================== |
| 98 | |
| 99 | cc_library_static { |
| 100 | name: "libpng_ndk", |
| 101 | defaults: ["libpng-defaults"], |
| 102 | cflags: ["-ftrapv"], |
| 103 | |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 104 | shared_libs: ["libz"], |
| 105 | sdk_version: "14", |
| 106 | } |
| 107 | |
| 108 | // For testing |
| 109 | // ===================================================== |
| 110 | |
| 111 | cc_test { |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 112 | host_supported: true, |
| 113 | gtest: false, |
| 114 | srcs: ["pngtest.c"], |
| 115 | name: "pngtest", |
Chih-Hung Hsieh | 76670a0 | 2017-09-28 14:42:50 -0700 | [diff] [blame^] | 116 | cflags: ["-Wall", "-Werror"], |
Colin Cross | 6920142 | 2016-10-31 15:23:08 -0700 | [diff] [blame] | 117 | shared_libs: [ |
| 118 | "libpng", |
| 119 | ], |
| 120 | target: { |
| 121 | android: { |
| 122 | shared_libs: ["libz"], |
| 123 | }, |
| 124 | host: { |
| 125 | shared_libs: ["libz-host"], |
| 126 | }, |
| 127 | }, |
| 128 | } |