2019-11-20 03:19:51 +08:00
|
|
|
# Download the apng patch
|
2022-04-19 05:33:43 +08:00
|
|
|
set(LIBPNG_APNG_PATCH_PATH "")
|
|
|
|
set(LIBPNG_APNG_OPTION "")
|
2019-11-20 03:19:51 +08:00
|
|
|
if ("apng" IN_LIST FEATURES)
|
2022-04-19 05:33:43 +08:00
|
|
|
if(VCPKG_HOST_IS_WINDOWS)
|
|
|
|
# Get (g)awk and gzip installed
|
|
|
|
vcpkg_acquire_msys(MSYS_ROOT PACKAGES gawk gzip)
|
|
|
|
set(AWK_EXE_PATH "${MSYS_ROOT}/usr/bin")
|
|
|
|
vcpkg_add_to_path("${AWK_EXE_PATH}")
|
|
|
|
endif()
|
2020-10-14 04:48:57 +08:00
|
|
|
|
2022-11-12 04:24:53 +08:00
|
|
|
set(LIBPNG_APNG_PATCH_NAME "libpng-${VERSION}-apng.patch")
|
2022-04-19 05:33:43 +08:00
|
|
|
vcpkg_download_distfile(LIBPNG_APNG_PATCH_ARCHIVE
|
2022-11-12 04:24:53 +08:00
|
|
|
URLS "https://downloads.sourceforge.net/project/libpng-apng/libpng16/${VERSION}/${LIBPNG_APNG_PATCH_NAME}.gz"
|
2022-04-19 05:33:43 +08:00
|
|
|
FILENAME "${LIBPNG_APNG_PATCH_NAME}.gz"
|
2023-11-22 10:24:19 +08:00
|
|
|
SHA512 373cc9f0df15f7c77c0a59ddaac22374cfae37174b63a642e68e3a17a6d0bb1015399d771998c7eb6b356b634f157f0009743f4cc659f3b8e480a9533010ef9c
|
2022-04-19 05:33:43 +08:00
|
|
|
)
|
|
|
|
set(LIBPNG_APNG_PATCH_PATH "${CURRENT_BUILDTREES_DIR}/src/${LIBPNG_APNG_PATCH_NAME}")
|
|
|
|
if (NOT EXISTS "${LIBPNG_APNG_PATCH_PATH}")
|
|
|
|
file(INSTALL "${LIBPNG_APNG_PATCH_ARCHIVE}" DESTINATION "${CURRENT_BUILDTREES_DIR}/src")
|
2019-11-20 03:19:51 +08:00
|
|
|
vcpkg_execute_required_process(
|
2022-04-19 05:33:43 +08:00
|
|
|
COMMAND gzip -d "${LIBPNG_APNG_PATCH_NAME}.gz"
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src"
|
|
|
|
ALLOW_IN_DOWNLOAD_MODE
|
2019-11-20 03:19:51 +08:00
|
|
|
LOGNAME extract-patch.log
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
set(LIBPNG_APNG_OPTION "-DPNG_PREFIX=a")
|
|
|
|
endif()
|
|
|
|
|
2017-11-07 14:05:04 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO glennrp/libpng
|
2022-11-12 04:24:53 +08:00
|
|
|
REF v${VERSION}
|
2023-11-22 10:24:19 +08:00
|
|
|
SHA512 5f36a145c7d41f1c417d5f4e03be0155dae3499d72e67170acaad92c1af418c0bb6bc508e9b4b27ef4206bf0074cbf74978bade3bff28bc291867b8f8c2a38cf
|
2017-11-07 14:05:04 +08:00
|
|
|
HEAD_REF master
|
2017-04-08 02:23:59 +08:00
|
|
|
PATCHES
|
2022-04-19 05:33:43 +08:00
|
|
|
"${LIBPNG_APNG_PATCH_PATH}"
|
2019-12-24 07:26:04 +08:00
|
|
|
cmake.patch
|
2020-11-13 06:25:03 +08:00
|
|
|
fix-export-targets.patch
|
2024-01-04 09:38:33 +08:00
|
|
|
libm.patch
|
2022-04-19 05:33:43 +08:00
|
|
|
pkgconfig.patch
|
2022-08-30 04:40:31 +08:00
|
|
|
fix-msa-support-for-mips.patch
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
|
|
|
|
2022-04-19 05:33:43 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PNG_SHARED)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PNG_STATIC)
|
2016-10-07 04:15:43 +08:00
|
|
|
|
2022-04-19 05:33:43 +08:00
|
|
|
vcpkg_list(SET LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION)
|
2021-06-10 06:47:58 +08:00
|
|
|
if(VCPKG_TARGET_IS_IOS)
|
2022-04-19 05:33:43 +08:00
|
|
|
vcpkg_list(APPEND LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_HARDWARE_OPTIMIZATIONS=OFF")
|
Add initial iOS support (#6275)
* Add iOS community triplets and toolchain support
Added an iOS toolchain to enable building packages for iOS.
The toolchain is used when a triplet's VCPKG_CMAKE_SYSTEM_NAME is set
to iOS.
To configure which architecture should be built, as well as other
iOS specifics, the following triplet variables can be set:
- VCPKG_TARGET_ARCHITECTURE
- VCPKG_OSX_SYSROOT
- VCPKG_OSX_DEPLOYMENT_TARGET
- VCPKG_OSX_ARCHITECTURES
The following VCPKG_TARGET_ARCHITECTURE values are currently
supported:
- arm, arm64, x64, x86.
The following VCPKG_OSX_SYSROOT values are currently supported:
- iphoneos, iphonesimulator, or an absolute path to the device or
simulator Xcode SDK.
VCPKG_OSX_DEPLOYMENT_TARGET can be set to control the minimum iOS
delopyment target for the built libraries.
CMAKE_OSX_ARCHITECTURES is derived from VCPKG_TARGET_ARCHITECTURE,
so generally it should not be set. In case if someone needs to target
a more specific architecture (like armv7k or arm64e), it can
be set in the triplet via VCPKG_OSX_ARCHITECTURES.
Note that only certain combinations of the architecture and sysroot
will work: simulator SDKs only provide x86-based libraries, etc.
The toolchain also sets CMAKE_SYSTEM_PROCESSOR for certain
configurations, because certain packages (like libpng) depend on the
processor type.
Added 4 community iOS triplets that build static libraries:
- arm-ios, arm64-ios, x86-ios, x64-ios.
The non-arm triplets target the iOS simulator.
The triplets build static libraries because they are easiest to
integrate into an iOS project. Dynamic libraries or frameworks require
code signing on iOS, which complicates integration.
Added heuristics to try and automatically detect what iOS triplet to
use when building your own CMake project (so when a CMake project sets
CMAKE_TOOLCHAIN_FILE to buildsystems/vcpkg.cmake), if no explicit
triplet is provided (VCPKG_TARGET_TRIPLET is undefined).
The heuristic checks for the values of CMAKE_SYSTEM_NAME and
CMAKE_OSX_ARCHITECTURES. Note that for this to work,
CMAKE_OSX_ARCHITECTURES needs to be set before the first project()
call in your CMake project.
Added workaround so find_package finds vcpkg installed packages
when targeting iOS.
This is done by saving / restoring the value of CMAKE_FIND_ROOT_PATH
while also adding the vcpkg package root in the find_package override
macro.
The workaround can be removed once vcpkg upgrades to CMake 3.15.0
or higher where the issue is fixed.
Fixes: #6003
* Fix building libpng and pcre2 targetting iOS
Fixes: #6003
2020-04-16 04:06:55 +08:00
|
|
|
endif()
|
|
|
|
|
2022-04-19 05:33:43 +08:00
|
|
|
vcpkg_list(SET LD_VERSION_SCRIPT_OPTION)
|
2021-06-10 06:47:58 +08:00
|
|
|
if(VCPKG_TARGET_IS_ANDROID)
|
2022-04-19 05:33:43 +08:00
|
|
|
vcpkg_list(APPEND LD_VERSION_SCRIPT_OPTION "-Dld-version-script=OFF")
|
2022-12-01 01:29:15 +08:00
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
2023-03-20 14:17:54 +08:00
|
|
|
vcpkg_cmake_get_vars(cmake_vars_file)
|
|
|
|
include("${cmake_vars_file}")
|
|
|
|
if(VCPKG_DETECTED_CMAKE_ANDROID_ARM_NEON)
|
|
|
|
vcpkg_list(APPEND LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_ARM_NEON=on")
|
|
|
|
else()
|
|
|
|
# for armeabi-v7a, check whether NEON is available
|
|
|
|
vcpkg_list(APPEND LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_ARM_NEON=check")
|
|
|
|
endif()
|
2022-12-01 01:29:15 +08:00
|
|
|
endif()
|
2020-05-14 01:25:33 +08:00
|
|
|
endif()
|
|
|
|
|
2021-06-10 06:47:58 +08:00
|
|
|
vcpkg_cmake_configure(
|
2022-04-19 05:33:43 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2016-09-19 11:50:08 +08:00
|
|
|
OPTIONS
|
2019-11-20 03:19:51 +08:00
|
|
|
${LIBPNG_APNG_OPTION}
|
Add initial iOS support (#6275)
* Add iOS community triplets and toolchain support
Added an iOS toolchain to enable building packages for iOS.
The toolchain is used when a triplet's VCPKG_CMAKE_SYSTEM_NAME is set
to iOS.
To configure which architecture should be built, as well as other
iOS specifics, the following triplet variables can be set:
- VCPKG_TARGET_ARCHITECTURE
- VCPKG_OSX_SYSROOT
- VCPKG_OSX_DEPLOYMENT_TARGET
- VCPKG_OSX_ARCHITECTURES
The following VCPKG_TARGET_ARCHITECTURE values are currently
supported:
- arm, arm64, x64, x86.
The following VCPKG_OSX_SYSROOT values are currently supported:
- iphoneos, iphonesimulator, or an absolute path to the device or
simulator Xcode SDK.
VCPKG_OSX_DEPLOYMENT_TARGET can be set to control the minimum iOS
delopyment target for the built libraries.
CMAKE_OSX_ARCHITECTURES is derived from VCPKG_TARGET_ARCHITECTURE,
so generally it should not be set. In case if someone needs to target
a more specific architecture (like armv7k or arm64e), it can
be set in the triplet via VCPKG_OSX_ARCHITECTURES.
Note that only certain combinations of the architecture and sysroot
will work: simulator SDKs only provide x86-based libraries, etc.
The toolchain also sets CMAKE_SYSTEM_PROCESSOR for certain
configurations, because certain packages (like libpng) depend on the
processor type.
Added 4 community iOS triplets that build static libraries:
- arm-ios, arm64-ios, x86-ios, x64-ios.
The non-arm triplets target the iOS simulator.
The triplets build static libraries because they are easiest to
integrate into an iOS project. Dynamic libraries or frameworks require
code signing on iOS, which complicates integration.
Added heuristics to try and automatically detect what iOS triplet to
use when building your own CMake project (so when a CMake project sets
CMAKE_TOOLCHAIN_FILE to buildsystems/vcpkg.cmake), if no explicit
triplet is provided (VCPKG_TARGET_TRIPLET is undefined).
The heuristic checks for the values of CMAKE_SYSTEM_NAME and
CMAKE_OSX_ARCHITECTURES. Note that for this to work,
CMAKE_OSX_ARCHITECTURES needs to be set before the first project()
call in your CMake project.
Added workaround so find_package finds vcpkg installed packages
when targeting iOS.
This is done by saving / restoring the value of CMAKE_FIND_ROOT_PATH
while also adding the vcpkg package root in the find_package override
macro.
The workaround can be removed once vcpkg upgrades to CMake 3.15.0
or higher where the issue is fixed.
Fixes: #6003
* Fix building libpng and pcre2 targetting iOS
Fixes: #6003
2020-04-16 04:06:55 +08:00
|
|
|
${LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION}
|
2020-05-14 01:25:33 +08:00
|
|
|
${LD_VERSION_SCRIPT_OPTION}
|
2022-04-19 05:33:43 +08:00
|
|
|
-DPNG_STATIC=${PNG_STATIC}
|
|
|
|
-DPNG_SHARED=${PNG_SHARED}
|
2016-09-19 11:50:08 +08:00
|
|
|
-DPNG_TESTS=OFF
|
|
|
|
-DSKIP_INSTALL_PROGRAMS=ON
|
|
|
|
-DSKIP_INSTALL_EXECUTABLES=ON
|
2020-07-25 02:39:21 +08:00
|
|
|
-DSKIP_INSTALL_FILES=OFF
|
|
|
|
OPTIONS_DEBUG
|
|
|
|
-DSKIP_INSTALL_HEADERS=ON
|
2022-04-19 05:33:43 +08:00
|
|
|
MAYBE_UNUSED_VARIABLES
|
|
|
|
PNG_ARM_NEON
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
2021-06-10 06:47:58 +08:00
|
|
|
vcpkg_cmake_install()
|
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/libpng)
|
2022-06-14 07:25:35 +08:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/png")
|
2022-04-19 05:33:43 +08:00
|
|
|
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" "-lpng16" "-llibpng16d")
|
|
|
|
file(INSTALL "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" RENAME "libpng.pc")
|
2020-07-25 02:39:21 +08:00
|
|
|
endif()
|
2022-04-19 05:33:43 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpng16.pc" "-lpng16" "-llibpng16")
|
|
|
|
elseif(NOT VCPKG_BUILD_TYPE)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" "-lpng16" "-lpng16d")
|
|
|
|
file(INSTALL "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng16.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" RENAME "libpng.pc")
|
2020-07-25 02:39:21 +08:00
|
|
|
endif()
|
2022-04-19 05:33:43 +08:00
|
|
|
file(INSTALL "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpng16.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig" RENAME "libpng.pc")
|
2019-11-26 07:57:43 +08:00
|
|
|
|
2016-11-01 03:34:04 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2021-11-10 03:48:24 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
2022-04-19 05:33:43 +08:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2023-11-22 10:24:19 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|