[egl] Revise wrapper and pkgconfig files for windows (#28174)

* [egl] Use vcpkg_fixup_pkgconfig

* Mingw uses lower case filenames

* Document what is wrapped

* Do backup before modification

* Windows EGL_LIBRARY is unofficial::angle::libEGL

* Update versions
This commit is contained in:
Kai Pastor 2022-12-14 01:27:58 +01:00 committed by GitHub
parent 180ea20782
commit 5ed17f6b22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 54 deletions

View File

@ -5,6 +5,8 @@ includedir=${prefix}/include
Name: EGL
Description: EGL library and headers.
Version: @VERSION@
Requires: zlib opengl # angle
Libs: -L${libdir} -llibEGL -llibGLESv2 -llibANGLE -lD3d9 -ldxguid -lDXGI
Cflags: -I${includedir} @KHRONOS_STATIC@
Requires.private: zlib opengl # angle
Libs: -L${libdir} -llibEGL
Libs.private: -llibGLESv2 -llibANGLE -ld3d9 -ldxguid -ldxgi
Cflags: -I${includedir}
Cflags.private: -DKHRONOS_STATIC

View File

@ -3,12 +3,9 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/egl/vcpkg-cmake-wrapper.cmake" @ONLY)
if(VCPKG_TARGET_IS_WINDOWS)
set(KHRONOS_STATIC "")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(KHRONOS_STATIC "-DKHRONOS_STATIC")
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/egl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/egl.pc" @ONLY)
if (NOT VCPKG_BUILD_TYPE)
configure_file("${CMAKE_CURRENT_LIST_DIR}/egl.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/egl.pc" @ONLY)
endif()
vcpkg_fixup_pkgconfig()
endif()

View File

@ -1,55 +1,22 @@
# Wrapper for FindEGL.cmake in extra-cmake-modules (port ecm) and its vendored copies
if(UNIX)
find_package(OpenGL COMPONENTS EGL)
if(OPENGL_egl_LIBRARY)
set(EGL_LIBRARY "${OPENGL_egl_LIBRARY}" CACHE STRING "")
set(EGL_INCLUDE_DIR "${OPENGL_EGL_INCLUDE_DIRS}" CACHE STRING "")
endif()
endif()
set(VCPKG_SETUP_EGL OFF)
if(NOT TARGET EGL::EGL)
set(VCPKG_SETUP_EGL ON)
endif()
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND WIN32)
include(SelectLibraryConfigurations)
find_library(GLESv2_LIBRARY_DEBUG NAMES libGLESv2 GLESv2 NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH)
find_library(GLESv2_LIBRARY_RELEASE NAMES libGLESv2 GLESv2 NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
select_library_configurations(GLESv2)
find_library(ANGLE_LIBRARY_DEBUG NAMES libANGLE ANGLE NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH)
find_library(ANGLE_LIBRARY_RELEASE NAMES libANGLE ANGLE NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
select_library_configurations(ANGLE)
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${GLESv2_LIBRARY_DEBUG}" "${ANGLE_LIBRARY_DEBUG}" ZLIB::ZLIB D3d9.lib dxguid.lib DXGI.lib)
else()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${GLESv2_LIBRARY_RELEASE}" "${ANGLE_LIBRARY_RELEASE}" ZLIB::ZLIB D3d9.lib dxguid.lib DXGI.lib)
elseif(WIN32)
find_package(unofficial-angle CONFIG)
if(TARGET unofficial::angle::libEGL)
set(EGL_LIBRARY unofficial::angle::libEGL)
if(NOT TARGET EGL::EGL)
add_library(EGL::EGL INTERFACE IMPORTED)
set_target_properties(EGL::EGL PROPERTIES
INTERFACE_LINK_LIBRARIES unofficial::angle::libEGL
)
endif()
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DKHRONOS_STATIC")
find_package(ZLIB REQUIRED)
set(VCPKG_BACKUP_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
set(VCPKG_BACKUP_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
endif()
_find_package(${ARGS})
if(VCPKG_SETUP_EGL AND TARGET EGL::EGL AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND WIN32)
if(GLESv2_LIBRARY_DEBUG)
set_property(TARGET EGL::EGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<CONFIG:DEBUG>:${GLESv2_LIBRARY_DEBUG}>")
endif()
if(ANGLE_LIBRARY_DEBUG)
set_property(TARGET EGL::EGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<CONFIG:DEBUG>:${ANGLE_LIBRARY_DEBUG}>")
endif()
if(GLESv2_LIBRARY_RELEASE)
set_property(TARGET EGL::EGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${GLESv2_LIBRARY_RELEASE}>")
endif()
if(ANGLE_LIBRARY_RELEASE)
set_property(TARGET EGL::EGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${ANGLE_LIBRARY_RELEASE}>")
endif()
set_property(TARGET EGL::EGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "ZLIB::ZLIB;D3d9.lib;dxguid.lib;DXGI.lib")
set(CMAKE_REQUIRED_LIBRARIES "${VCPKG_BACKUP_CMAKE_REQUIRED_LIBRARIES}")
set(CMAKE_REQUIRED_DEFINITIONS "${VCPKG_BACKUP_CMAKE_REQUIRED_DEFINITIONS}")
unset(VCPKG_BACKUP_CMAKE_REQUIRED_LIBRARIES)
unset(VCPKG_BACKUP_CMAKE_REQUIRED_DEFINITIONS)
endif()
unset(VCPKG_SETUP_EGL)

View File

@ -1,6 +1,6 @@
{
"name": "egl",
"version-date": "2022-09-20",
"version-date": "2022-12-04",
"description": "EGL is an interface between Khronos rendering APIs (such as OpenGL, OpenGL ES or OpenVG) and the underlying native platform windowing system.",
"license": null,
"dependencies": [

View File

@ -2129,7 +2129,7 @@
"port-version": 3
},
"egl": {
"baseline": "2022-09-20",
"baseline": "2022-12-04",
"port-version": 0
},
"egl-registry": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d743b37a251739b853acfb4a93bbfe5685fecd07",
"version-date": "2022-12-04",
"port-version": 0
},
{
"git-tree": "b1bc1e659623b2aa81e403d4812debfa1920030e",
"version-date": "2022-09-20",