From 4bc01b00e0eb9bfe486535148858337e1ff2dbbd Mon Sep 17 00:00:00 2001 From: Neil McNeight Date: Thu, 25 Oct 2018 13:57:39 -0500 Subject: [sdl1][sdl1-net] Add new port for SDL v1.2.15 & SDL_net v1.2.8 (#4492) * [sdl1][sdl1-net] Add new port for SDL v1.2.15 & SDL_net v1.2.8 * Version 1.2 is still required for building DOSbox * [sdl1][sdl1-net] Revise to install to expected paths * Headers go in include\ instead of include\SDL1 * Use updated .sln and .vcxproj files * [sdl1] Modernize --- ports/sdl1-net/CMakeLists.txt | 28 ++ ports/sdl1-net/CONTROL | 4 + ports/sdl1-net/portfile.cmake | 23 ++ ports/sdl1/CONTROL | 3 + ports/sdl1/SDL.vcxproj | 354 +++++++++++++++++++++ ports/sdl1/SDL1_2017.sln | 50 +++ ports/sdl1/SDLmain.vcxproj | 215 +++++++++++++ .../sdl1/export-symbols-only-in-shared-build.patch | 15 + ports/sdl1/portfile.cmake | 40 +++ 9 files changed, 732 insertions(+) create mode 100644 ports/sdl1-net/CMakeLists.txt create mode 100644 ports/sdl1-net/CONTROL create mode 100644 ports/sdl1-net/portfile.cmake create mode 100644 ports/sdl1/CONTROL create mode 100644 ports/sdl1/SDL.vcxproj create mode 100644 ports/sdl1/SDL1_2017.sln create mode 100644 ports/sdl1/SDLmain.vcxproj create mode 100644 ports/sdl1/export-symbols-only-in-shared-build.patch create mode 100644 ports/sdl1/portfile.cmake diff --git a/ports/sdl1-net/CMakeLists.txt b/ports/sdl1-net/CMakeLists.txt new file mode 100644 index 000000000..05bdac9f8 --- /dev/null +++ b/ports/sdl1-net/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.0) +project(SDL1_NET C) + +if (MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4996") +endif() + +find_path(SDL_INCLUDE_DIR SDL.h) +find_library(SDL_LIBRARY NAMES SDLd SDL) + +add_library(SDL_net SDLnet.c SDLnetselect.c SDLnetTCP.c SDLnetUDP.c version.rc) + +set_target_properties(SDL_net PROPERTIES DEFINE_SYMBOL SDL1_EXPORTS) +target_compile_definitions(SDL_net PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS) +target_include_directories(SDL_net PRIVATE ${SDL_INCLUDE_DIR}) +target_link_libraries(SDL_net ${SDL_LIBRARY} ws2_32 iphlpapi) + +install(TARGETS SDL_net + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if(NOT DEFINED SDL_NET_SKIP_HEADERS) + install(FILES SDL_net.h DESTINATION include) +endif() + +message(STATUS "Link-time dependencies:") +message(STATUS " " ${SDL_LIBRARY}) diff --git a/ports/sdl1-net/CONTROL b/ports/sdl1-net/CONTROL new file mode 100644 index 000000000..ae968e581 --- /dev/null +++ b/ports/sdl1-net/CONTROL @@ -0,0 +1,4 @@ +Source: sdl1-net +Version: 1.2.8-2 +Description: Networking library for SDL +Build-Depends: sdl1 diff --git a/ports/sdl1-net/portfile.cmake b/ports/sdl1-net/portfile.cmake new file mode 100644 index 000000000..8bdf4bd3c --- /dev/null +++ b/ports/sdl1-net/portfile.cmake @@ -0,0 +1,23 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL_net-1.2.8) +vcpkg_download_distfile(ARCHIVE + URLS "https://www.libsdl.org/projects/SDL_net/release/SDL_net-1.2.8.tar.gz" + FILENAME "SDL_net-1.2.8.tar.gz" + SHA512 2766ca55343127c619958ab3a3ae3052a27a676839f10a158f7dfc071b8db38c2f1fc853e8add32b9fef94ab07eaa986f46a68e264e8087b57c990af30ea9a0b +) + +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 DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl1-net) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl1-net/COPYING ${CURRENT_PACKAGES_DIR}/share/sdl1-net/copyright) diff --git a/ports/sdl1/CONTROL b/ports/sdl1/CONTROL new file mode 100644 index 000000000..483813f51 --- /dev/null +++ b/ports/sdl1/CONTROL @@ -0,0 +1,3 @@ +Source: sdl1 +Version: 1.2.15-3 +Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. diff --git a/ports/sdl1/SDL.vcxproj b/ports/sdl1/SDL.vcxproj new file mode 100644 index 000000000..1db10bb76 --- /dev/null +++ b/ports/sdl1/SDL.vcxproj @@ -0,0 +1,354 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + SDL + + + + DynamicLibrary + v141 + false + + + DynamicLibrary + v141 + false + + + DynamicLibrary + v141 + false + + + DynamicLibrary + v141 + false + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27924.0 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/SDL.tlb + + + Disabled + $(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions) + MultiThreadedDLL + false + + .\Debug/SDL.pch + Level3 + true + EditAndContinue + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + /MACHINE:I386 %(AdditionalOptions) + winmm.lib;dxguid.lib;%(AdditionalDependencies) + .\Debug/SDL.dll + true + false + true + .\Debug/SDL.pdb + Windows + false + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Debug/SDL.tlb + + + Disabled + $(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions) + MultiThreadedDLL + false + + .\Debug/SDL.pch + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;dxguid.lib;%(AdditionalDependencies) + .\Debug/SDL.dll + true + false + true + .\Debug/SDL.pdb + Windows + MachineX64 + false + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/SDL.tlb + + + OnlyExplicitInline + false + $(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + + .\Release/SDL.pch + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + /MACHINE:I386 %(AdditionalOptions) + winmm.lib;dxguid.lib;%(AdditionalDependencies) + .\Release/SDL.dll + true + false + .\Release/SDL.pdb + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Release/SDL.tlb + + + OnlyExplicitInline + false + $(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + + .\Release/SDL.pch + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;dxguid.lib;%(AdditionalDependencies) + .\Release/SDL.dll + true + false + .\Release/SDL.pdb + Windows + MachineX64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ports/sdl1/SDL1_2017.sln b/ports/sdl1/SDL1_2017.sln new file mode 100644 index 000000000..a255cb6aa --- /dev/null +++ b/ports/sdl1/SDL1_2017.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2003 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release_NoSTDIO|Win32 = Release_NoSTDIO|Win32 + Release_NoSTDIO|x64 = Release_NoSTDIO|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.ActiveCfg = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.Build.0 = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_NoSTDIO|x64.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release_NoSTDIO|x64.Build.0 = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.ActiveCfg = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.Build.0 = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Win32.ActiveCfg = Debug|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Win32.Build.0 = Debug|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.ActiveCfg = Debug|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.Build.0 = Debug|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release_NoSTDIO|Win32.ActiveCfg = Release_NoSTDIO|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release_NoSTDIO|Win32.Build.0 = Release_NoSTDIO|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release_NoSTDIO|x64.ActiveCfg = Release_NoSTDIO|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release_NoSTDIO|x64.Build.0 = Release_NoSTDIO|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.ActiveCfg = Release|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.Build.0 = Release|Win32 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg = Release|x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D0FB7C52-B8AE-4A23-A002-2F7DEF5F6BD6} + EndGlobalSection +EndGlobal diff --git a/ports/sdl1/SDLmain.vcxproj b/ports/sdl1/SDLmain.vcxproj new file mode 100644 index 000000000..228045d41 --- /dev/null +++ b/ports/sdl1/SDLmain.vcxproj @@ -0,0 +1,215 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release_NoSTDIO + Win32 + + + Release_NoSTDIO + x64 + + + Release + Win32 + + + Release + x64 + + + + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + + + + StaticLibrary + v141 + false + + + StaticLibrary + v141 + false + + + StaticLibrary + v141 + false + + + StaticLibrary + v141 + false + + + StaticLibrary + v141 + false + + + StaticLibrary + v141 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27924.0 + + + .\Release\ + .\Release\ + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + .\Release_NOSTDIO\ + .\Release_NOSTDIO\ + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + .\Debug\ + .\Debug\ + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + OnlyExplicitInline + ..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + .\Release/SDLmain.pch + Level3 + Default + + + + + X64 + + + OnlyExplicitInline + ..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + .\Release/SDLmain.pch + Level3 + Default + + + + + OnlyExplicitInline + ..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;NO_STDIO_REDIRECT;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + .\Release_NOSTDIO/SDLmain.pch + Level3 + Default + + + + + X64 + + + OnlyExplicitInline + ..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;NO_STDIO_REDIRECT;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + .\Release_NOSTDIO/SDLmain.pch + Level3 + Default + + + + + Disabled + ..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + + .\Debug/SDLmain.pch + Level3 + OldStyle + Default + + + + + X64 + + + Disabled + ..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + + .\Debug/SDLmain.pch + Level3 + OldStyle + Default + + + + + + + + + \ No newline at end of file diff --git a/ports/sdl1/export-symbols-only-in-shared-build.patch b/ports/sdl1/export-symbols-only-in-shared-build.patch new file mode 100644 index 000000000..c1ea96dc3 --- /dev/null +++ b/ports/sdl1/export-symbols-only-in-shared-build.patch @@ -0,0 +1,15 @@ +diff -r 8df7a59b5528 -r 46ec9baae30c include/begin_code.h +--- a/include/begin_code.h Fri Sep 22 11:25:52 2017 -0700 ++++ b/include/begin_code.h Sun Sep 24 14:32:30 2017 +0300 +@@ -54,8 +54,10 @@ + # else + # define DECLSPEC __declspec(dllimport) + # endif ++# elif defined(_DLL) ++# define DECLSPEC __declspec(dllexport) + # else +-# define DECLSPEC __declspec(dllexport) ++# define DECLSPEC + # endif + # elif defined(__OS2__) + # ifdef __WATCOMC__ diff --git a/ports/sdl1/portfile.cmake b/ports/sdl1/portfile.cmake new file mode 100644 index 000000000..de2d855e6 --- /dev/null +++ b/ports/sdl1/portfile.cmake @@ -0,0 +1,40 @@ +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO SDL-Mirror/SDL + REF release-1.2.15 + SHA512 38b94a650ec205377ae1503d0ec8a5254ef6d50ed0acac8d985b57b64bc16ea042cfa41e19e5ef8317980c4afb83186829f5bc3da9433d0a649dfd10554801b5 + HEAD_REF master + PATCHES export-symbols-only-in-shared-build.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDL1_2017.sln DESTINATION ${SOURCE_PATH}/VisualC/ ) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDL.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDL ) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDLmain.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDLmain ) + +configure_file(${SOURCE_PATH}/include/SDL_config.h.default ${SOURCE_PATH}/include/SDL_config.h COPYONLY) + +# This text file gets copied as a library, and included as one in the package +file(REMOVE_RECURSE ${SOURCE_PATH}/src/hermes/COPYING.LIB) + +vcpkg_install_msbuild( + SOURCE_PATH ${SOURCE_PATH} + PROJECT_SUBPATH VisualC/SDL1_2017.sln + INCLUDES_SUBPATH include + LICENSE_SUBPATH COPYING + ALLOW_ROOT_INCLUDES +) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/doxyfile) + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/SDLmain.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/SDLmain.lib) +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/SDLmain.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/SDLmaind.lib) +endif() -- cgit v1.2.3