[freeglut] Update to 3.2.2, fix X11 dependencies (#23807)

* Update to 3.2.2

* Extend X11 dependencies patch

* Update the FindGLUT wrapper

* Update versions

* Modernize portfile

* Set policies

* Update versions

* Switch to github

* Update versions

* CI

* Replace GLUT_LIBRARIES with GLUT_LINK_LIBRARIES

* Update versions
This commit is contained in:
Kai Pastor 2022-04-05 20:14:30 +02:00 коммит произвёл GitHub
Родитель 6dff39f134
Коммит 90fdea2c82
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 159 добавлений и 112 удалений

Просмотреть файл

@ -1,31 +0,0 @@
diff --git a/src/fg_gl2.h b/src/fg_gl2.h
index ab8ba5c..a1a52da 100644
--- a/src/fg_gl2.h
+++ b/src/fg_gl2.h
@@ -67,13 +67,19 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);
typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
-FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
-FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
-FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
-FGH_PFNGLBUFFERDATAPROC fghBufferData;
-FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
-FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
-FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
+#if __GNUC__ > 9
+#define FG_ATTRIBUTE_COMMON __attribute__((__common__))
+#else
+#define FG_ATTRIBUTE_COMMON
+#endif
+
+FGH_PFNGLGENBUFFERSPROC FG_ATTRIBUTE_COMMON fghGenBuffers;
+FGH_PFNGLDELETEBUFFERSPROC FG_ATTRIBUTE_COMMON fghDeleteBuffers;
+FGH_PFNGLBINDBUFFERPROC FG_ATTRIBUTE_COMMON fghBindBuffer;
+FGH_PFNGLBUFFERDATAPROC FG_ATTRIBUTE_COMMON fghBufferData;
+FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC FG_ATTRIBUTE_COMMON fghEnableVertexAttribArray;
+FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC FG_ATTRIBUTE_COMMON fghDisableVertexAttribArray;
+FGH_PFNGLVERTEXATTRIBPOINTERPROC FG_ATTRIBUTE_COMMON fghVertexAttribPointer;
# endif

Просмотреть файл

@ -1,61 +1,39 @@
vcpkg_from_sourceforge(
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO freeglut/freeglut
REF 3.2.1
FILENAME "freeglut-3.2.1.tar.gz"
SHA512 aced4bbcd36269ce6f4ee1982e0f9e3fffbf18c94f785d3215ac9f4809b992e166c7ada496ed6174e13d77c0f7ef3ca4c57d8a282e96cbbe6ff086339ade3b08
REPO FreeGLUTProject/freeglut
REF v3.2.2
SHA512 caaed8af95c2d0ecbc785229e26433978a0f606ae2b9f0b3cd794bb5bb70a1cc54d21f941a1a03e20c7e0fa3eba9d54a21d6e23e44f243899c0fdf146066cf29
HEAD_REF master
PATCHES
use_targets_to_export_x11_dependency.patch
x11-dependencies-export.patch
macOS_Xquartz.patch
gcc10.patch
fix-debug-macro.patch
no_x64_enforcement.patch
windows-static-output-name.patch
)
if(NOT VCPKG_TARGET_IS_WINDOWS)
message("Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n xrandr\n xi\n xxf86vm\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev\nOn macOS Xquartz is required.")
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(FREEGLUT_STATIC OFF)
set(FREEGLUT_DYNAMIC ON)
else()
set(FREEGLUT_STATIC ON)
set(FREEGLUT_DYNAMIC OFF)
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" FREEGLUT_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" FREEGLUT_DYNAMIC)
# Patch header
file(READ ${SOURCE_PATH}/include/GL/freeglut_std.h FREEGLUT_STDH)
string(REGEX REPLACE "\"freeglut_static.lib\""
"\"freeglut.lib\"" FREEGLUT_STDH "${FREEGLUT_STDH}")
string(REGEX REPLACE "\"freeglut_staticd.lib\""
"\"freeglutd.lib\"" FREEGLUT_STDH "${FREEGLUT_STDH}")
file(WRITE ${SOURCE_PATH}/include/GL/freeglut_std.h "${FREEGLUT_STDH}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DFREEGLUT_BUILD_STATIC_LIBS=${FREEGLUT_STATIC}
-DFREEGLUT_BUILD_SHARED_LIBS=${FREEGLUT_DYNAMIC}
-DFREEGLUT_BUILD_DEMOS=OFF
-DINSTALL_PDB=OFF # Installing pdbs failed on debug static. So, disable it and let vcpkg_copy_pdbs() do it
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/FreeGLUT)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/FreeGLUT)
vcpkg_fixup_pkgconfig()
# Rename static lib (otherwise it's incompatible with FindGLUT.cmake)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/freeglut_static.lib ${CURRENT_PACKAGES_DIR}/lib/freeglut.lib)
endif()
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/freeglut_staticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/freeglutd.lib)
endif()
endif()
vcpkg_replace_string(
"${CURRENT_PACKAGES_DIR}/include/GL/freeglut_std.h"
"ifdef FREEGLUT_STATIC"
@ -66,14 +44,7 @@ endif()
# Clean
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/glut")
vcpkg_copy_pdbs()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/glut)
endif()
vcpkg_fixup_pkgconfig()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

