1 # cmake file for libpng
4 message(FATAL_ERROR "Include Defs.cmake")
7 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/png.h")
8 set(DEFAULT_PNG_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
10 # Assume build inside Android source tree
11 set(DEFAULT_PNG_SRC_PATH "../libpng")
14 set(PNG_SRC_PATH ${DEFAULT_PNG_SRC_PATH} CACHE STRING "Path to libpng source tree")
16 if (IS_ABSOLUTE ${PNG_SRC_PATH})
17 set(PNG_ABS_PATH ${PNG_SRC_PATH})
19 set(PNG_ABS_PATH "${CMAKE_SOURCE_DIR}/${PNG_SRC_PATH}")
24 ${PNG_ABS_PATH}/pngconf.h
26 ${PNG_ABS_PATH}/pngset.c
27 ${PNG_ABS_PATH}/pngget.c
28 ${PNG_ABS_PATH}/pngrutil.c
29 ${PNG_ABS_PATH}/pngtrans.c
30 ${PNG_ABS_PATH}/pngwutil.c
31 ${PNG_ABS_PATH}/pngread.c
32 ${PNG_ABS_PATH}/pngrio.c
33 ${PNG_ABS_PATH}/pngwio.c
34 ${PNG_ABS_PATH}/pngwrite.c
35 ${PNG_ABS_PATH}/pngrtran.c
36 ${PNG_ABS_PATH}/pngwtran.c
37 ${PNG_ABS_PATH}/pngmem.c
38 ${PNG_ABS_PATH}/pngerror.c
39 ${PNG_ABS_PATH}/pngpread.c
43 if(DE_CPU_IS_ARM AND NOT DEFINED DE_CPU_IS_ARM_NEON)
44 set(DE_CPU_IS_ARM_NEON 1)
45 message(STATUS "DE_CPU_IS_ARM_NEON is not defined: Assuming ARM NEON is supported.")
47 set(DE_CPU_IS_ARM_NEON 0)
50 if (DE_CPU_IS_ARM_64 OR (DE_CPU_IS_ARM AND DE_CPU_IS_ARM_NEON))
51 # armv8-a has always neon
54 ${PNG_ABS_PATH}/arm/arm_init.c
55 ${PNG_ABS_PATH}/arm/filter_neon_intrinsics.c
56 ${PNG_ABS_PATH}/arm/filter_neon.S
59 message(STATUS "Disabling ARM NEON optimizations.")
60 add_definitions(-DPNG_ARM_NEON_OPT=0)
65 add_definitions(-DPNG_DEBUG)
68 if (DE_OS_IS_UNIX OR DE_OS_IS_QNX)
70 add_definitions(-D_XOPEN_SOURCE=600)
73 set(CMAKE_C_FLAGS ${DE_3RD_PARTY_C_FLAGS})
75 add_library(png STATIC ${PNG_SRCS})
76 target_link_libraries(png ${ZLIB_LIBRARY})
78 set(PNG_INCLUDE_PATH ${PNG_ABS_PATH} PARENT_SCOPE)
79 set(PNG_LIBRARY png PARENT_SCOPE)