portfile.cmake 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # When this port is updated, the minizip port should be updated at the same time
  2. vcpkg_from_github(
  3. OUT_SOURCE_PATH SOURCE_PATH
  4. REPO madler/zlib
  5. REF v1.2.13
  6. SHA512 44b834fbfb50cca229209b8dbe1f96b258f19a49f5df23b80970b716371d856a4adf525edb4c6e0e645b180ea949cb90f5365a1d896160f297f56794dd888659
  7. HEAD_REF master
  8. PATCHES
  9. 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
  10. 0002-skip-building-examples.patch
  11. 0003-build-static-or-shared-not-both.patch
  12. 0004-android-and-mingw-fixes.patch
  13. )
  14. # This is generated during the cmake build
  15. file(REMOVE "${SOURCE_PATH}/zconf.h")
  16. vcpkg_cmake_configure(
  17. SOURCE_PATH "${SOURCE_PATH}"
  18. OPTIONS
  19. -DSKIP_INSTALL_FILES=ON
  20. OPTIONS_DEBUG
  21. -DSKIP_INSTALL_HEADERS=ON
  22. )
  23. vcpkg_cmake_install()
  24. file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
  25. # Install the pkgconfig file
  26. if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
  27. if(VCPKG_TARGET_IS_WINDOWS)
  28. vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc" "-lz" "-lzlib")
  29. endif()
  30. file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
  31. endif()
  32. if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
  33. if(VCPKG_TARGET_IS_WINDOWS)
  34. vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc" "-lz" "-lzlibd")
  35. endif()
  36. file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
  37. endif()
  38. vcpkg_fixup_pkgconfig()
  39. vcpkg_copy_pdbs()
  40. if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
  41. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zconf.h" "ifdef ZLIB_DLL" "if 0")
  42. else()
  43. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zconf.h" "ifdef ZLIB_DLL" "if 1")
  44. endif()
  45. file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
  46. file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)