Skip to content

Commit

Permalink
[sdl2-ttf,tgui,sfml] Update sdl2-ttf to 2.20.0, revise dependencies i…
Browse files Browse the repository at this point in the history
…mport and export (#26026)

* [sdl2-ttf] update to 2.20.0

* update version

* add license

* update version

* del unused function

* overwrite version

* Fix sdl2-tff

* Increase version

* version

* Fix config export/import

* version

* Fix sdl2pp

* Fix SDL2_ttf import

* Fix sdl2pp

* Try again

* ...

* shared

* Fix patch

* not win32

* revert

* Fix import name

* Fix tgui

* version

* CR

* version

* CR

* version

* license

* version

* update port version

* version

* Fix patch

* version

* Fix patch

* version

* Update patch

* version

* Fix tgui

* add feature harfbuzz

* version

* Fix feature

* version

* Fix mingw

* Trim patching

* Explicit usage

* [sfml] Fix OpenGL dependency

* [sfml] Transform freetype patch and config fixup

* [sfml] Transform stb patch

* [tgui] Revise port

* [tgui] Extend config patching, merge into dependencies patch

* [tgui] Devendor stb

* [tgui] Revise feature dependencies

* [tgui] Omit pc files (too many inconsistencies)

* [milerius-sfml-imgui] Fixup

* Update versions

Co-authored-by: FrankXie <v-frankxie@microsoft.com>
Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 5, 2022
1 parent 714722b commit df806d3
Show file tree
Hide file tree
Showing 26 changed files with 355 additions and 209 deletions.
5 changes: 3 additions & 2 deletions ports/milerius-sfml-imgui/FixFindPackageIssue.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27b8bd8..33fe623 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
@@ -2,8 +2,8 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the source code and call cmake from there")
endif ()

-project(sfml-imgui)
+project(milerius-sfml-imgui)
cmake_minimum_required(VERSION 3.9)
+project(milerius-sfml-imgui)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

##! Package
@@ -26,7 +26,7 @@ include(CMakePackageConfigHelpers)

install(TARGETS
Expand Down
3 changes: 2 additions & 1 deletion ports/milerius-sfml-imgui/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "milerius-sfml-imgui",
"version": "1.1",
"port-version": 4,
"port-version": 5,
"description": "imgui dll for sfml usage",
"license": "MIT",
"dependencies": [
"imgui",
"sfml",
Expand Down
52 changes: 0 additions & 52 deletions ports/sdl2-ttf/CMakeLists.txt

This file was deleted.

22 changes: 22 additions & 0 deletions ports/sdl2-ttf/fix-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a097d5c..ca2881f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -325,7 +333,7 @@ if(SDL2TTF_INSTALL)
COMPONENT devel
)

- if(SDL2TTF_BUILD_SHARED_LIBS)
+ if(1)
# Only create a .pc file for a shared SDL2_ttf
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\${prefix}")
@@ -352,7 +360,7 @@ if(SDL2TTF_INSTALL)
\"${CMAKE_CURRENT_BINARY_DIR}/SDL2_ttf.pc\" ONLY_IF_DIFFERENT)
file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${PC_DESTDIR}\"
TYPE FILE
- FILES \"${CMAKE_CURRENT_BINARY_DIR}/SDL2_ttf.pc\")" CONFIG Release)
+ FILES \"${CMAKE_CURRENT_BINARY_DIR}/SDL2_ttf.pc\")")
endif()

if(SDL2TTF_BUILD_SHARED_LIBS AND (APPLE OR (UNIX AND NOT ANDROID)))
51 changes: 29 additions & 22 deletions ports/sdl2-ttf/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
set(VERSION 2.0.15)

