vcpkg/ports/libsodium/portfile.cmake

73 lines
1.9 KiB
CMake
Raw Normal View History

2017-10-18 07:25:58 +08:00
include(vcpkg_common_functions)
set(LIBSODIUM_VERSION 1.0.15)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
2017-10-18 07:25:58 +08:00
REPO jedisct1/libsodium
REF ${LIBSODIUM_VERSION}
SHA512 ec497cb0007597efaeae0aecaa7484d6dcc53367607ec3fd28a98c6209f0cdecd5a6f560c15badd3a69b8da7d63676b11fb395ef4ed4da9b80467dbdc5f65a72
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")
2017-10-18 07:43:54 +08:00
set(LIBSODIUM_RELEASE_CONFIGURATION ReleaseDLL)
set(LIBSODIUM_DEBUG_CONFIGURATION DebugDLL)
2017-10-18 07:25:58 +08:00
else()
2017-10-18 07:43:54 +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(
PROJECT_PATH ${SOURCE_PATH}/libsodium.vcxproj
RELEASE_CONFIGURATION ${LIBSODIUM_RELEASE_CONFIGURATION}
DEBUG_CONFIGURATION ${LIBSODIUM_DEBUG_CONFIGURATION}
)
IF(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSE()
SET(BUILD_ARCH ${VCPKG_TARGET_ARCHITECTURE})
ENDIF()
file(GLOB LIBSODIUM_HEADERS "${SOURCE_PATH}/src/libsodium/include/sodium/*.h")
file(INSTALL
${LIBSODIUM_HEADERS}
DESTINATION ${CURRENT_PACKAGES_DIR}/include/sodium
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
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
2017-10-18 07:49:05 +08:00
${SOURCE_PATH}/Build/${LIBSODIUM_RELEASE_CONFIGURATION}/${BUILD_ARCH}/libsodium.lib
2017-10-18 07:43:54 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
file(INSTALL
2017-10-18 07:49:05 +08:00
${SOURCE_PATH}/Build/${LIBSODIUM_DEBUG_CONFIGURATION}/${BUILD_ARCH}/libsodium.lib
2017-10-18 07:53:18 +08:00
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
2017-10-18 07:43:54 +08:00
${SOURCE_PATH}/LICENSE
DESTINATION ${CURRENT_PACKAGES_DIR}/share/libsodium
RENAME copyright
2017-10-18 07:25:58 +08:00
)