vcpkg/ports/libdatachannel/portfile.cmake
2023-09-13 15:41:59 -07:00

56 lines
1.7 KiB
CMake

set(PATCHES fix-for-vcpkg.patch)
if(VCPKG_TARGET_IS_UWP)
list(APPEND PATCHES uwp-warnings.patch)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO paullouisageneau/libdatachannel
REF "v${VERSION}"
SHA512 bcf58026612e2ae670911945f9f74660b513cbd38c9bae13e7b8acd41e545b5760ab4713c67b956e0bb8c0449491a5ab8e3f8d05e2468ff6540fc99e2540a105
HEAD_REF master
PATCHES
${PATCHES}
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
stdcall CAPI_STDCALL
INVERTED_FEATURES
ws NO_WEBSOCKET
srtp NO_MEDIA
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DUSE_SYSTEM_SRTP=ON
-DUSE_SYSTEM_JUICE=ON
-DNO_EXAMPLES=ON
-DNO_TESTS=ON
-DBUILD_STATIC_LIBS=${BUILD_STATIC}
-DBUILD_SHARED_LIBS=${BUILD_SHARED}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME LibDataChannel CONFIG_PATH lib/cmake/LibDataChannel)
vcpkg_fixup_pkgconfig()
file(READ "${CURRENT_PACKAGES_DIR}/share/LibDataChannel/LibDataChannelConfig.cmake" DATACHANNEL_CONFIG)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/LibDataChannel/LibDataChannelConfig.cmake" "
include(CMakeFindDependencyMacro)
find_dependency(Threads)
find_dependency(OpenSSL)
find_dependency(LibJuice)
${DATACHANNEL_CONFIG}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")