Просмотреть файл

@ -1,23 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f403af..4ced28a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,7 +72,7 @@ SET(FREEGLUT_HEADERS
include/GL/freeglut_ext.h
include/GL/freeglut_std.h
)
-IF(FREEGLUT_REPLACE_GLUT)
+IF(TRUE)
LIST(APPEND FREEGLUT_HEADERS
include/GL/glut.h
)
@@ -312,8 +312,7 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC)
INCLUDE(CheckIncludeFiles)
IF(UNIX AND NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
FIND_PACKAGE(X11 REQUIRED)
- INCLUDE_DIRECTORIES(${X11_X11_INCLUDE_PATH})
- LIST(APPEND LIBS ${X11_X11_LIB})
+ LIST(APPEND LIBS X11::X11)
IF(X11_Xrandr_FOUND)
SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
LIST(APPEND LIBS ${X11_Xrandr_LIB})

Просмотреть файл

@ -1,10 +1,33 @@
_find_package(${ARGS})
if(GLUT_FOUND)
find_library(XRANDR_LIBRARY NAMES xrandr Xrandr)
if(XRANDR_LIBRARY)
list(APPEND GLUT_LIBRARIES ${XRANDR_LIBRARY})
if(TARGET GLUT::GLUT)
set_property(TARGET GLUT::GLUT APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${XRANDR_LIBRARY})
if(GLUT_FOUND AND UNIX AND NOT ANDROID)
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
if(GLUT_LINK_LIBRARIES)
# Since CMake 3.22, FindGLUT.cmake loads the glut pkg-config module.
# We need `-lglut` resolved to an absolute path.
set(GLUT_LIBRARIES "${GLUT_LINK_LIBRARIES}")
else()
find_package(X11)
# Before CMake 3.14, FindX11.cmake doesn't create imported targets.
# For X11, we simply assume shared linkage of system libs,
# so order and transitive usage requirements don't matter.
if(X11_Xrandr_FOUND AND NOT "Xrandr" IN_LIST GLUT_LIBRARIES)
list(APPEND GLUT_LIBRARIES "${X11_Xrandr_LIB}")
set_property(TARGET GLUT::GLUT APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${X11_Xrandr_LIB}")
endif()
# X11_xf86vmode_FOUND for CMake < 3.14
if((X11_xf86vm_FOUND OR X11_xf86vmode_FOUND) AND NOT "Xxf86vm" IN_LIST GLUT_LIBRARIES)
list(APPEND GLUT_LIBRARIES "${X11_Xxf86vm_LIB}")
set_property(TARGET GLUT::GLUT APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${X11_Xxf86vm_LIB}")
endif()
if(X11_Xi_FOUND AND NOT GLUT_Xi_LIBRARY AND NOT "Xi" IN_LIST GLUT_LIBRARIES)
list(APPEND GLUT_LIBRARIES "${X11_Xi_LIB}")
set_property(TARGET GLUT::GLUT APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${X11_Xi_LIB}")
endif()
endif()
cmake_policy(POP)
endif()

Просмотреть файл

@ -1,7 +1,17 @@
{
"name": "freeglut",
"version-string": "3.2.1",
"port-version": 7,
"version": "3.2.2",
"description": "Open source implementation of GLUT with source and binary backwards compatibility.",
"homepage": "https://sourceforge.net/projects/freeglut/"
"homepage": "https://sourceforge.net/projects/freeglut/",
"license": null,
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

Просмотреть файл

@ -0,0 +1,29 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aec0a27..73ccbdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -429,7 +429,7 @@ IF(WIN32)
ENDIF()
IF(FREEGLUT_BUILD_STATIC_LIBS)
TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC FREEGLUT_STATIC)
- IF(FREEGLUT_REPLACE_GLUT)
+ IF(1)
SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
ENDIF()
ENDIF()
diff --git a/include/GL/freeglut_std.h b/include/GL/freeglut_std.h
index a5efb3b..6bdcdfb 100644
--- a/include/GL/freeglut_std.h
+++ b/include/GL/freeglut_std.h
@@ -71,9 +71,9 @@
/* Link with Win32 static freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# if defined(NDEBUG) || !defined(_DEBUG)
-# pragma comment (lib, "freeglut_static.lib")
+# pragma comment (lib, "freeglut.lib")
# else
-# pragma comment (lib, "freeglut_staticd.lib")
+# pragma comment (lib, "freeglutd.lib")
# endif
# endif

Просмотреть файл

@ -0,0 +1,63 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f403af..4ced28a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,7 +72,7 @@ SET(FREEGLUT_HEADERS
include/GL/freeglut_ext.h
include/GL/freeglut_std.h
)
-IF(FREEGLUT_REPLACE_GLUT)
+IF(TRUE)
LIST(APPEND FREEGLUT_HEADERS
include/GL/glut.h
)
@@ -319,23 +319,27 @@ IF(CMAKE_COMPILER_IS_GNUCC)
ENDIF()
ENDIF(CMAKE_COMPILER_IS_GNUCC)
+SET(xlibs_private "")
INCLUDE(CheckIncludeFiles)
IF(UNIX AND NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
FIND_PACKAGE(X11 REQUIRED)
- INCLUDE_DIRECTORIES(${X11_X11_INCLUDE_PATH})
- LIST(APPEND LIBS ${X11_X11_LIB})
+ LIST(APPEND LIBS X11::X11)
+ set(xlibs_private "-lX11")
IF(X11_Xrandr_FOUND)
SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
- LIST(APPEND LIBS ${X11_Xrandr_LIB})
+ LIST(APPEND LIBS X11::Xrandr)
+ STRING(APPEND xlibs_private " -lXrandr")
ENDIF()
- IF(X11_xf86vmode_FOUND)
+ IF(X11_Xxf86vm_FOUND)
SET(HAVE_X11_EXTENSIONS_XF86VMODE_H TRUE)
- LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
+ LIST(APPEND LIBS X11::Xxf86vm)
+ STRING(APPEND xlibs_private " -lXxf86vm")
ENDIF()
IF(X11_Xinput_FOUND)
# Needed for multi-touch:
CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H)
- LIST(APPEND LIBS ${X11_Xinput_LIB})
+ LIST(APPEND LIBS X11::Xi)
+ STRING(APPEND xlibs_private " -lXi")
ELSE()
MESSAGE(FATAL_ERROR "Missing X11's XInput.h (X11/extensions/XInput.h)")
ENDIF()
@@ -586,13 +590,13 @@ ELSEIF(FREEGLUT_GLES)
ELSEIF(FREEGLUT_WAYLAND)
SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGLESv2 -lGLESv1_CM -lEGL -lxkbcommon -lm")
ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm")
+ SET(PC_LIBS_PRIVATE "${xlibs_private} -lGLESv2 -lGLESv1_CM -lEGL -lm")
ENDIF()
ELSE()
IF(FREEGLUT_WAYLAND)
SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGL -lxkbcommon -lm")
ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
+ SET(PC_LIBS_PRIVATE "${xlibs_private} -lGL -lm")
ENDIF()
ENDIF()
# Client applications need to define FreeGLUT GLES version to

Просмотреть файл

@ -2293,8 +2293,8 @@
"port-version": 1
},
"freeglut": {
"baseline": "3.2.1",
"port-version": 7
"baseline": "3.2.2",
"port-version": 0
},
"freeimage": {
"baseline": "3.18.0",

Просмотреть файл

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f4eceb7b1ee13b64d859833d2dce4152233c99bc",
"version": "3.2.2",
"port-version": 0
},
{
"git-tree": "bf1c06d0a07b6bc80a63c3825a4d136f5307a2f4",
"version-string": "3.2.1",