From 104e21997b2cf339a583a0c6ed63d43e7b92ae57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 21 Jan 2025 21:34:16 +0100 Subject: [PATCH 1/2] [oscpack] add new port (#43290) Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> --- ports/oscpack/add-cmake-install-target.patch | 51 ++++++++++++++++++++ ports/oscpack/link-ws2_32-and-winmm.patch | 25 ++++++++++ ports/oscpack/portfile.cmake | 31 ++++++++++++ ports/oscpack/usage | 10 ++++ ports/oscpack/vcpkg.json | 18 +++++++ versions/baseline.json | 4 ++ versions/o-/oscpack.json | 9 ++++ 7 files changed, 148 insertions(+) create mode 100644 ports/oscpack/add-cmake-install-target.patch create mode 100644 ports/oscpack/link-ws2_32-and-winmm.patch create mode 100644 ports/oscpack/portfile.cmake create mode 100644 ports/oscpack/usage create mode 100644 ports/oscpack/vcpkg.json create mode 100644 versions/o-/oscpack.json diff --git a/ports/oscpack/add-cmake-install-target.patch b/ports/oscpack/add-cmake-install-target.patch new file mode 100644 index 00000000000000..569583be9f1d5b --- /dev/null +++ b/ports/oscpack/add-cmake-install-target.patch @@ -0,0 +1,51 @@ +From 3a7ee65ecf43b97cc4a8c7cea5493de0d2b992fa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= +Date: Wed, 15 Jan 2025 07:58:23 +0100 +Subject: [PATCH] Add cmake install target + +--- + CMakeLists.txt | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e8bef70..4f200b2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,6 +42,34 @@ osc/OscOutboundPacketStream.cpp + + ) + ++set(IP_HEADERS ++ ip/IpEndpointName.h ++ ip/NetworkingUtils.h ++ ip/PacketListener.h ++ ip/TimerListener.h ++ ip/UdpSocket.h ++) ++ ++ ++set(OSC_HEADERS ++ osc/MessageMappingOscPacketListener.h ++ osc/OscException.h ++ osc/OscHostEndianness.h ++ osc/OscOutboundPacketStream.h ++ osc/OscPacketListener.h ++ osc/OscPrintReceivedElements.h ++ osc/OscReceivedElements.h ++ osc/OscTypes.h ++) ++ ++INSTALL(TARGETS oscpack ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++ ++INSTALL(FILES ${IP_HEADERS} DESTINATION include/ip) ++INSTALL(FILES ${OSC_HEADERS} DESTINATION include/osc) + + ADD_EXECUTABLE(OscUnitTests tests/OscUnitTests.cpp) + TARGET_LINK_LIBRARIES(OscUnitTests oscpack ${LIBS}) +-- +2.34.1 + diff --git a/ports/oscpack/link-ws2_32-and-winmm.patch b/ports/oscpack/link-ws2_32-and-winmm.patch new file mode 100644 index 00000000000000..e4f51c626b40c9 --- /dev/null +++ b/ports/oscpack/link-ws2_32-and-winmm.patch @@ -0,0 +1,25 @@ +From d2a920a78f3b29df26d8e1e8ca6a0e93260999db Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= +Date: Wed, 15 Jan 2025 21:56:46 +0100 +Subject: [PATCH] link Ws2_32 and winmm + +--- + CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1fc1fbe..1b3c4aa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,6 +43,8 @@ osc/OscOutboundPacketStream.cpp + + ) + ++TARGET_LINK_LIBRARIES(oscpack PRIVATE ${LIBS}) ++ + set(IP_HEADERS + ip/IpEndpointName.h + ip/NetworkingUtils.h +-- +2.34.1 + diff --git a/ports/oscpack/portfile.cmake b/ports/oscpack/portfile.cmake new file mode 100644 index 00000000000000..06cc79b8a2730d --- /dev/null +++ b/ports/oscpack/portfile.cmake @@ -0,0 +1,31 @@ +if (VCPKG_TARGET_IS_WINDOWS) + # This can (and should) be removed if oscpack ever supports dynamically linking on Windows + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO RossBencina/oscpack + REF release_1_1_0 + SHA512 7a61a364cab4914c81e113d7aeee2b4accf5e560f500df6634232e0093f564ed4bb0ef8e87d2c8a18f245b0c7ec25f41e64f42f20a6654c22bb5c02aa253bbd0 + PATCHES + add-cmake-install-target.patch + link-ws2_32-and-winmm.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_build() + +vcpkg_cmake_install() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# Handle copyright +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + diff --git a/ports/oscpack/usage b/ports/oscpack/usage new file mode 100644 index 00000000000000..2f318be127a6d3 --- /dev/null +++ b/ports/oscpack/usage @@ -0,0 +1,10 @@ +oscpack can be used from CMake via: + + find_path(OSCPACK_INCLUDE_DIRS "osc" PATH_SUFFIXES "oscpack") + find_library(OSCPACK_LIBRARY oscpack REQUIRED) + target_include_directories(main PRIVATE ${OSCPACK_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE ${OSCPACK_LIBRARY}) + +In case of Windows static link in addition: + + target_link_libraries(main PRIVATE ws2_32 winmm) diff --git a/ports/oscpack/vcpkg.json b/ports/oscpack/vcpkg.json new file mode 100644 index 00000000000000..beb1274f171f4e --- /dev/null +++ b/ports/oscpack/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "oscpack", + "version": "1.1.0", + "description": "A simple C++ Open Sound Control (OSC) packet manipulation library", + "homepage": "http://www.rossbencina.com/code/oscpack", + "license": null, + "supports": "!(windows & !static)", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 194d06f99df9f6..277e9280ad0dac 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6308,6 +6308,10 @@ "baseline": "1.5.1", "port-version": 0 }, + "oscpack": { + "baseline": "1.1.0", + "port-version": 0 + }, "osg": { "baseline": "3.6.5", "port-version": 22 diff --git a/versions/o-/oscpack.json b/versions/o-/oscpack.json new file mode 100644 index 00000000000000..519b6bc4ad2636 --- /dev/null +++ b/versions/o-/oscpack.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "fb55144b36990517045fd8a9c7898d464b76ca21", + "version": "1.1.0", + "port-version": 0 + } + ] +} From f5d1f9a10c8542a1dddcb3c84c4e358ac82e76dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 29 Jan 2025 23:04:21 +0100 Subject: [PATCH 2/2] Add oscpack to the manifest and link static on windows --- overlay/triplets/x64-windows.cmake | 11 +++++++++++ vcpkg.json | 1 + 2 files changed, 12 insertions(+) create mode 100644 overlay/triplets/x64-windows.cmake diff --git a/overlay/triplets/x64-windows.cmake b/overlay/triplets/x64-windows.cmake new file mode 100644 index 00000000000000..9d621af6e0d273 --- /dev/null +++ b/overlay/triplets/x64-windows.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) + +# Oscpack does not allow dynamic linking on Windows +# because of missing __declspec(dllexport) decorations +if(${PORT} MATCHES "oscpack") + set(VCPKG_LIBRARY_LINKAGE static) +else() + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + diff --git a/vcpkg.json b/vcpkg.json index b07524ecc8e78b..3f4f6aebcf3cc4 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -68,6 +68,7 @@ "ms-gsl", "opus", "opusfile", + "oscpack", { "name": "portaudio", "features": ["asio"]