From cf3046f3a155639e6ee7baad60e7ebb9916b9bd7 Mon Sep 17 00:00:00 2001 From: Letu Ren Date: Thu, 30 Nov 2023 11:10:19 +0800 Subject: [PATCH] [libspng]: New port --- ports/libspng/portfile.cmake | 31 +++++++++++++++++++++++++++++++ ports/libspng/usage | 4 ++++ ports/libspng/vcpkg.json | 18 ++++++++++++++++++ versions/baseline.json | 4 ++++ versions/l-/libspng.json | 9 +++++++++ 5 files changed, 66 insertions(+) create mode 100644 ports/libspng/portfile.cmake create mode 100644 ports/libspng/usage create mode 100644 ports/libspng/vcpkg.json create mode 100644 versions/l-/libspng.json diff --git a/ports/libspng/portfile.cmake b/ports/libspng/portfile.cmake new file mode 100644 index 00000000000000..e70d623284e350 --- /dev/null +++ b/ports/libspng/portfile.cmake @@ -0,0 +1,31 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO randy408/libspng + REF "v${VERSION}" + SHA512 cd729653599ed97f80d19f3048c1b3bc2ac16f922b3465804b1913bc45d9fc8b28b56bc2121fda36e9d3dcdd12612cced5383313b722a5342b613f8781879f1a + HEAD_REF master +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SPNG_BUILD_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SPNG_BUILD_SHARED) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSPNG_STATIC=${SPNG_BUILD_STATIC} + -DSPNG_SHARED=${SPNG_BUILD_SHARED} + -DBUILD_EXAMPLES=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/spng PACKAGE_NAME spng) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/libspng/usage b/ports/libspng/usage new file mode 100644 index 00000000000000..e1623a70f5f7d8 --- /dev/null +++ b/ports/libspng/usage @@ -0,0 +1,4 @@ +libspng provides CMake targets: + + find_package(spng CONFIG REQUIRED) + target_link_libraries(main PRIVATE spng::spng) diff --git a/ports/libspng/vcpkg.json b/ports/libspng/vcpkg.json new file mode 100644 index 00000000000000..ce125080115d04 --- /dev/null +++ b/ports/libspng/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "libspng", + "version": "0.7.4", + "description": "Simple, modern libpng alternative", + "homepage": "https://github.com/randy408/libspng", + "license": "BSD-2-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index ae8f2e94d63848..fcca55f7197e1c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4832,6 +4832,10 @@ "baseline": "0.2.3", "port-version": 2 }, + "libspng": { + "baseline": "0.7.4", + "port-version": 0 + }, "libsquish": { "baseline": "1.15", "port-version": 13 diff --git a/versions/l-/libspng.json b/versions/l-/libspng.json new file mode 100644 index 00000000000000..1f390457098d01 --- /dev/null +++ b/versions/l-/libspng.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "8efb5a57f5115864001d6eddad855e2958f14fee", + "version": "0.7.4", + "port-version": 0 + } + ] +}