34 lines
908 B
CMake
Raw Normal View History

2021-06-17 17:32:24 -04:00
project(libpng)
2022-07-02 18:14:23 -04:00
# ZLib (Needed By libpng)
add_subdirectory(zlib)
2021-06-17 17:32:24 -04:00
# Silence Warnings
add_compile_options(-w)
## LibPNG
2022-06-13 20:49:09 -04:00
# Options
set(PNG_TESTS FALSE CACHE BOOL "" FORCE)
2022-07-02 18:14:23 -04:00
set(PNG_NO_STDIO FALSE CACHE BOOL "" FORCE)
2022-08-05 22:07:19 -04:00
set(PNG_BUILD_ZLIB TRUE CACHE BOOL "" FORCE)
2022-06-13 20:49:09 -04:00
2021-06-17 17:32:24 -04:00
# Download
2021-11-11 20:12:16 -05:00
set(ZLIB_LIBRARY zlibstatic)
2022-08-05 22:07:19 -04:00
set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/zlib/src" "${CMAKE_CURRENT_BINARY_DIR}/zlib/src")
2021-11-11 20:12:16 -05:00
add_subdirectory(src EXCLUDE_FROM_ALL)
2022-08-05 22:07:19 -04:00
# Use Symbol Versioning
set_target_properties(png12 PROPERTIES LINK_OPTIONS "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libpng.vers")
2021-06-17 17:32:24 -04:00
2021-10-22 17:28:26 -04:00
# Ensure Build
2022-07-02 18:14:23 -04:00
add_custom_target(png12-build ALL DEPENDS png12)
2021-06-17 17:32:24 -04:00
# Install
2022-07-02 18:14:23 -04:00
install(TARGETS png12 DESTINATION "${MCPI_LIB_DIR}")
if(BUILD_ARM_COMPONENTS)
2022-06-25 23:03:46 -04:00
install(TARGETS png12 zlibstatic EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
2022-06-13 20:49:09 -04:00
endif()
2022-07-13 16:46:33 -04:00
# License
install(FILES src/LICENSE DESTINATION "${MCPI_LEGAL_DIR}/libpng")