vcpkg/ports/sfml/fix-dependencies.patch
Kai Pastor df806d3a4b
[sdl2-ttf,tgui,sfml] Update sdl2-ttf to 2.20.0, revise dependencies import 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>
2022-08-04 19:18:37 -07:00

76 lines
3.1 KiB
Diff

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()