diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/udt | |
Diffstat (limited to 'vcpkg/ports/udt')
| -rw-r--r-- | vcpkg/ports/udt/CMakeLists.txt | 35 | ||||
| -rw-r--r-- | vcpkg/ports/udt/fix_defs.patch | 79 | ||||
| -rw-r--r-- | vcpkg/ports/udt/portfile.cmake | 23 | ||||
| -rw-r--r-- | vcpkg/ports/udt/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/udt/vcpkg.json | 18 |
5 files changed, 159 insertions, 0 deletions
diff --git a/vcpkg/ports/udt/CMakeLists.txt b/vcpkg/ports/udt/CMakeLists.txt new file mode 100644 index 0000000..527200c --- /dev/null +++ b/vcpkg/ports/udt/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(udt LANGUAGES CXX) + +include(GNUInstallDirs) + +file(GLOB UDT_HEADERS "src/*.h") +file(GLOB UDT_SOURCES "src/*.cpp") + +add_library(udt ${UDT_HEADERS} ${UDT_SOURCES}) +if(WIN32) + target_compile_definitions(udt PRIVATE -DWIN32) + if(MSVC) + target_compile_definitions(udt PRIVATE -DUDT_EXPORTS) + endif() + target_link_libraries(udt PRIVATE ws2_32) +elseif(UNIX AND NOT APPLE) + target_compile_definitions(udt PRIVATE -DLINUX) +elseif(APPLE) + target_compile_definitions(udt PRIVATE -DOSX) +endif() +target_include_directories(udt PUBLIC + "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/udt>") + +install(TARGETS udt EXPORT unofficial-udt) + +install( + EXPORT unofficial-udt + FILE unofficial-udt-config.cmake + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/unofficial-udt" + NAMESPACE unofficial::udt:: +) + +install(FILES ${UDT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/udt") diff --git a/vcpkg/ports/udt/fix_defs.patch b/vcpkg/ports/udt/fix_defs.patch new file mode 100644 index 0000000..31a0d96 --- /dev/null +++ b/vcpkg/ports/udt/fix_defs.patch @@ -0,0 +1,79 @@ +diff --git a/src/api.h b/src/api.h +index 24f1a02..db7b729 100644 +--- a/src/api.h ++++ b/src/api.h +@@ -216,3 +216,3 @@ private: + pthread_key_t m_TLSError; // thread local error record (last error) +- #ifndef WIN32 ++ #ifndef _WIN32 + static void TLSDestroy(void* e) {if (NULL != e) delete (CUDTException*)e;} +@@ -248,3 +248,3 @@ private: + pthread_t m_GCThread; +- #ifndef WIN32 ++ #ifndef _WIN32 + static void* garbageCollect(void*); +diff --git a/src/common.h b/src/common.h +index 3782d61..205b090 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -44,3 +44,3 @@ written by + +-#ifndef WIN32 ++#ifndef _WIN32 + #include <sys/time.h> +@@ -55,3 +55,3 @@ written by + +-#ifdef WIN32 ++#ifdef _WIN32 + // Windows compability +diff --git a/src/packet.h b/src/packet.h +index 76cc951..216505a 100644 +--- a/src/packet.h ++++ b/src/packet.h +@@ -46,3 +46,3 @@ written by + +-#ifdef WIN32 ++#ifdef _WIN32 + struct iovec +diff --git a/src/queue.h b/src/queue.h +index 9feff18..1062a0c 100644 +--- a/src/queue.h ++++ b/src/queue.h +@@ -399,3 +399,3 @@ public: + private: +-#ifndef WIN32 ++#ifndef _WIN32 + static void* worker(void* param); +@@ -459,3 +459,3 @@ public: + private: +-#ifndef WIN32 ++#ifndef _WIN32 + static void* worker(void* param); +diff --git a/src/udt.h b/src/udt.h +index 6436363..8e00091 100644 +--- a/src/udt.h ++++ b/src/udt.h +@@ -44,3 +44,3 @@ written by + +-#ifndef WIN32 ++#ifndef _WIN32 + #include <sys/types.h> +@@ -70,3 +70,3 @@ written by + +-#ifdef WIN32 ++#ifdef _WIN32 + #ifndef __MINGW__ +@@ -97,3 +97,3 @@ written by + +-#ifdef WIN32 ++#ifdef _WIN32 + #ifndef __MINGW__ +diff --git a/src/window.h b/src/window.h +index f118a26..565aeb6 100644 +--- a/src/window.h ++++ b/src/window.h +@@ -44,3 +44,3 @@ written by + +-#ifndef WIN32 ++#ifndef _WIN32 + #include <sys/time.h> diff --git a/vcpkg/ports/udt/portfile.cmake b/vcpkg/ports/udt/portfile.cmake new file mode 100644 index 0000000..556b3b6 --- /dev/null +++ b/vcpkg/ports/udt/portfile.cmake @@ -0,0 +1,23 @@ +vcpkg_from_sourceforge( + OUT_SOURCE_PATH SOURCE_PATH + REPO udt/udt + REF "${VERSION}" + FILENAME "udt.sdk.${VERSION}.tar.gz" + SHA512 fc555ce1ddde2a8bd92c8adf470fd69a9a35d0a679def32b6ddbb18d67dc8b7d9dd928d772dc8598f08b350130f1e90bb4be58c46252a0a79ecc99f61eca8a92 + PATCHES + fix_defs.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-udt) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/vcpkg/ports/udt/usage b/vcpkg/ports/udt/usage new file mode 100644 index 0000000..f9fdbd8 --- /dev/null +++ b/vcpkg/ports/udt/usage @@ -0,0 +1,4 @@ +udt provides CMake targets: + + find_package(unofficial-udt CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::udt::udt) diff --git a/vcpkg/ports/udt/vcpkg.json b/vcpkg/ports/udt/vcpkg.json new file mode 100644 index 0000000..a81edec --- /dev/null +++ b/vcpkg/ports/udt/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "udt", + "version": "4.11", + "description": "UDT is a reliable UDP based application level data transport protocol for distributed data intensive applications over wide area high-speed networks.", + "homepage": "https://udt.sourceforge.io/", + "license": null, + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |