vcpkg/ports/sail/portfile.cmake
Dmitry Baryshev 4a723f2d16
[sail] Add features (#27169)
* [sail] Added features

* [sail] vcpkg x-add-version --all --overwrite-version

* [sail] Added dependency name

* [sail] vcpkg x-add-version --all --overwrite-version

* [sail] Added priority-based features

* [sail] vcpkg x-add-version --all --overwrite-version

* [sail] Fix enabling only the selected codecs

* [sail] vcpkg x-add-version --all --overwrite-version

* [sail] Rename 'Build with' to 'Enable'

* [sail] vcpkg x-add-version --all --overwrite-version

* [sail] Escape codecs list

* [sail] Remove SVG from aggregated features as its dependency 'resvg' is still not in vcpkg

* [sail] vcpkg x-add-version --all --overwrite-version

* [sail] Enable SVG if it was explicitly enabled

* [sail] vcpkg x-add-version --all --overwrite-version
2022-10-13 11:59:21 -07:00

61 lines
2.2 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO HappySeaFox/sail
REF v0.9.0-rc1
SHA512 c9b04bdf92600c0b1d38e00b31ec28f841b76fa41c50524199665de3e97a74b2633b8e9dc4bce1820521245b9d3bf04788eb1b5de9e3516e421927205d09ac47
HEAD_REF master
)
# Enable selected codecs
set(ONLY_CODECS "")
foreach(CODEC avif bmp gif ico jpeg jpeg2000 pcx png qoi svg tga tiff wal webp xbm)
if (${CODEC} IN_LIST FEATURES)
list(APPEND ONLY_CODECS ${CODEC})
endif()
endforeach()
list(JOIN ONLY_CODECS "\;" ONLY_CODECS_ESCAPED)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSAIL_COMBINE_CODECS=ON
-DSAIL_ONLY_CODECS=${ONLY_CODECS_ESCAPED}
-DSAIL_BUILD_APPS=OFF
-DSAIL_BUILD_EXAMPLES=OFF
-DSAIL_BUILD_TESTS=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
# Remove duplicate files
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share")
# Move cmake configs
vcpkg_cmake_config_fixup(PACKAGE_NAME sail CONFIG_PATH lib/cmake/sail DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME sailcodecs CONFIG_PATH lib/cmake/sailcodecs DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME sailcommon CONFIG_PATH lib/cmake/sailcommon DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME sailc++ CONFIG_PATH lib/cmake/sailc++ DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME sailmanip CONFIG_PATH lib/cmake/sailmanip DO_NOT_DELETE_PARENT_CONFIG_PATH)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake"
"${CURRENT_PACKAGES_DIR}/debug/lib/cmake")
# Fix pkg-config files
vcpkg_fixup_pkgconfig()
# Unused because SAIL_COMBINE_CODECS is On
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sail/sail-common/config.h" "#define SAIL_CODECS_PATH \"${CURRENT_PACKAGES_DIR}/lib/sail/codecs\"" "")
# Handle usage
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)