From cd2c2c80814663b53bbc6975a63e276b99d6555e Mon Sep 17 00:00:00 2001 From: JackBoosY <47264268+JackBoosY@users.noreply.github.com> Date: Wed, 30 Oct 2019 14:08:14 +0800 Subject: [PATCH] [slikenet]Add new port. (#8693) --- ports/slikenet/CONTROL | 5 ++++ ports/slikenet/fix-install.patch | 49 ++++++++++++++++++++++++++++++++ ports/slikenet/portfile.cmake | 36 +++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 ports/slikenet/CONTROL create mode 100644 ports/slikenet/fix-install.patch create mode 100644 ports/slikenet/portfile.cmake diff --git a/ports/slikenet/CONTROL b/ports/slikenet/CONTROL new file mode 100644 index 000000000..f43c31256 --- /dev/null +++ b/ports/slikenet/CONTROL @@ -0,0 +1,5 @@ +Source: slikenet +Version: 2019-10-22 +Homepage: https://github.com/SLikeSoft/SLikeNet +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. +Build-Depends: openssl diff --git a/ports/slikenet/fix-install.patch b/ports/slikenet/fix-install.patch new file mode 100644 index 000000000..418b5e048 --- /dev/null +++ b/ports/slikenet/fix-install.patch @@ -0,0 +1,49 @@ +diff --git a/Lib/DLL/CMakeLists.txt b/Lib/DLL/CMakeLists.txt +index 2d1e078..7e705cf 100644 +--- a/Lib/DLL/CMakeLists.txt ++++ b/Lib/DLL/CMakeLists.txt +@@ -50,13 +50,13 @@ ELSE(WIN32 AND NOT UNIX) + ENDIF(WIN32 AND NOT UNIX) + + target_link_libraries(SLikeNetDLL ${SLIKENET_LIBRARY_LIBS}) +-IF(NOT WIN32 OR UNIX) +- configure_file(../../slikenet-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/slikenet-config-version.cmake @ONLY) +- +- install(TARGETS SLikeNetDLL EXPORT SLikeNetDLL DESTINATION lib/slikenet-${SLikeNet_VERSION}) ++IF(1) ++ install(TARGETS SLikeNetDLL ++ EXPORT SLikeNetDLL ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + INSTALL(FILES ${ALL_COMPATIBILITY_HEADER_SRC} DESTINATION include/slikenet-${SLikeNet_VERSION}) + INSTALL(FILES ${ALL_COMPATIBILITY_HEADER_SRC_2} DESTINATION include/slikenet-${SLikeNet_VERSION}/slikenet/slikenet) + INSTALL(FILES ${ALL_HEADER_SRCS} DESTINATION include/slikenet-${SLikeNet_VERSION}/slikenet/include/slikenet) +- 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(1) +diff --git a/Lib/LibStatic/CMakeLists.txt b/Lib/LibStatic/CMakeLists.txt +index 955a99d..9211c45 100644 +--- a/Lib/LibStatic/CMakeLists.txt ++++ b/Lib/LibStatic/CMakeLists.txt +@@ -54,13 +54,14 @@ 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\"" ) + ENDIF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles") +-ELSE(WIN32 AND NOT UNIX) +- configure_file(../../slikenet-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/slikenet-config-version.cmake @ONLY) ++ENDIF(WIN32 AND NOT UNIX) + + INSTALL(TARGETS SLikeNetLibStatic EXPORT SLikeNetLibStatic DESTINATION lib/slikenet-${SLikeNet_VERSION}) ++ INSTALL(TARGETS SLikeNetLibStatic ++ EXPORT SLikeNetLibStatic ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION share/slikenet) + INSTALL(FILES ${ALL_COMPATIBILITY_HEADER_SRC} DESTINATION include/slikenet-${SLikeNet_VERSION}) + INSTALL(FILES ${ALL_COMPATIBILITY_HEADER_SRC_2} DESTINATION include/slikenet-${SLikeNet_VERSION}/slikenet) + INSTALL(FILES ${ALL_HEADER_SRCS} DESTINATION include/slikenet-${SLikeNet_VERSION}/include/slikenet) +- 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) diff --git a/ports/slikenet/portfile.cmake b/ports/slikenet/portfile.cmake new file mode 100644 index 000000000..da57e055d --- /dev/null +++ b/ports/slikenet/portfile.cmake @@ -0,0 +1,36 @@ +vcpkg_fail_port_install(ON_TARGET "UWP") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO SLikeSoft/SLikeNet + REF cca394f05e9e9e3e315a85539e648f267d3f2fcc + SHA512 410954bda5a7be309eb71c3078f8ea67ff21aae2ce923f01db77b09265969f1350afb45b90194118bfad274f0a36a2d3bbc38d86a15507fdfc4bc8edc4a0204c + HEAD_REF master + PATCHES + fix-install.patch +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(SLIKENET_ENABLE_STATIC TRUE) + set(SLIKENET_ENABLE_DLL FALSE) +else() + set(SLIKENET_ENABLE_STATIC FALSE) + set(SLIKENET_ENABLE_DLL TRUE) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DSLIKENET_ENABLE_DLL=${SLIKENET_ENABLE_DLL} + -DSLIKENET_ENABLE_STATIC=${SLIKENET_ENABLE_STATIC} + -DSLIKENET_ENABLE_SAMPLES=FALSE +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file