2018-10-17 21:51:09 +03:00
|
|
|
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
2023-10-14 02:28:34 +08:00
|
|
|
string(REPLACE "." "_" CRYPTOPP_VERSION "${VERSION}")
|
2018-10-17 21:51:09 +03:00
|
|
|
|
2018-03-29 20:57:32 +03:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH CMAKE_SOURCE_PATH
|
2022-11-10 02:27:04 +08:00
|
|
|
REPO abdes/cryptopp-cmake
|
2023-10-14 02:28:34 +08:00
|
|
|
REF "CRYPTOPP_${CRYPTOPP_VERSION}"
|
|
|
|
SHA512 3ec33b107ab627a514e1ebbc4b6522ee8552525f36730d9b5feb85e61ba7fc24fd36eb6050e328c6789ff60d47796beaa8eebf7dead787a34395294fae9bb733
|
2018-03-29 20:57:32 +03:00
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO weidai11/cryptopp
|
2023-10-14 02:28:34 +08:00
|
|
|
REF "CRYPTOPP_${CRYPTOPP_VERSION}"
|
|
|
|
SHA512 28a67141155c9c15e3e6a2173b3a8487cc38a2a2ade73bf4a09814ca541be6b06e9a501be26f7e2f42a2f80df21b076aa5d8ad4224dc0a1f8d7f3b24deae465e
|
2018-03-29 20:57:32 +03:00
|
|
|
HEAD_REF master
|
2024-09-08 21:05:11 +02:00
|
|
|
PATCHES
|
|
|
|
patch.patch
|
|
|
|
cryptopp.patch
|
2016-10-23 22:44:46 +02:00
|
|
|
)
|
2018-03-29 20:57:32 +03:00
|
|
|
|
2022-11-10 02:27:04 +08:00
|
|
|
file(COPY "${CMAKE_SOURCE_PATH}/cryptopp" DESTINATION "${SOURCE_PATH}")
|
|
|
|
file(COPY "${CMAKE_SOURCE_PATH}/cmake" DESTINATION "${SOURCE_PATH}")
|
|
|
|
file(COPY "${CMAKE_SOURCE_PATH}/test" DESTINATION "${SOURCE_PATH}")
|
|
|
|
file(COPY "${CMAKE_SOURCE_PATH}/cryptopp/cryptoppConfig.cmake" DESTINATION "${SOURCE_PATH}")
|
|
|
|
file(COPY "${CMAKE_SOURCE_PATH}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
2016-10-23 22:44:46 +02:00
|
|
|
|
2020-06-11 16:00:07 +08:00
|
|
|
if("pem-pack" IN_LIST FEATURES)
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH PEM_PACK_SOURCE_PATH
|
|
|
|
REPO noloader/cryptopp-pem
|
|
|
|
REF 095f08ff2ef9bca7b81036a59f2395e4f08ce2e8
|
|
|
|
SHA512 49912758a635faca1f49665ac9552b20576b46e0283aaabc19bb012bdc80586106452018e5088b9b46967717982ca6022ca968edc4cac96a7506d2b1a3e4bf13
|
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB PEM_PACK_FILES
|
|
|
|
${PEM_PACK_SOURCE_PATH}/*.h
|
|
|
|
${PEM_PACK_SOURCE_PATH}/*.cpp
|
|
|
|
)
|
2022-11-10 02:27:04 +08:00
|
|
|
file(INSTALL ${PEM_PACK_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}")
|
2020-06-11 16:00:07 +08:00
|
|
|
endif()
|
|
|
|
|
2021-05-06 21:54:57 +01:00
|
|
|
# disable assembly on ARM Windows to fix broken build
|
|
|
|
if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
|
2019-06-08 18:35:37 -07:00
|
|
|
set(CRYPTOPP_DISABLE_ASM "ON")
|
2022-10-21 18:36:03 -04:00
|
|
|
elseif(NOT DEFINED CRYPTOPP_DISABLE_ASM) # Allow disabling using a triplet file
|
2019-06-08 18:35:37 -07:00
|
|
|
set(CRYPTOPP_DISABLE_ASM "OFF")
|
|
|
|
endif()
|
|
|
|
|
2016-10-23 22:44:46 +02:00
|
|
|
# Dynamic linking should be avoided for Crypto++ to reduce the attack surface,
|
|
|
|
# so generate a static lib for both dynamic and static vcpkg targets.
|
|
|
|
# See also:
|
|
|
|
# https://www.cryptopp.com/wiki/Visual_Studio#Dynamic_Runtime_Linking
|
|
|
|
# https://www.cryptopp.com/wiki/Visual_Studio#The_DLL
|
|
|
|
|
2022-03-03 20:29:38 +00:00
|
|
|
vcpkg_cmake_configure(
|
2022-11-10 02:27:04 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2016-10-23 22:44:46 +02:00
|
|
|
OPTIONS
|
2023-01-05 04:22:36 +08:00
|
|
|
-DCRYPTOPP_SOURCES=${SOURCE_PATH}
|
2022-11-10 02:27:04 +08:00
|
|
|
-DCRYPTOPP_BUILD_SHARED=OFF
|
2016-10-23 22:44:46 +02:00
|
|
|
-DBUILD_STATIC=ON
|
2022-11-10 02:27:04 +08:00
|
|
|
-DCRYPTOPP_BUILD_TESTING=OFF
|
|
|
|
-DCRYPTOPP_BUILD_DOCUMENTATION=OFF
|
2019-06-08 18:35:37 -07:00
|
|
|
-DDISABLE_ASM=${CRYPTOPP_DISABLE_ASM}
|
2022-10-21 18:36:03 -04:00
|
|
|
-DUSE_INTERMEDIATE_OBJECTS_TARGET=OFF # Not required when we build static only
|
|
|
|
-DCMAKE_POLICY_DEFAULT_CMP0063=NEW # Honor "<LANG>_VISIBILITY_PRESET" properties
|
2022-11-10 02:27:04 +08:00
|
|
|
MAYBE_UNUSED_VARIABLES
|
|
|
|
BUILD_STATIC
|
|
|
|
USE_INTERMEDIATE_OBJECTS_TARGET
|
|
|
|
CMAKE_POLICY_DEFAULT_CMP0063
|
2016-10-23 22:44:46 +02:00
|
|
|
)
|
|
|
|
|
2022-11-10 02:27:04 +08:00
|
|
|
vcpkg_cmake_install()
|
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/cryptopp)
|
|
|
|
|
2022-12-17 03:32:12 +08:00
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
|
|
|
|
endif()
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
|
2022-11-10 02:27:04 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2016-10-23 22:44:46 +02:00
|
|
|
|
|
|
|
# There is no way to suppress installation of the headers and resource files in debug build.
|
2022-11-10 02:27:04 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
|
|
|
|
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
|
|
|
endif()
|
2016-10-23 22:44:46 +02:00
|
|
|
|
|
|
|
# Handle copyright
|
2022-11-10 02:27:04 +08:00
|
|
|
file(COPY "${SOURCE_PATH}/License.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/License.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright")
|