aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/sdl2-gfx
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/sdl2-gfx
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/sdl2-gfx')
-rw-r--r--vcpkg/ports/sdl2-gfx/001-lrint-arm64.patch26
-rw-r--r--vcpkg/ports/sdl2-gfx/002-use-the-lrintf-intrinsic.patch14
-rw-r--r--vcpkg/ports/sdl2-gfx/CMakeLists.txt53
-rw-r--r--vcpkg/ports/sdl2-gfx/portfile.cmake31
-rw-r--r--vcpkg/ports/sdl2-gfx/vcpkg.json20
5 files changed, 144 insertions, 0 deletions
diff --git a/vcpkg/ports/sdl2-gfx/001-lrint-arm64.patch b/vcpkg/ports/sdl2-gfx/001-lrint-arm64.patch
new file mode 100644
index 0000000..50de179
--- /dev/null
+++ b/vcpkg/ports/sdl2-gfx/001-lrint-arm64.patch
@@ -0,0 +1,26 @@
+diff --git a/SDL2_gfxPrimitives.c b/SDL2_gfxPrimitives.c
+index f81e6da..91817fd 100755
+--- a/SDL2_gfxPrimitives.c
++++ b/SDL2_gfxPrimitives.c
+@@ -1771,8 +1771,20 @@ __declspec(naked) long int
+ __emit(0xE12FFF1E); // bx lr
+ }
+ #pragma warning(pop)
++#elif defined(_M_ARM64)
++#include <intrin.h>
++#pragma warning(push)
++#pragma warning(disable: 4716)
++__declspec(naked) long
++ lrint (double f)
++{
++ __emit(0x1e674000); // frintx d0, d0
++ __emit(0x9e780000); // fcvtzs x0, d0
++ __emit(0xd65f03c0); // ret
++}
++#pragma warning(pop)
+ #else
+-#error lrint needed for MSVC on non X86/AMD64/ARM targets.
++#error lrint needed for MSVC on non X86/AMD64/ARM/ARM64 targets.
+ #endif
+ #endif
+
diff --git a/vcpkg/ports/sdl2-gfx/002-use-the-lrintf-intrinsic.patch b/vcpkg/ports/sdl2-gfx/002-use-the-lrintf-intrinsic.patch
new file mode 100644
index 0000000..51af54d
--- /dev/null
+++ b/vcpkg/ports/sdl2-gfx/002-use-the-lrintf-intrinsic.patch
@@ -0,0 +1,14 @@
+diff --git a/SDL2_gfxPrimitives.c b/SDL2_gfxPrimitives.c
+index d8afb10..6c88288 100644
+--- a/SDL2_gfxPrimitives.c
++++ b/SDL2_gfxPrimitives.c
+@@ -1757,7 +1757,8 @@ int filledCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Ui
+ /* ----- AA Ellipse */
+
+ /* Windows targets do not have lrint, so provide a local inline version */
+-#if defined(_MSC_VER)
++/* MSVC pre 16.8 do not have lrint */
++#if defined(_MSC_VER) && _MSC_VER < 1928
+ /* Detect 64bit and use intrinsic version */
+ #ifdef _M_X64
+ #include <emmintrin.h>
diff --git a/vcpkg/ports/sdl2-gfx/CMakeLists.txt b/vcpkg/ports/sdl2-gfx/CMakeLists.txt
new file mode 100644
index 0000000..9c94b9b
--- /dev/null
+++ b/vcpkg/ports/sdl2-gfx/CMakeLists.txt
@@ -0,0 +1,53 @@
+cmake_minimum_required(VERSION 3.0)
+project(SDL2_gfx VERSION 1.0.4 LANGUAGES C)
+
+set(CONFIG_NAME "sdl2-gfx")
+
+find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
+find_package(SDL2 CONFIG REQUIRED)
+
+# builtin formats
+set(SDL_GFX_DEFINES WIN32)
+if(BUILD_SHARED_LIBS)
+ list(APPEND SDL_GFX_DEFINES DLL_EXPORT)
+endif()
+
+add_library(${PROJECT_NAME}
+ SDL2_framerate.c
+ SDL2_gfxPrimitives.c
+ SDL2_imageFilter.c
+ SDL2_rotozoom.c)
+
+target_include_directories(${PROJECT_NAME} PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>
+ $<INSTALL_INTERFACE:include/SDL2>
+)
+
+if(WIN32)
+ add_compile_definitions(${SDL_GFX_DEFINES})
+endif()
+target_include_directories(${PROJECT_NAME} PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
+target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2)
+
+install(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+install(EXPORT ${PROJECT_NAME}
+ FILE ${CONFIG_NAME}-targets.cmake
+ NAMESPACE SDL2::
+ DESTINATION share/${CONFIG_NAME}/
+)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}-config.cmake
+"include(CMakeFindDependencyMacro)
+find_dependency(SDL2 CONFIG)
+include(\${CMAKE_CURRENT_LIST_DIR}/${CONFIG_NAME}-targets.cmake)"
+)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}-config.cmake DESTINATION share/${CONFIG_NAME})
+
+if(NOT SDL_GFX_SKIP_HEADERS)
+ install(FILES SDL2_framerate.h SDL2_gfxPrimitives.h SDL2_imageFilter.h SDL2_rotozoom.h SDL2_gfxPrimitives_font.h DESTINATION include/SDL2)
+endif()
diff --git a/vcpkg/ports/sdl2-gfx/portfile.cmake b/vcpkg/ports/sdl2-gfx/portfile.cmake
new file mode 100644
index 0000000..5c6dfcd
--- /dev/null
+++ b/vcpkg/ports/sdl2-gfx/portfile.cmake
@@ -0,0 +1,31 @@
+set(VERSION 1.0.4)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-${VERSION}.zip"
+ FILENAME "SDL2_gfx-${VERSION}.zip"
+ SHA512 213b481469ba2161bd8558a7a5427b129420193b1c3895923d515f69f87991ed2c99bbc44349c60b4bcbb7d7d2255c1f15ee8a3523c26502070cfaacccaa5242
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ SOURCE_BASE "${VERSION}"
+ PATCHES
+ 001-lrint-arm64.patch
+ 002-use-the-lrintf-intrinsic.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG -DSDL_GFX_SKIP_HEADERS=1
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup()
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/vcpkg/ports/sdl2-gfx/vcpkg.json b/vcpkg/ports/sdl2-gfx/vcpkg.json
new file mode 100644
index 0000000..4e48c75
--- /dev/null
+++ b/vcpkg/ports/sdl2-gfx/vcpkg.json
@@ -0,0 +1,20 @@
+{
+ "name": "sdl2-gfx",
+ "version": "1.0.4",
+ "port-version": 11,
+ "description": "Graphics primitives (line, circle, rectangle etc.) with AA support, rotozoomer and other drawing related support functions wrapped up in a C based add-on library for the Simple Direct Media (SDL) cross-platform API layer.",
+ "dependencies": [
+ {
+ "name": "sdl2",
+ "default-features": false
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}