Merge pull request #907 from codicodi/add-sdl2-net

Add sdl2-net
This commit is contained in:
Robert Schumacher 2017-04-06 16:55:32 -07:00 committed by GitHub
commit 2e7896e89e
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.0)
project(SDL2_NET C)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4996")
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_library(SDL_LIBRARY SDL2)
add_library(SDL2_net SDLnet.c SDLnetselect.c SDLnetTCP.c SDLnetUDP.c)
target_compile_definitions(SDL2_net PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
target_include_directories(SDL2_net PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
target_link_libraries(SDL2_net ${SDL_LIBRARY} ws2_32 iphlpapi)
install(TARGETS SDL2_net
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
if(NOT DEFINED SDL_NET_SKIP_HEADERS)
install(FILES SDL_net.h DESTINATION include/SDL2)
endif()
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})

4
ports/sdl2-net/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: sdl2-net
Version: 2.0.1
Description: Networking library for SDL
Build-Depends: sdl2

View File

@ -0,0 +1,22 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2_net-2.0.1)
vcpkg_download_distfile(ARCHIVE
URLS "https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz"
FILENAME "SDL2_net-2.0.1.tar.gz"
SHA512 d27faee3cddc3592dae38947e6c1df0cbaa95f82fde9c87db6d11f6312d868cea74f6830ad07ceeb3d0d75e9424cebf39e54fddf9a1147e8d9e664609de92b7a)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DSDL_NET_SKIP_HEADERS=ON)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-net)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-net/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-net/copyright)