2020-11-16 14:47:43 +08:00
|
|
|
|
|
|
|
set(lib_name png)
|
|
|
|
set(target_name ${lib_name})
|
|
|
|
|
|
|
|
project(${lib_name})
|
2023-03-11 22:10:18 +08:00
|
|
|
include(AXPlatform)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
|
|
|
set(${target_name}_src
|
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2022-12-17 14:31:23 +08:00
|
|
|
if (AX_ISA_SIMD STREQUAL "neon")
|
2022-12-17 12:00:15 +08:00
|
|
|
set(libpng_arm_sources
|
|
|
|
arm/arm_init.c
|
|
|
|
arm/filter_neon_intrinsics.c
|
|
|
|
arm/palette_neon_intrinsics.c)
|
2022-12-17 14:31:23 +08:00
|
|
|
# notes:
|
|
|
|
# - android armv7: needs PNG_ARM_NEON_CHECK_SUPPORTED for very older devices, but axmol no longer support them
|
2022-12-17 12:00:15 +08:00
|
|
|
set(libpng_optimize_flag "PNG_ARM_NEON_OPT=2")
|
|
|
|
elseif(NOT (AX_ISA_SIMD STREQUAL "none"))
|
|
|
|
set(libpng_intel_sources
|
|
|
|
intel/intel_init.c
|
|
|
|
intel/filter_sse2_intrinsics.c)
|
|
|
|
set(libpng_optimize_flag "PNG_INTEL_SSE_OPT=1")
|
|
|
|
else()
|
|
|
|
set(libpng_optimize_flag "PNG_ARM_NEON_OPT=0")
|
|
|
|
set(libpng_optimize_flag "PNG_INTEL_SSE_OPT=0")
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(${target_name} STATIC
|
|
|
|
${${target_name}_src}
|
2022-12-17 12:00:15 +08:00
|
|
|
${libpng_arm_sources}
|
|
|
|
${libpng_intel_sources}
|
2020-11-16 14:47:43 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(${target_name} PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
|
2022-12-17 12:00:15 +08:00
|
|
|
target_compile_definitions(${target_name} PUBLIC ${libpng_optimize_flag})
|