diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/sfml | |
Diffstat (limited to 'vcpkg/ports/sfml')
| -rw-r--r-- | vcpkg/ports/sfml/01-fix-dependency-resolve.patch | 30 | ||||
| -rw-r--r-- | vcpkg/ports/sfml/03-fix-android-install-path.patch | 17 | ||||
| -rw-r--r-- | vcpkg/ports/sfml/portfile.cmake | 59 | ||||
| -rw-r--r-- | vcpkg/ports/sfml/usage | 7 | ||||
| -rw-r--r-- | vcpkg/ports/sfml/vcpkg.json | 61 |
5 files changed, 174 insertions, 0 deletions
diff --git a/vcpkg/ports/sfml/01-fix-dependency-resolve.patch b/vcpkg/ports/sfml/01-fix-dependency-resolve.patch new file mode 100644 index 0000000..4d7b6bf --- /dev/null +++ b/vcpkg/ports/sfml/01-fix-dependency-resolve.patch @@ -0,0 +1,30 @@ +diff --git a/cmake/SFMLConfig.cmake.in b/cmake/SFMLConfig.cmake.in +index 855f8a273..ea473f4f8 100644 +--- a/cmake/SFMLConfig.cmake.in ++++ b/cmake/SFMLConfig.cmake.in +@@ -81,6 +81,11 @@ foreach(component ${SFML_FIND_COMPONENTS}) + endif() + endforeach() + ++set(SFML_STATIC_LIBRARIES false) ++if(NOT "@BUILD_SHARED_LIBS@") ++ set(SFML_STATIC_LIBRARIES true) ++endif() ++ + set(FIND_SFML_PATHS + "${CMAKE_CURRENT_LIST_DIR}/../../.." + ~/Library/Frameworks +diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt +index 4886ac71f..8018937ee 100644 +--- a/src/SFML/Graphics/CMakeLists.txt ++++ b/src/SFML/Graphics/CMakeLists.txt +@@ -93,7 +93,8 @@ sfml_add_library(Graphics + target_link_libraries(sfml-graphics PUBLIC SFML::Window) + + # stb_image sources +-target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image") ++find_path(STB_INCLUDE_DIR stb_image.h REQUIRED) ++target_include_directories(sfml-graphics SYSTEM PRIVATE "${STB_INCLUDE_DIR}") + + # glad sources + target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include") diff --git a/vcpkg/ports/sfml/03-fix-android-install-path.patch b/vcpkg/ports/sfml/03-fix-android-install-path.patch new file mode 100644 index 0000000..ab31b3d --- /dev/null +++ b/vcpkg/ports/sfml/03-fix-android-install-path.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f9cdd1c20..24d891d26 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -80,12 +80,6 @@ if(SFML_OS_ANDROID) + + # avoid missing libraries when building SFML for Android with NDK r19c and later + list(PREPEND CMAKE_FIND_ROOT_PATH "${PROJECT_SOURCE_DIR}") +- +- # install everything in $NDK/sources/ because this path is appended by the NDK (convenient) +- set(CMAKE_INSTALL_PREFIX ${CMAKE_ANDROID_NDK}/sources/third_party/sfml) +- +- # we install libs in a subdirectory named after the ABI +- set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CMAKE_ANDROID_ARCH_ABI}") + endif() + + # Install directories diff --git a/vcpkg/ports/sfml/portfile.cmake b/vcpkg/ports/sfml/portfile.cmake new file mode 100644 index 0000000..67c8670 --- /dev/null +++ b/vcpkg/ports/sfml/portfile.cmake @@ -0,0 +1,59 @@ +vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH + REPO SFML/SFML + REF "${VERSION}" + HEAD_REF master + SHA512 7fc3f91b84ba2353b4216c0d0a71fd15f7349b8e22630dd727fc98a1f8c295a69fe21f3e1e878413966662047280ed4f195b51ee3302061c3903aea4958a6999 + PATCHES + 01-fix-dependency-resolve.patch + 03-fix-android-install-path.patch +) + +if(VCPKG_TARGET_IS_LINUX) + message(STATUS "SFML currently requires the following libraries from the system package manager:\n libudev\n libx11\n libxi\n libxrandr\n libxcursor\n opengl\n\nThese can be installed on Ubuntu systems via apt-get install libx11-dev libxi-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev") +endif() + +vcpkg_check_features( + OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + "network" SFML_BUILD_NETWORK + "graphics" SFML_BUILD_GRAPHICS + "window" SFML_BUILD_WINDOW + "audio" SFML_BUILD_AUDIO +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSFML_BUILD_FRAMEWORKS=OFF + -DSFML_USE_SYSTEM_DEPS=ON + -DSFML_MISC_INSTALL_PREFIX=share/sfml + -DSFML_GENERATE_PDB=OFF + ${FEATURE_OPTIONS} + MAYBE_UNUSED_VARIABLES + SFML_MISC_INSTALL_PREFIX +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SFML) +vcpkg_copy_pdbs() + +# move sfml-main to manual link dir +if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib") + file(COPY "${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/manual-link") + file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib") + file(GLOB FILES "${CURRENT_PACKAGES_DIR}/share/sfml/SFMLMain*Targets-*.cmake") + foreach(FILE ${FILES}) + vcpkg_replace_string("${FILE}" "/lib/sfml-main" "/lib/manual-link/sfml-main") + endforeach() +endif() +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib") + file(COPY "${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link") + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_fixup_pkgconfig() + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.md") diff --git a/vcpkg/ports/sfml/usage b/vcpkg/ports/sfml/usage new file mode 100644 index 0000000..79c19c3 --- /dev/null +++ b/vcpkg/ports/sfml/usage @@ -0,0 +1,7 @@ +The package sfml provides CMake targets:
+
+ find_package(SFML COMPONENTS Network Graphics Window Audio System CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE SFML::Network SFML::Graphics SFML::Window SFML::Audio SFML::System)
+
+ # If you want SFML to provide an implementation of main():
+ target_link_libraries(main PRIVATE SFML::Main)
diff --git a/vcpkg/ports/sfml/vcpkg.json b/vcpkg/ports/sfml/vcpkg.json new file mode 100644 index 0000000..e1c4044 --- /dev/null +++ b/vcpkg/ports/sfml/vcpkg.json @@ -0,0 +1,61 @@ +{ + "name": "sfml", + "version": "3.0.2", + "description": "Simple and fast multimedia library", + "homepage": "https://github.com/SFML/SFML", + "license": "Zlib", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "audio", + "graphics", + "network", + "window" + ], + "features": { + "audio": { + "description": "Use sfml-audio library", + "dependencies": [ + "libflac", + "libogg", + "libvorbis", + "miniaudio" + ] + }, + "graphics": { + "description": "Use sfml-graphics library", + "dependencies": [ + { + "name": "freetype", + "default-features": false + }, + { + "name": "sfml", + "default-features": false, + "features": [ + "window" + ] + }, + "stb" + ] + }, + "network": { + "description": "Use sfml-network library" + }, + "window": { + "description": "Use sfml-window library", + "dependencies": [ + "opengl" + ] + } + } +} |