minecraft-pi-reborn/dependencies/libpng/CMakeLists.txt

39 lines
1.3 KiB
CMake
Raw Normal View History

2021-06-17 21:32:24 +00:00
project(libpng)
2022-07-02 22:14:23 +00:00
# ZLib (Needed By libpng)
add_subdirectory(zlib)
2021-06-17 21:32:24 +00:00
# Silence Warnings
add_compile_options(-w)
## LibPNG
2022-06-14 00:49:09 +00:00
# Options
set(PNG_TESTS FALSE CACHE BOOL "" FORCE)
2022-07-02 22:14:23 +00:00
set(PNG_NO_STDIO FALSE CACHE BOOL "" FORCE)
set(PNG_STATIC FALSE CACHE BOOL "" FORCE)
set(PNG_SHARED TRUE CACHE BOOL "" FORCE)
2022-06-14 00:49:09 +00:00
2021-06-17 21:32:24 +00:00
# Download
2021-11-12 01:12:16 +00:00
set(ZLIB_LIBRARY zlibstatic)
2022-07-07 04:37:53 +00:00
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib/src" "${CMAKE_CURRENT_BINARY_DIR}/zlib/src")
2021-06-17 21:32:24 +00:00
set(CMAKE_POLICY_DEFAULT_CMP0054 OLD) # Silence Warning
2022-06-26 03:03:46 +00:00
set(CMAKE_POLICY_DEFAULT_CMP0003 NEW) # Silence Warning
set(CMAKE_POLICY_DEFAULT_CMP0022 NEW) # Fix Error
set(M_LIBRARY m) # No Full Paths!
2021-11-12 01:12:16 +00:00
add_subdirectory(src EXCLUDE_FROM_ALL)
2021-06-17 21:32:24 +00:00
set(CMAKE_POLICY_DEFAULT_CMP0054 NEW) # Re-Enable New Behavior
2022-07-02 22:14:23 +00:00
# Setup Target
set_target_properties(png12 PROPERTIES LINK_OPTIONS "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libpng.vers") # Use Symbol Versioning
set_target_properties(png12 PROPERTIES DEBUG_POSTFIX "") # Fix LibPNG Suffix In Debug Mode
target_include_directories(png12 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
2021-06-17 21:32:24 +00:00
2021-10-22 21:28:26 +00:00
# Ensure Build
2022-07-02 22:14:23 +00:00
add_custom_target(png12-build ALL DEPENDS png12)
2021-06-17 21:32:24 +00:00
# Install
2022-07-02 22:14:23 +00:00
install(TARGETS png12 DESTINATION "${MCPI_LIB_DIR}")
if(BUILD_ARM_COMPONENTS)
2022-06-26 03:03:46 +00:00
install(TARGETS png12 zlibstatic EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
2022-06-14 00:49:09 +00:00
endif()