vcpkg/ports/pcre2/portfile.cmake

58 lines
2.1 KiB
CMake
Raw Normal View History

2017-08-16 19:10:49 +08:00
set(PCRE2_VERSION 10.30)
2017-03-16 07:35:24 +08:00
include(vcpkg_common_functions)
2017-03-16 07:35:24 +08:00
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.pcre.org/pub/pcre/pcre2-${PCRE2_VERSION}.zip" "https://sourceforge.net/projects/pcre/files/pcre2/${PCRE2_VERSION}/pcre2-${PCRE2_VERSION}.zip/download"
2017-08-16 19:10:49 +08:00
FILENAME "pcre2-${PCRE2_VERSION}.zip"
SHA512 03e570b946ac29498a114b27e715a0fcf25702bfc9623f9fc085ee8a3214ab3c303baccb9c0af55da6916e8ce40d931d97f1ee9628690563041a943f0aa2bc54)
2017-03-16 07:35:24 +08:00
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES fix-space.patch
2019-10-30 14:25:56 +08:00
fix-arm64-config.patch
fix-uwp.patch
)
2017-03-16 07:35:24 +08:00
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
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(JIT OFF)
else()
set(JIT ON)
endif()
2017-03-16 07:35:24 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DPCRE2_BUILD_PCRE2_8=ON
-DPCRE2_BUILD_PCRE2_16=ON
-DPCRE2_BUILD_PCRE2_32=ON
-DPCRE2_SUPPORT_JIT=${JIT}
2017-03-16 07:35:24 +08:00
-DPCRE2_SUPPORT_UNICODE=ON
-DPCRE2_BUILD_TESTS=OFF
-DPCRE2_BUILD_PCRE2GREP=OFF)
vcpkg_install_cmake()
file(READ ${CURRENT_PACKAGES_DIR}/include/pcre2.h PCRE2_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(REPLACE "defined(PCRE2_STATIC)" "1" PCRE2_H "${PCRE2_H}")
else()
string(REPLACE "defined(PCRE2_STATIC)" "0" PCRE2_H "${PCRE2_H}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/pcre2.h "${PCRE2_H}")
# don't install POSIX wrapper
file(REMOVE ${CURRENT_PACKAGES_DIR}/include/pcre2posix.h)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/pcre2-posix.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pcre2-posixd.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/pcre2-posix.dll ${CURRENT_PACKAGES_DIR}/debug/bin/pcre2-posixd.dll)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/man)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/man)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
2019-10-30 14:25:56 +08:00
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)