vcpkg/ports/graphicsmagick/portfile.cmake
Jack·Boos·Yu 7cfd63db7f
[many ports]switch to vcpkg-cmake / vcpkg-cmake-config part 2 (#29882)
Co-authored-by: jyu49 <yu_jack@apple.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2023-04-21 14:48:12 -07:00

47 lines
2.0 KiB
CMake

set(GM_VERSION 1.3.37)
vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO graphicsmagick/graphicsmagick
REF ${GM_VERSION}
FILENAME "GraphicsMagick-${GM_VERSION}-windows.7z"
SHA512 2e465a290946d730c0da1b45602ebdebc256d9a0705d6d79784efcefb0760a923dd78c73f7a563ce6ec41e4199da66d3b31cc8c6b8f821ff993092d348aeaa2f
PATCHES
# GM always requires a dynamic BZIP2. This patch makes this dependent if _DLL is defined
dynamic_bzip2.patch
# Bake GM's own modules into the .dll itself. This fixes a bug whereby
# 'vcpkg install graphicsmagick' did not lead to a copy of GM that could
# load either PNG or JPEG files (due to missing GM Modules, with names
# matching "IM_*.DLL").
disable_graphicsmagick_modules.patch
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/magick_types.h" DESTINATION "${SOURCE_PATH}/magick")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DINSTALL_HEADERS=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-graphicsmagick)
# copy license
file(INSTALL "${SOURCE_PATH}/Copyright.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
# copy config
file(COPY "${SOURCE_PATH}/config/colors.mgk" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/config")
file(COPY "${SOURCE_PATH}/config/log.mgk" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/config")
file(COPY "${SOURCE_PATH}/config/modules.mgk" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/config")
file(READ "${SOURCE_PATH}/config/type-windows.mgk.in" TYPE_MGK)
string(REPLACE "@windows_font_dir@" "$ENV{SYSTEMROOT}/Fonts/" TYPE_MGK "${TYPE_MGK}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/graphicsmagick/config/type.mgk" "${TYPE_MGK}")
configure_file("${SOURCE_PATH}/config/delegates.mgk.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/config/delegates.mgk" @ONLY)
vcpkg_copy_pdbs()