aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/sdl3
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/sdl3')
-rw-r--r--vcpkg/ports/sdl3/fix-freebsd.patch13
-rw-r--r--vcpkg/ports/sdl3/portfile.cmake71
-rw-r--r--vcpkg/ports/sdl3/usage4
-rw-r--r--vcpkg/ports/sdl3/vcpkg.json63
4 files changed, 151 insertions, 0 deletions
diff --git a/vcpkg/ports/sdl3/fix-freebsd.patch b/vcpkg/ports/sdl3/fix-freebsd.patch
new file mode 100644
index 0000000..655ae13
--- /dev/null
+++ b/vcpkg/ports/sdl3/fix-freebsd.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9e19336..ff6424b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -4038,7 +4038,7 @@ else()
+ endif()
+ set(SDL_INSTALL_CMAKEDIR_ROOT "${SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT}" CACHE STRING "Root folder where to install SDL3Config.cmake related files (SDL3 subfolder for MSVC projects)")
+
+-if(FREEBSD)
++if(0)
+ # FreeBSD uses ${PREFIX}/libdata/pkgconfig
+ set(SDL_PKGCONFIG_INSTALLDIR "libdata/pkgconfig")
+ else()
diff --git a/vcpkg/ports/sdl3/portfile.cmake b/vcpkg/ports/sdl3/portfile.cmake
new file mode 100644
index 0000000..edd5314
--- /dev/null
+++ b/vcpkg/ports/sdl3/portfile.cmake
@@ -0,0 +1,71 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libsdl-org/SDL
+ REF "release-${VERSION}"
+ SHA512 2c12c8870ad80306cd66a0177683f197b2c172f0947b32a2515721a82523bbba52d872d980be3cd1f56870135e005490de2685ad341d33cfb775d44c04f20e63
+ HEAD_REF main
+ PATCHES
+ fix-freebsd.patch
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SDL_STATIC)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SDL_SHARED)
+string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" FORCE_STATIC_VCRT)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ alsa SDL_ALSA
+ ibus SDL_IBUS
+ vulkan SDL_VULKAN
+ wayland SDL_WAYLAND
+ x11 SDL_X11
+)
+
+if ("x11" IN_LIST FEATURES)
+ message(WARNING "You will need to install Xorg dependencies to use feature x11:\nsudo apt install libx11-dev libxft-dev libxext-dev\n")
+endif()
+if ("wayland" IN_LIST FEATURES)
+ message(WARNING "You will need to install Wayland dependencies to use feature wayland:\nsudo apt install libwayland-dev libxkbcommon-dev libegl1-mesa-dev\n")
+endif()
+if ("ibus" IN_LIST FEATURES)
+ message(WARNING "You will need to install ibus dependencies to use feature ibus:\nsudo apt install libibus-1.0-dev\n")
+endif()
+# option for not need to show windows
+list(APPEND FEATURE_OPTIONS -DSDL_UNIX_CONSOLE_BUILD=ON)
+if (VCPKG_TARGET_IS_LINUX AND NOT "x11" IN_LIST FEATURES AND NOT "wayland" IN_LIST FEATURES)
+ message(WARNING "The selected features don't allow sdl3 to create windows, which is usually unintentional. You can get windowing support by installing the x11 and/or wayland features.")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DSDL_STATIC=${SDL_STATIC}
+ -DSDL_SHARED=${SDL_SHARED}
+ -DSDL_FORCE_STATIC_VCRT=${FORCE_STATIC_VCRT}
+ -DSDL_LIBC=ON
+ -DSDL_TEST_LIBRARY=OFF
+ -DSDL_TESTS=OFF
+ -DSDL_INSTALL_CMAKEDIR_ROOT=share/${PORT}
+ # Specifying the revision skips the need to use git to determine a version
+ -DSDL_REVISION=vcpkg
+ -DCMAKE_DISABLE_FIND_PACKAGE_LibUSB=1
+ MAYBE_UNUSED_VARIABLES
+ SDL_FORCE_STATIC_VCRT
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
+
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt"
+ COMMENT "Some configurations may use code licensed under the MIT and Apache-2.0 licenses."
+)
diff --git a/vcpkg/ports/sdl3/usage b/vcpkg/ports/sdl3/usage
new file mode 100644
index 0000000..418652a
--- /dev/null
+++ b/vcpkg/ports/sdl3/usage
@@ -0,0 +1,4 @@
+sdl3 provides CMake targets:
+
+ find_package(SDL3 CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE SDL3::SDL3)
diff --git a/vcpkg/ports/sdl3/vcpkg.json b/vcpkg/ports/sdl3/vcpkg.json
new file mode 100644
index 0000000..cdc6b60
--- /dev/null
+++ b/vcpkg/ports/sdl3/vcpkg.json
@@ -0,0 +1,63 @@
+{
+ "name": "sdl3",
+ "version": "3.2.26",
+ "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.",
+ "homepage": "https://www.libsdl.org",
+ "license": "Zlib AND MIT AND Apache-2.0",
+ "supports": "!uwp",
+ "dependencies": [
+ {
+ "name": "dbus",
+ "default-features": false,
+ "platform": "linux"
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ {
+ "name": "ibus",
+ "platform": "linux"
+ },
+ {
+ "name": "wayland",
+ "platform": "linux"
+ },
+ {
+ "name": "x11",
+ "platform": "linux"
+ }
+ ],
+ "features": {
+ "alsa": {
+ "description": "Support for alsa audio",
+ "dependencies": [
+ {
+ "name": "alsa",
+ "platform": "linux"
+ }
+ ]
+ },
+ "ibus": {
+ "description": "Build with ibus IME support",
+ "supports": "linux"
+ },
+ "vulkan": {
+ "description": "Vulkan functionality for SDL"
+ },
+ "wayland": {
+ "description": "Build with Wayland support",
+ "supports": "linux"
+ },
+ "x11": {
+ "description": "Build with X11 support",
+ "supports": "!windows"
+ }
+ }
+}