metaforce/extern/libpng/CMakeLists.txt

54 lines
1.4 KiB
CMake
Raw Normal View History

2020-10-21 04:40:02 +00:00
if(NOT WIN32 AND NOT APPLE AND NOT NX) # remove WIN32 when specter/freetype is gone
2020-06-13 21:18:57 +00:00
find_library(PNG_LIB NAMES png libpng)
endif()
if(NOT PNG_LIB)
2015-11-11 04:01:36 +00:00
message(STATUS "Using HECL's built-in libpng")
2021-01-07 01:46:56 +00:00
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm(64)?")
2020-10-21 04:40:02 +00:00
set(INTRINSICS
arm/arm_init.c
arm/filter_neon.S
arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c)
2021-01-07 01:46:56 +00:00
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64)
2020-10-21 04:40:02 +00:00
set(INTRINSICS
intel/filter_sse2_intrinsics.c
intel/intel_init.c)
endif()
2015-07-07 03:24:09 +00:00
add_library(png
png.h
pngconf.h
pngdebug.h
pnginfo.h
pngpriv.h
pngstruct.h
pnglibconf.h
2020-10-21 04:40:02 +00:00
2015-07-07 03:24:09 +00:00
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
2020-10-21 04:40:02 +00:00
pngwutil.c
${INTRINSICS})
2021-01-07 01:46:56 +00:00
if(APPLE)
target_compile_options(png PRIVATE -Wno-implicit-fallthrough)
endif()
2020-06-13 21:18:57 +00:00
target_link_libraries(png PUBLIC ${ZLIB_LIBRARIES})
target_include_directories(png PUBLIC ${ZLIB_INCLUDE_DIR})
set(PNG_LIBRARIES png CACHE PATH "PNG libraries" FORCE)
2020-05-28 01:38:07 +00:00
set(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "PNG include path" FORCE)
2015-11-22 23:50:11 +00:00
else()
2020-06-13 21:18:57 +00:00
set(PNG_LIBRARIES ${PNG_LIB} CACHE PATH "PNG libraries" FORCE)
2020-05-28 01:38:07 +00:00
find_path(PNG_INCLUDE_DIR png.h)
2020-06-14 03:45:38 +00:00
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE)
2020-06-26 01:22:59 +00:00
endif()