2016-10-24 04:44:46 +08:00
|
|
|
include(vcpkg_common_functions)
|
2018-03-30 01:57:32 +08:00
|
|
|
|
2018-10-18 02:51:09 +08:00
|
|
|
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
|
|
|
|
2018-03-30 01:57:32 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH CMAKE_SOURCE_PATH
|
|
|
|
REPO noloader/cryptopp-cmake
|
2019-08-23 23:29:41 +08:00
|
|
|
REF 6d0666c457fbbf6f81819fd2b80f0cb5b6646593
|
|
|
|
SHA512 0341f14ce734afaee8bcc1db1716684f241499c692a5478c83a3df3fd2e5331cd04b2f4f51d43cce231ca1d9fbe76220639573c05ef06be0cf33081a1ef7ab30
|
2018-03-30 01:57:32 +08:00
|
|
|
HEAD_REF master
|
2018-10-18 02:51:09 +08:00
|
|
|
PATCHES
|
|
|
|
cmake.patch
|
2018-03-30 01:57:32 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO weidai11/cryptopp
|
2019-08-23 23:29:41 +08:00
|
|
|
REF CRYPTOPP_8_2_0
|
|
|
|
SHA512 d2dcc107091d00800de243abdce8286ccd7fcc5707eebf88b97675456a021e62002e942b862db0465f72142951f631c0c1f0b2ba56028b96461780a17f2dfdf9
|
2018-03-30 01:57:32 +08:00
|
|
|
HEAD_REF master
|
2018-10-18 02:51:09 +08:00
|
|
|
PATCHES patch.patch
|
2016-10-24 04:44:46 +08:00
|
|
|
)
|
2018-03-30 01:57:32 +08:00
|
|
|
|
|
|
|
file(COPY ${CMAKE_SOURCE_PATH}/cryptopp-config.cmake DESTINATION ${SOURCE_PATH})
|
|
|
|
file(COPY ${CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
2016-10-24 04:44:46 +08:00
|
|
|
|
2020-01-23 04:44:54 +08:00
|
|
|
# disable assembly on OSX and ARM Windows to fix broken build
|
|
|
|
if (VCPKG_TARGET_IS_OSX)
|
|
|
|
set(CRYPTOPP_DISABLE_ASM "ON")
|
|
|
|
elseif (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
|
2019-06-09 09:35:37 +08:00
|
|
|
set(CRYPTOPP_DISABLE_ASM "ON")
|
|
|
|
else()
|
|
|
|
set(CRYPTOPP_DISABLE_ASM "OFF")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2016-10-24 04:44:46 +08: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
|
|
|
|
|
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2018-03-30 01:57:32 +08:00
|
|
|
PREFER_NINJA
|
2016-10-24 04:44:46 +08:00
|
|
|
OPTIONS
|
|
|
|
-DBUILD_SHARED=OFF
|
|
|
|
-DBUILD_STATIC=ON
|
|
|
|
-DBUILD_TESTING=OFF
|
|
|
|
-DBUILD_DOCUMENTATION=OFF
|
2019-06-09 09:35:37 +08:00
|
|
|
-DDISABLE_ASM=${CRYPTOPP_DISABLE_ASM}
|
2016-10-24 04:44:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
2018-03-30 01:57:32 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/cryptopp)
|
2016-10-24 04:44:46 +08:00
|
|
|
|
|
|
|
# There is no way to suppress installation of the headers and resource files in debug build.
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
|
|
|
|
# Handle copyright
|
|
|
|
file(COPY ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cryptopp)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/cryptopp/License.txt ${CURRENT_PACKAGES_DIR}/share/cryptopp/copyright)
|