vcpkg_download_distfile(ARCHIVE
URLS "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-${VERSION}.tar.gz"
FILENAME "SDL2_ttf-${VERSION}.tar.gz"
SHA512 30d685932c3dd6f2c94e2778357a5c502f0421374293d7102a64d92f9c7861229bf36bedf51c1a698b296a58c858ca442d97afb908b7df1592fc8d4f8ae8ddfd
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libsdl-org/SDL_ttf
REF f5e4828ffc9d3a84f00011fede4446aecb4a685f #v2.20.0
SHA512 c0d2d6107e5427d9c1353e14cb4b0c3957d28391cfc772f1f972fe3aa8ba9e9dfdfcb64acd317a7836d46b3a50da9597b19a832f0baf5198654acb7b31ab1e6b
HEAD_REF main
PATCHES
fix-pkgconfig.patch
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${VERSION}
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
harfbuzz SDL2TTF_HARFBUZZ
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSDL2TTF_VENDORED=OFF
-DSDL2TTF_SAMPLES=OFF
${FEATURE_OPTIONS}
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DSDL_TTF_SKIP_HEADERS=ON)
vcpkg_cmake_install()
if(EXISTS "${CURRENT_PACKAGES_DIR}/cmake")
vcpkg_cmake_config_fixup(PACKAGE_NAME SDL2_ttf CONFIG_PATH cmake)
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME SDL2_ttf CONFIG_PATH lib/cmake/SDL2_ttf)
endif()

vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licenses")

file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-ttf)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-ttf/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-ttf/copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
4 changes: 4 additions & 0 deletions ports/sdl2-ttf/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sdl2-ttf provides CMake targets:

find_package(SDL2_ttf CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>)
24 changes: 20 additions & 4 deletions ports/sdl2-ttf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
{
"name": "sdl2-ttf",
"version-string": "2.0.15",
"port-version": 5,
"version": "2.20.0",
"description": "A library for rendering TrueType fonts with SDL",
"homepage": "https://www.libsdl.org/projects/SDL_ttf/",
"license": "Zlib",
"dependencies": [
"freetype",
"sdl2"
]
"sdl2",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"harfbuzz": {
"description": "Enable HarfBuzz support",
"dependencies": [
"harfbuzz"
]
}
}
}
5 changes: 2 additions & 3 deletions ports/sdl2pp/fix-dependencies.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ index cdfd2a6..dc08748 100644
ENDIF(SDL2PP_WITH_IMAGE)

IF(SDL2PP_WITH_TTF)
- FIND_PACKAGE(SDL2_ttf REQUIRED)
FIND_PACKAGE(SDL2_ttf REQUIRED)
- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIR})
- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_TTF_LIBRARY})
+ FIND_PACKAGE(sdl2-ttf CONFIG REQUIRED)
+ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_ttf)
+ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} $<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>)
SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_ttf")
ELSE(SDL2PP_WITH_TTF)
MESSAGE(STATUS "SDL2_ttf support disabled")
Expand Down
2 changes: 1 addition & 1 deletion ports/sdl2pp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sdl2pp",
"version": "0.16.1",
"port-version": 4,
"port-version": 5,
"description": "C++11 bindings/wrapper for SDL2",
"homepage": "https://sdl2pp.amdmi3.ru",
"license": "Zlib",
Expand Down
75 changes: 75 additions & 0 deletions ports/sfml/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
diff --git a/cmake/SFMLConfig.cmake.in b/cmake/SFMLConfig.cmake.in
index ce81953..bd2d330 100644
--- a/cmake/SFMLConfig.cmake.in
+++ b/cmake/SFMLConfig.cmake.in
@@ -1,3 +1,8 @@
+set(SFML_STATIC_LIBRARIES false)
+if(NOT "@BUILD_SHARED_LIBS@")
+ set(SFML_STATIC_LIBRARIES true)
+endif()
+include(CMakeFindDependencyMacro)
# This script provides the SFML libraries as imported targets
# ------------------------------------
#
diff --git a/cmake/SFMLConfigDependencies.cmake.in b/cmake/SFMLConfigDependencies.cmake.in
index 1028110..927d1a4 100644
--- a/cmake/SFMLConfigDependencies.cmake.in
+++ b/cmake/SFMLConfigDependencies.cmake.in
@@ -56,6 +56,9 @@ if(SFML_STATIC_LIBRARIES)
if (FIND_SFML_OS_WINDOWS)
set_property(TARGET OpenGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "OpenGL32")
elseif(NOT FIND_SFML_OS_IOS)
+ set(OpenGL_GL_PREFERENCE "@EXPORT_OpenGL_GL_PREFERENCE@")
+ find_dependency(OpenGL)
+ set(OpenGL_LIB OpenGL::GL)
sfml_bind_dependency(TARGET OpenGL FRIENDLY_NAME "OpenGL" SEARCH_NAMES "OpenGL" "GL")
endif()
endif()
@@ -63,6 +66,8 @@ if(SFML_STATIC_LIBRARIES)
# sfml-graphics
list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT_INDEX)
if(FIND_SFML_GRAPHICS_COMPONENT_INDEX GREATER -1)
+ find_dependency(Freetype)
+ set(FreeType_LIB Freetype::Freetype)
sfml_bind_dependency(TARGET Freetype FRIENDLY_NAME "FreeType" SEARCH_NAMES "freetype")
endif()

diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt
index 883c758..402efbe 100644
--- a/src/SFML/Graphics/CMakeLists.txt
+++ b/src/SFML/Graphics/CMakeLists.txt
@@ -97,7 +97,8 @@ sfml_add_library(sfml-graphics
target_link_libraries(sfml-graphics PUBLIC sfml-window)

# stb_image sources
-target_include_directories(sfml-graphics PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image")
+find_path(STB_INCLUDE_DIR stb_image.h REQUIRED)
+target_include_directories(sfml-graphics PRIVATE "${STB_INCLUDE_DIR}")

# let CMake know about our additional graphics libraries paths
if(SFML_OS_WINDOWS)
@@ -134,7 +134,8 @@ if(SFML_OS_ANDROID)
target_link_libraries(sfml-graphics PRIVATE z EGL GLESv1_CM)
endif()

-sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY")
+set(FreeType_LIB Freetype::Freetype)
+sfml_find_package(Freetype LINK FreeType_LIB)
target_link_libraries(sfml-graphics PRIVATE Freetype)

# add preprocessor symbols
diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt
index 98ea439..0f1fb53 100644
--- a/src/SFML/Window/CMakeLists.txt
+++ b/src/SFML/Window/CMakeLists.txt
@@ -254,7 +254,9 @@ if(SFML_OPENGL_ES)
target_link_libraries(sfml-window PRIVATE EGL GLESv1_CM)
endif()
else()
- sfml_find_package(OpenGL INCLUDE "OPENGL_INCLUDE_DIR" LINK "OPENGL_LIBRARIES")
+ set(EXPORT_OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE}" CACHE INTERNAL "")
+ set(OpenGL_LIB OpenGL::GL)
+ sfml_find_package(OpenGL LINK OpenGL_LIB)
target_link_libraries(sfml-window PRIVATE OpenGL)
endif()

14 changes: 1 addition & 13 deletions ports/sfml/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
HEAD_REF master
SHA512 7aed2fc29d1da98e6c4d598d5c86cf536cb4eb5c2079cdc23bb8e502288833c052579dadbe0ce13ad6461792d959bf6d9660229f54c54cf90a541c88c6b03d59
PATCHES
use-system-freetype.patch
stb_include.patch
fix-dependencies.patch
arm64.patch
)

file(REMOVE_RECURSE "${SOURCE_PATH}/extlibs")
# Without this, we get error: list sub-command REMOVE_DUPLICATES requires list to be present.
file(MAKE_DIRECTORY "${SOURCE_PATH}/extlibs/libs")
file(WRITE "${SOURCE_PATH}/extlibs/libs/x" "")
# The embedded FindFreetype doesn't properly handle debug libraries
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/Modules/FindFreetype.cmake")

Expand All @@ -33,13 +28,6 @@ vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SFML)
vcpkg_copy_pdbs()

FILE(READ "${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake" SFML_CONFIG)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
FILE(WRITE "${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake" "set(SFML_STATIC_LIBRARIES true)\ninclude(CMakeFindDependencyMacro)\nfind_dependency(Freetype)\n${SFML_CONFIG}")
else()
FILE(WRITE "${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake" "set(SFML_STATIC_LIBRARIES false)\n${SFML_CONFIG}")
endif()

# 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")
Expand Down
12 changes: 0 additions & 12 deletions ports/sfml/stb_include.patch

This file was deleted.

11 changes: 0 additions & 11 deletions ports/sfml/use-system-freetype.patch

This file was deleted.

3 changes: 2 additions & 1 deletion ports/sfml/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sfml",
"version": "2.5.1",
"port-version": 13,
"port-version": 14,
"description": "Simple and fast multimedia library",
"homepage": "https://github.com/sfml/sfml",
"license": "Zlib",
Expand All @@ -11,6 +11,7 @@
"libogg",
"libvorbis",
"openal-soft",
"opengl",
"stb",
{
"name": "vcpkg-cmake",
Expand Down
Loading

0 comments on commit df806d3

Please sign in to comment.