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/slikenet | |
Diffstat (limited to 'vcpkg/ports/slikenet')
| -rw-r--r-- | vcpkg/ports/slikenet/fix-emscripten.patch | 208 | ||||
| -rw-r--r-- | vcpkg/ports/slikenet/fix-install.patch | 51 | ||||
| -rw-r--r-- | vcpkg/ports/slikenet/portfile.cmake | 36 | ||||
| -rw-r--r-- | vcpkg/ports/slikenet/slikenet-config.cmake | 4 | ||||
| -rw-r--r-- | vcpkg/ports/slikenet/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/slikenet/vcpkg-cmake-wrapper.cmake | 11 | ||||
| -rw-r--r-- | vcpkg/ports/slikenet/vcpkg.json | 19 |
7 files changed, 333 insertions, 0 deletions
diff --git a/vcpkg/ports/slikenet/fix-emscripten.patch b/vcpkg/ports/slikenet/fix-emscripten.patch new file mode 100644 index 0000000..ced9417 --- /dev/null +++ b/vcpkg/ports/slikenet/fix-emscripten.patch @@ -0,0 +1,208 @@ +diff --git a/Source/include/slikenet/LinuxStrings.h b/Source/include/slikenet/LinuxStrings.h
+index c0fd72bee..53e02c834 100644
+--- a/Source/include/slikenet/LinuxStrings.h
++++ b/Source/include/slikenet/LinuxStrings.h
+@@ -23,7 +23,7 @@
+ int _strnicmp(const char* s1, const char* s2, size_t n);
+ char *_strlwr(char * str );
+ #else
+- #if (defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(_WIN32)
++ #if (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(_WIN32)
+ #ifndef _stricmp
+ int _stricmp(const char* s1, const char* s2);
+ #endif
+diff --git a/Source/include/slikenet/NativeTypes.h b/Source/include/slikenet/NativeTypes.h
+index 0b1305e31..1a1112d63 100644
+--- a/Source/include/slikenet/NativeTypes.h
++++ b/Source/include/slikenet/NativeTypes.h
+@@ -16,7 +16,7 @@
+ #ifndef __NATIVE_TYPES_H
+ #define __NATIVE_TYPES_H
+
+-#if defined(__GNUC__) || defined(__GCCXML__) || defined(__SNC__) || defined(__S3E__)
++#if defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__) || defined(__SNC__) || defined(__S3E__)
+ #include <stdint.h>
+ #elif !defined(_STDINT_H) && !defined(_SN_STDINT_H) && !defined(_SYS_STDINT_H_) && !defined(_STDINT) && !defined(_MACHTYPES_H_) && !defined(_STDINT_H_)
+ typedef unsigned char uint8_t;
+diff --git a/Source/include/slikenet/_FindFirst.h b/Source/include/slikenet/_FindFirst.h
+index 74f5d8aa0..8906063aa 100644
+--- a/Source/include/slikenet/_FindFirst.h
++++ b/Source/include/slikenet/_FindFirst.h
+@@ -16,7 +16,7 @@
+ #ifndef GCC_FINDFIRST_H
+ #define GCC_FINDFIRST_H
+
+-#if (defined(__GNUC__) || defined(__ARMCC_VERSION) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(__WIN32)
++#if (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__ARMCC_VERSION) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(__WIN32)
+
+ #include <dirent.h>
+
+diff --git a/Source/include/slikenet/linux_adapter.h b/Source/include/slikenet/linux_adapter.h
+index b8a228f2d..1b578d9e5 100644
+--- a/Source/include/slikenet/linux_adapter.h
++++ b/Source/include/slikenet/linux_adapter.h
+@@ -9,7 +9,7 @@
+ */
+ #pragma once
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__EMSCRIPTEN__)
+ #define _TRUNCATE ((size_t)-1)
+ typedef int errno_t;
+
+diff --git a/Source/include/slikenet/socket2.h b/Source/include/slikenet/socket2.h
+index fde1ee471..52514512b 100644
+--- a/Source/include/slikenet/socket2.h
++++ b/Source/include/slikenet/socket2.h
+@@ -354,7 +354,7 @@ class RNS2_Berkley : public IRNS2_Berkley
+
+
+
+-#if defined(_WIN32) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__)
++#if defined(_WIN32) || defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__)
+ class RNS2_Windows_Linux_360
+ {
+ public:
+diff --git a/Source/src/FileList.cpp b/Source/src/FileList.cpp
+index 514d2aa88..77c6bf12a 100644
+--- a/Source/src/FileList.cpp
++++ b/Source/src/FileList.cpp
+@@ -25,7 +25,7 @@
+ #include <io.h>
+
+
+-#elif !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ )
++#elif !defined ( __EMSCRIPTEN__ ) && !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ )
+ #include <sys/io.h>
+ #endif
+
+diff --git a/Source/src/GetTime.cpp b/Source/src/GetTime.cpp
+index 6e30e255c..67d69ace0 100644
+--- a/Source/src/GetTime.cpp
++++ b/Source/src/GetTime.cpp
+@@ -182,7 +182,7 @@ SLNet::TimeUS GetTimeUS_Windows( void )
+ return curTime;
+ #endif // #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
+ }
+-#elif defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__)
++#elif defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__)
+ SLNet::TimeUS GetTimeUS_Linux( void )
+ {
+ timeval tp;
+diff --git a/Source/src/LinuxStrings.cpp b/Source/src/LinuxStrings.cpp
+index 0a5583a0c..95bb2a093 100644
+--- a/Source/src/LinuxStrings.cpp
++++ b/Source/src/LinuxStrings.cpp
+@@ -13,7 +13,7 @@
+ * license found in the license.txt file in the root directory of this source tree.
+ */
+
+-#if (defined(__GNUC__) || defined(__ARMCC_VERSION) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(_WIN32)
++#if (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__ARMCC_VERSION) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(_WIN32)
+ #include <string.h>
+ #ifndef _stricmp
+ int _stricmp(const char* s1, const char* s2)
+diff --git a/Source/src/RakNetSocket2_Berkley.cpp b/Source/src/RakNetSocket2_Berkley.cpp
+index 0592beed1..1a4aac8a2 100644
+--- a/Source/src/RakNetSocket2_Berkley.cpp
++++ b/Source/src/RakNetSocket2_Berkley.cpp
+@@ -203,7 +203,7 @@ RNS2BindResult RNS2_Berkley::BindSharedIPV4( RNS2_BerkleyBindParameters *bindPar
+ #if defined(_WIN32)
+ closesocket__(rns2Socket);
+ return BR_FAILED_TO_BIND_SOCKET;
+-#elif (defined(__GNUC__) || defined(__GCCXML__) ) && !defined(_WIN32)
++#elif (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__) ) && !defined(_WIN32)
+ closesocket__(rns2Socket);
+ switch (errno)
+ {
+diff --git a/Source/src/RakNetSocket2_Windows_Linux_360.cpp b/Source/src/RakNetSocket2_Windows_Linux_360.cpp
+index ee7aedad9..de4e95628 100644
+--- a/Source/src/RakNetSocket2_Windows_Linux_360.cpp
++++ b/Source/src/RakNetSocket2_Windows_Linux_360.cpp
+@@ -20,7 +20,7 @@
+ #ifndef RAKNETSOCKET2_WINDOWS_LINUX_360_CPP
+ #define RAKNETSOCKET2_WINDOWS_LINUX_360_CPP
+
+-#if (defined(_WIN32) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
++#if (defined(_WIN32) || defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
+
+ RNS2SendResult RNS2_Windows_Linux_360::Send_Windows_Linux_360NoVDP( RNS2Socket rns2Socket, RNS2_SendParameters *sendParameters, const char *file, unsigned int line ) {
+
+diff --git a/Source/src/SignaledEvent.cpp b/Source/src/SignaledEvent.cpp
+index 5577cb442..3f623fcf8 100644
+--- a/Source/src/SignaledEvent.cpp
++++ b/Source/src/SignaledEvent.cpp
+@@ -17,7 +17,7 @@
+ #include "slikenet/assert.h"
+ #include "slikenet/sleep.h"
+
+-#if defined(__GNUC__)
++#if defined(__GNUC__) || defined(__EMSCRIPTEN__)
+ #include <sys/time.h>
+ #include <unistd.h>
+ #endif
+diff --git a/Source/src/SocketLayer.cpp b/Source/src/SocketLayer.cpp
+index fd6722e7c..1a50128b4 100644
+--- a/Source/src/SocketLayer.cpp
++++ b/Source/src/SocketLayer.cpp
+@@ -26,7 +26,7 @@
+ #include "slikenet/SocketDefines.h"
+ #include "slikenet/linux_adapter.h"
+ #include "slikenet/osx_adapter.h"
+-#if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
++#if (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
+ #include <netdb.h>
+ #endif
+
+diff --git a/Source/src/TCPInterface.cpp b/Source/src/TCPInterface.cpp
+index 0ca8a868d..ec3f181ee 100644
+--- a/Source/src/TCPInterface.cpp
++++ b/Source/src/TCPInterface.cpp
+@@ -44,7 +44,7 @@
+ #include "slikenet/Itoa.h"
+ #include "slikenet/SocketLayer.h"
+ #include "slikenet/SocketDefines.h"
+-#if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
++#if (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
+ #include <netdb.h>
+ #endif
+
+diff --git a/Source/src/UDPForwarder.cpp b/Source/src/UDPForwarder.cpp
+index 317dc9f8b..20d067531 100644
+--- a/Source/src/UDPForwarder.cpp
++++ b/Source/src/UDPForwarder.cpp
+@@ -212,7 +212,7 @@ void UDPForwarder::RecvFrom(SLNet::TimeMS curTime, ForwardEntry *forwardEntry)
+ sockAddrIn.sin_family = AF_INET;
+ #endif
+
+-#if defined(__GNUC__)
++#if defined(__GNUC__) || defined(__EMSCRIPTEN__)
+ #if defined(MSG_DONTWAIT)
+ const int flag=MSG_DONTWAIT;
+ #else
+diff --git a/Source/src/_FindFirst.cpp b/Source/src/_FindFirst.cpp
+index 10fab3462..1bc7990c7 100644
+--- a/Source/src/_FindFirst.cpp
++++ b/Source/src/_FindFirst.cpp
+@@ -12,7 +12,7 @@
+ * Original file by the_viking, fixed by Rv„mulo Fernandes, fixed by Emmanuel Nars
+ * Should emulate windows finddata structure
+ */
+-#if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(_WIN32)
++#if (defined(__EMSCRIPTEN__) || defined(__GNUC__) || defined(__GCCXML__)) && !defined(_WIN32)
+ #include "slikenet/_FindFirst.h"
+ #include "slikenet/DS_List.h"
+
+diff --git a/Source/src/linux_adapter.cpp b/Source/src/linux_adapter.cpp
+index fe25abe96..9d1f66e71 100644
+--- a/Source/src/linux_adapter.cpp
++++ b/Source/src/linux_adapter.cpp
+@@ -8,7 +8,7 @@
+ * This file defines adapters for all MS-specific functions used throughout SLikeNet.
+ */
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__EMSCRIPTEN__)
+ #include "slikenet/linux_adapter.h"
+
+ #include <algorithm> // for std::max, std::min
diff --git a/vcpkg/ports/slikenet/fix-install.patch b/vcpkg/ports/slikenet/fix-install.patch new file mode 100644 index 0000000..008dd1e --- /dev/null +++ b/vcpkg/ports/slikenet/fix-install.patch @@ -0,0 +1,51 @@ +diff --git a/Lib/DLL/CMakeLists.txt b/Lib/DLL/CMakeLists.txt
+index 7f6453d..48f9562 100644
+--- a/Lib/DLL/CMakeLists.txt
++++ b/Lib/DLL/CMakeLists.txt
+@@ -50,6 +50,7 @@ ELSE(WIN32 AND NOT UNIX)
+ ENDIF(WIN32 AND NOT UNIX)
+
+ target_link_libraries(SLikeNetDLL ${SLIKENET_LIBRARY_LIBS})
++if(0)
+ IF(NOT WIN32 OR UNIX)
+ configure_file(../../slikenet-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/slikenet-config-version.cmake @ONLY)
+
+@@ -60,3 +61,12 @@ IF(NOT WIN32 OR UNIX)
+ INSTALL(FILES ../../slikenet-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/slikenet-config-version.cmake DESTINATION lib/slikenet-${SLikeNet_VERSION})
+ INSTALL(EXPORT SLikeNetDLL DESTINATION lib/slikenet-${SLikeNet_VERSION})
+ ENDIF(NOT WIN32 OR UNIX)
++endif()
++
++install(TARGETS SLikeNetDLL
++ EXPORT SLikeNetDLL
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
++INSTALL(FILES ${ALL_HEADER_SRCS} DESTINATION include/slikenet)
++install(EXPORT SLikeNetDLL FILE slikenetTargets.cmake DESTINATION share/slikenet)
+diff --git a/Lib/LibStatic/CMakeLists.txt b/Lib/LibStatic/CMakeLists.txt
+index f936fa5..a5dcc4f 100644
+--- a/Lib/LibStatic/CMakeLists.txt
++++ b/Lib/LibStatic/CMakeLists.txt
+@@ -50,6 +50,8 @@ ELSE(WIN32 AND NOT UNIX)
+ ENDIF(WIN32 AND NOT UNIX)
+
+ target_link_libraries(SLikeNetLibStatic ${SLIKENET_LIBRARY_LIBS})
++
++if(0)
+ IF(WIN32 AND NOT UNIX)
+ IF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
+ set_target_properties(SLikeNetLibStatic PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB:\"LIBCD.lib LIBCMTD.lib MSVCRT.lib\"" )
+@@ -64,3 +66,12 @@ ELSE(WIN32 AND NOT UNIX)
+ INSTALL(FILES ../../slikenet-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/slikenet-config-version.cmake DESTINATION lib/slikenet-${SLikeNet_VERSION})
+ INSTALL(EXPORT SLikeNetLibStatic FILE slikenet.cmake DESTINATION lib/slikenet-${SLikeNet_VERSION})
+ ENDIF(WIN32 AND NOT UNIX)
++endif()
++
++INSTALL(TARGETS SLikeNetLibStatic
++ EXPORT SLikeNetLibStatic
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
++INSTALL(FILES ${ALL_HEADER_SRCS} DESTINATION include/slikenet)
++INSTALL(EXPORT SLikeNetLibStatic FILE slikenetTargets.cmake DESTINATION share/slikenet)
diff --git a/vcpkg/ports/slikenet/portfile.cmake b/vcpkg/ports/slikenet/portfile.cmake new file mode 100644 index 0000000..ea29d0d --- /dev/null +++ b/vcpkg/ports/slikenet/portfile.cmake @@ -0,0 +1,36 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO SLikeSoft/SLikeNet + REF 358462052fce7e585fc1cce0a17a7042ba724c08 + SHA512 2c932b0a7910ec36dd6a340dd841cefcf259fbdadadff220747d13752181ea14e3c5f05331beb36dea21c0de360edc270ff4c55375bbea23ee2149828f07e9ab + HEAD_REF master + PATCHES + fix-install.patch + fix-emscripten.patch +) +#Uses an outdated OpenSSL version and is in an experimental namespace any way. As such we delete it here +file(REMOVE_RECURSE "${SOURCE_PATH}/Source/src/crypto" "${SOURCE_PATH}/Source/include/slikenet/crypto") + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SLIKENET_ENABLE_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SLIKENET_ENABLE_DLL) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSLIKENET_ENABLE_DLL=${SLIKENET_ENABLE_DLL} + -DSLIKENET_ENABLE_STATIC=${SLIKENET_ENABLE_STATIC} + -DSLIKENET_ENABLE_SAMPLES=FALSE +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +vcpkg_cmake_config_fixup(CONFIG_PATH share/slikenet) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +configure_file("${CMAKE_CURRENT_LIST_DIR}/slikenet-config.cmake" "${CURRENT_PACKAGES_DIR}/share/slikenet/slikenet-config.cmake" COPYONLY) +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/slikenet/vcpkg-cmake-wrapper.cmake" COPYONLY) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/slikenet/slikenet-config.cmake b/vcpkg/ports/slikenet/slikenet-config.cmake new file mode 100644 index 0000000..be47336 --- /dev/null +++ b/vcpkg/ports/slikenet/slikenet-config.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro)
+find_dependency(OpenSSL)
+set(slikenet_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
+include(${CMAKE_CURRENT_LIST_DIR}/slikenetTargets.cmake)
diff --git a/vcpkg/ports/slikenet/usage b/vcpkg/ports/slikenet/usage new file mode 100644 index 0000000..6f98ae5 --- /dev/null +++ b/vcpkg/ports/slikenet/usage @@ -0,0 +1,4 @@ +The package slikenet provides CMake targets:
+
+ find_package(slikenet CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE SLikeNet)
\ No newline at end of file diff --git a/vcpkg/ports/slikenet/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/slikenet/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000..237389f --- /dev/null +++ b/vcpkg/ports/slikenet/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,11 @@ +_find_package(${ARGS})
+
+if(NOT TARGET SLikeNet AND TARGET SLikeNetDLL)
+add_library(SLikeNet INTERFACE IMPORTED)
+set_target_properties(SLikeNet PROPERTIES INTERFACE_LINK_LIBRARIES SLikeNetDLL)
+endif()
+
+if(NOT TARGET SLikeNet AND TARGET SLikeNetLibStatic)
+add_library(SLikeNet INTERFACE IMPORTED)
+set_target_properties(SLikeNet PROPERTIES INTERFACE_LINK_LIBRARIES SLikeNetLibStatic)
+endif()
diff --git a/vcpkg/ports/slikenet/vcpkg.json b/vcpkg/ports/slikenet/vcpkg.json new file mode 100644 index 0000000..de589c4 --- /dev/null +++ b/vcpkg/ports/slikenet/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "slikenet", + "version-date": "2021-06-07", + "port-version": 3, + "description": "SLikeNetT is an Open Source/Free Software cross-platform network engine written in C++ and specifially designed for games (and applications which have comparable requirements on a network engine like games) building upon the discontinued RakNet network engine which had more than 13 years of active development.", + "homepage": "https://github.com/SLikeSoft/SLikeNet", + "supports": "!uwp", + "dependencies": [ + "openssl", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |