vcpkg/ports/libsodium/portfile.cmake

75 lines
2.0 KiB
CMake
Raw Normal View History

2017-10-18 07:25:58 +08:00
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
2017-10-18 07:25:58 +08:00
REPO jedisct1/libsodium
2018-02-22 22:22:12 +08:00
REF 1.0.16
SHA512 a9b5c4484f08f3ec1703a6c3af0acfa233214d0d38f32c1fc26305fc01cd2d9c8d469d52d98e6329729c08c15ee0494494037d5ad1472864d3cbdb55a751afec
2017-10-18 07:25:58 +08:00
HEAD_REF master
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/disable-tests.patch
)
2017-10-18 07:25:58 +08:00
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
2018-02-22 22:22:12 +08:00
set(LIBSODIUM_RELEASE_CONFIGURATION ReleaseDLL)
set(LIBSODIUM_DEBUG_CONFIGURATION DebugDLL)
2017-10-18 07:25:58 +08:00
else()
2018-02-22 22:22:12 +08:00
set(LIBSODIUM_RELEASE_CONFIGURATION Release)
set(LIBSODIUM_DEBUG_CONFIGURATION Debug)
2017-10-18 07:25:58 +08:00
endif()
2017-10-18 07:43:54 +08:00
vcpkg_build_msbuild(
2018-02-22 22:22:12 +08:00
PROJECT_PATH ${SOURCE_PATH}/libsodium.vcxproj
RELEASE_CONFIGURATION ${LIBSODIUM_RELEASE_CONFIGURATION}
DEBUG_CONFIGURATION ${LIBSODIUM_DEBUG_CONFIGURATION}
2017-10-18 07:43:54 +08:00
)
IF(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
2018-02-22 22:22:12 +08:00
SET(BUILD_ARCH "Win32")
2017-10-18 07:43:54 +08:00
ELSE()
2018-02-22 22:22:12 +08:00
SET(BUILD_ARCH ${VCPKG_TARGET_ARCHITECTURE})
2017-10-18 07:43:54 +08:00
ENDIF()
2018-03-08 09:38:30 +08:00
file(INSTALL
${SOURCE_PATH}/src/libsodium/include/sodium.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
2017-10-18 07:43:54 +08:00
file(GLOB LIBSODIUM_HEADERS "${SOURCE_PATH}/src/libsodium/include/sodium/*.h")
file(INSTALL
2018-02-22 22:22:12 +08:00
${LIBSODIUM_HEADERS}
DESTINATION ${CURRENT_PACKAGES_DIR}/include/sodium
2017-10-18 07:43:54 +08:00
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
2018-02-22 22:22:12 +08:00
file(INSTALL
${SOURCE_PATH}/Build/${LIBSODIUM_RELEASE_CONFIGURATION}/${BUILD_ARCH}/libsodium.dll
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(INSTALL
${SOURCE_PATH}/Build/${LIBSODIUM_DEBUG_CONFIGURATION}/${BUILD_ARCH}/libsodium.dll
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
)
endif()
2017-10-18 07:43:54 +08:00
file(INSTALL
2018-02-22 22:22:12 +08:00
${SOURCE_PATH}/Build/${LIBSODIUM_RELEASE_CONFIGURATION}/${BUILD_ARCH}/libsodium.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
2017-10-18 07:43:54 +08:00
)
file(INSTALL
2018-02-22 22:22:12 +08:00
${SOURCE_PATH}/Build/${LIBSODIUM_DEBUG_CONFIGURATION}/${BUILD_ARCH}/libsodium.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
2017-10-18 07:43:54 +08:00
)
vcpkg_copy_pdbs()
2017-10-18 07:25:58 +08:00
file(INSTALL
2018-02-22 22:22:12 +08:00
${SOURCE_PATH}/LICENSE
DESTINATION ${CURRENT_PACKAGES_DIR}/share/libsodium
RENAME copyright
2017-10-18 07:25:58 +08:00
)