PNG.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. if (APPLE)
  2. # Only disable NEON extension for Apple ARM builds, leave it enabled for Raspberry PI.
  3. set(_disable_neon_extension "-DPNG_ARM_NEON:STRING=off")
  4. else ()
  5. set(_disable_neon_extension "")
  6. endif ()
  7. set(_patch_cmd PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.patched CMakeLists.txt)
  8. if(APPLE AND IS_CROSS_COMPILE)
  9. # TODO: check if it doesn't create problem when compiling from arm to x86_64
  10. prusaslicer_add_cmake_project(PNG
  11. GIT_REPOSITORY https://github.com/glennrp/libpng.git
  12. GIT_TAG v1.6.35
  13. DEPENDS ${ZLIB_PKG}
  14. PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
  15. ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/macos-arm64.patch
  16. CMAKE_ARGS
  17. -DPNG_SHARED=OFF
  18. -DPNG_STATIC=ON
  19. -DPNG_PREFIX=prusaslicer_
  20. -DPNG_TESTS=OFF
  21. -DDISABLE_DEPENDENCY_TRACKING=OFF
  22. ${_disable_neon_extension}
  23. )
  24. else ()
  25. if (APPLE)
  26. set(_patch_cmd ${_patch_cmd} && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/PNG.patch)
  27. endif ()
  28. add_cmake_project(PNG
  29. URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.35.zip
  30. URL_HASH SHA256=3d22d46c566b1761a0e15ea397589b3a5f36ac09b7c785382e6470156c04247f
  31. PATCH_COMMAND "${_patch_cmd}"
  32. CMAKE_ARGS
  33. -DPNG_SHARED=OFF
  34. -DPNG_STATIC=ON
  35. -DPNG_PREFIX=prusaslicer_
  36. -DPNG_TESTS=OFF
  37. -DPNG_EXECUTABLES=OFF
  38. ${_disable_neon_extension}
  39. )
  40. endif()
  41. set(DEP_PNG_DEPENDS ZLIB)