aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2016-11-01 01:55:52 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-11-01 01:55:52 +0000
commitf10ad1e3b223ed3453b96ac52b62a23e8f7feaa0 (patch)
treef1410071b9b8c1f320cd0de055ad046fc7f8a48f
parentd8f25cf27935cdc0ccb3dde25d6dc95713dadf03 (diff)
parenta9db5cc4529abc6ac79f03fa6d97ef8a2702b82c (diff)
downloadlibpng-f10ad1e3b223ed3453b96ac52b62a23e8f7feaa0.tar.gz
Merge "Convert Android.mk to Android.bp" am: 0bbba1b525
am: a9db5cc452 Change-Id: I724870a91ff32c33ad2f65b53fc033e53c60ec79
-rw-r--r--Android.bp131
-rw-r--r--Android.mk138
2 files changed, 131 insertions, 138 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 000000000..7dcf4a738
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,131 @@
+// We need to build this for both the device (as a shared library)
+// and the host (as a static library for tools to use).
+
+cc_defaults {
+ name: "libpng-defaults",
+ srcs: [
+ "png.c",
+ "pngerror.c",
+ "pngget.c",
+ "pngmem.c",
+ "pngpread.c",
+ "pngread.c",
+ "pngrio.c",
+ "pngrtran.c",
+ "pngrutil.c",
+ "pngset.c",
+ "pngtrans.c",
+ "pngwio.c",
+ "pngwrite.c",
+ "pngwtran.c",
+ "pngwutil.c",
+ ],
+ cflags: [
+ "-std=gnu89",
+ "-Wno-unused-parameter",
+ ],
+ arch: {
+ arm: {
+ srcs: [
+ "arm/arm_init.c",
+ "arm/filter_neon.S",
+ "arm/filter_neon_intrinsics.c",
+ ],
+ },
+ arm64: {
+ srcs: [
+ "arm/arm_init.c",
+ "arm/filter_neon.S",
+ "arm/filter_neon_intrinsics.c",
+ ],
+ },
+ x86: {
+ srcs: [
+ "contrib/intel/intel_init.c",
+ "contrib/intel/filter_sse2_intrinsics.c",
+ ],
+ // Disable optimizations because they crash on windows
+ // cflags: ["-DPNG_INTEL_SSE_OPT=1"],
+ },
+ x86_64: {
+ srcs: [
+ "contrib/intel/intel_init.c",
+ "contrib/intel/filter_sse2_intrinsics.c",
+ ],
+ // Disable optimizations because they crash on windows
+ // cflags: ["-DPNG_INTEL_SSE_OPT=1"],
+ },
+ },
+ target: {
+ android: {
+ shared_libs: ["libz"],
+ },
+ android_x86: {
+ cflags: ["-DPNG_INTEL_SSE_OPT=1"],
+ },
+ android_x86_64: {
+ cflags: ["-DPNG_INTEL_SSE_OPT=1"],
+ },
+ host: {
+ shared_libs: ["libz-host"],
+ },
+ },
+ export_include_dirs: ["."],
+ clang: true,
+}
+
+// For the host and device platform
+// =====================================================
+
+cc_library {
+ name: "libpng",
+ host_supported: true,
+ defaults: ["libpng-defaults"],
+ target: {
+ windows: {
+ enabled: true,
+ },
+ android: {
+ sanitize: {
+ never: true,
+ },
+ },
+ },
+}
+
+// For the device (static) for NDK
+// =====================================================
+
+cc_library_static {
+ name: "libpng_ndk",
+ defaults: ["libpng-defaults"],
+ cflags: ["-ftrapv"],
+
+ sanitize: {
+ never: true,
+ },
+ shared_libs: ["libz"],
+ sdk_version: "14",
+}
+
+// For testing
+// =====================================================
+
+cc_test {
+ clang: true,
+ host_supported: true,
+ gtest: false,
+ srcs: ["pngtest.c"],
+ name: "pngtest",
+ shared_libs: [
+ "libpng",
+ ],
+ target: {
+ android: {
+ shared_libs: ["libz"],
+ },
+ host: {
+ shared_libs: ["libz-host"],
+ },
+ },
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 1c3602b27..000000000
--- a/Android.mk
+++ /dev/null
@@ -1,138 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# We need to build this for both the device (as a shared library)
-# and the host (as a static library for tools to use).
-
-common_SRC_FILES := \
- png.c \
- pngerror.c \
- pngget.c \
- pngmem.c \
- pngpread.c \
- pngread.c \
- pngrio.c \
- pngrtran.c \
- pngrutil.c \
- pngset.c \
- pngtrans.c \
- pngwio.c \
- pngwrite.c \
- pngwtran.c \
- pngwutil.c \
-
-ifeq ($(ARCH_ARM_HAVE_NEON),true)
-my_cflags_arm := -DPNG_ARM_NEON_OPT=2
-endif
-
-my_cflags_arm64 := -DPNG_ARM_NEON_OPT=2
-
-my_src_files_arm := \
- arm/arm_init.c \
- arm/filter_neon.S \
- arm/filter_neon_intrinsics.c
-
-my_cflags_intel := -DPNG_INTEL_SSE_OPT=1
-
-my_src_files_intel := \
- contrib/intel/intel_init.c \
- contrib/intel/filter_sse2_intrinsics.c
-
-common_CFLAGS := -std=gnu89 -Wno-unused-parameter
-
-# For the host
-# =====================================================
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_SRC_FILES_x86 += $(my_src_files_intel)
-LOCAL_SRC_FILES_x86_64 += $(my_src_files_intel)
-LOCAL_CFLAGS += $(common_CFLAGS)
-
-# Disable optimizations because they crash on windows
-# LOCAL_CFLAGS_x86 += $(my_cflags_intel)
-# LOCAL_CFLAGS_x86_64 += $(my_cflags_intel)
-
-LOCAL_ASFLAGS += $(common_ASFLAGS)
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_STATIC_LIBRARIES := libz
-LOCAL_MODULE:= libpng
-LOCAL_MODULE_HOST_OS := darwin linux windows
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-
-# For the device (static) for NDK
-# =====================================================
-
-include $(CLEAR_VARS)
-LOCAL_CLANG := true
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_SRC_FILES_arm := $(my_src_files_arm)
-LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
-LOCAL_SRC_FILES_x86 += $(my_src_files_intel)
-LOCAL_SRC_FILES_x86_64 += $(my_src_files_intel)
-LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
-LOCAL_CFLAGS_arm := $(my_cflags_arm)
-LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
-LOCAL_CFLAGS_x86 += $(my_cflags_intel)
-LOCAL_CFLAGS_x86_64 += $(my_cflags_intel)
-LOCAL_ASFLAGS += $(common_ASFLAGS)
-LOCAL_SANITIZE := never
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_SHARED_LIBRARIES := libz
-LOCAL_MODULE:= libpng_ndk
-LOCAL_SDK_VERSION := 14
-include $(BUILD_STATIC_LIBRARY)
-
-# For the device (static) for platform (retains fortify support)
-# =====================================================
-
-include $(CLEAR_VARS)
-LOCAL_CLANG := true
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_SRC_FILES_arm := $(my_src_files_arm)
-LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
-LOCAL_SRC_FILES_x86 += $(my_src_files_intel)
-LOCAL_SRC_FILES_x86_64 += $(my_src_files_intel)
-LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
-LOCAL_CFLAGS_arm := $(my_cflags_arm)
-LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
-LOCAL_CFLAGS_x86 += $(my_cflags_intel)
-LOCAL_CFLAGS_x86_64 += $(my_cflags_intel)
-LOCAL_ASFLAGS += $(common_ASFLAGS)
-LOCAL_SANITIZE := never
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_SHARED_LIBRARIES := libz
-LOCAL_MODULE:= libpng
-include $(BUILD_STATIC_LIBRARY)
-
-# For the device (shared)
-# =====================================================
-
-include $(CLEAR_VARS)
-LOCAL_CLANG := true
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_SRC_FILES_arm := $(my_src_files_arm)
-LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
-LOCAL_SRC_FILES_x86 += $(my_src_files_intel)
-LOCAL_SRC_FILES_x86_64 += $(my_src_files_intel)
-LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
-LOCAL_CFLAGS_arm := $(my_cflags_arm)
-LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
-LOCAL_CFLAGS_x86 += $(my_cflags_intel)
-LOCAL_CFLAGS_x86_64 += $(my_cflags_intel)
-LOCAL_ASFLAGS += $(common_ASFLAGS)
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_SHARED_LIBRARIES := libz
-LOCAL_MODULE:= libpng
-include $(BUILD_SHARED_LIBRARY)
-
-# For testing
-# =====================================================
-
-include $(CLEAR_VARS)
-LOCAL_CLANG := true
-LOCAL_SRC_FILES:= pngtest.c
-LOCAL_MODULE := pngtest
-LOCAL_SHARED_LIBRARIES:= libpng libz
-LOCAL_MODULE_TAGS := debug
-include $(BUILD_EXECUTABLE)