Skip to content

Commit 3467a80

Browse files
authored
Merge pull request #169 from Fearvox/fix/qt68-findwrapopengl-agl-macos-sonoma
build(macos): work around Qt 6.8 FindWrapOpenGL AGL fallback on macOS 14+
2 parents ba11dd3 + bd1689e commit 3467a80

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

fincept-qt/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@ option(FINCEPT_BUILD_TESTS "Build the Fincept Terminal test suite" OFF)
127127
# installer. Developers may override for local experimentation with
128128
# -DFINCEPT_ALLOW_QT_DRIFT=ON (not for CI or release builds).
129129
set(FINCEPT_QT_VERSION 6.8.3)
130+
131+
# Qt 6.8 FindWrapOpenGL.cmake hard-codes "-framework AGL" as a fallback when
132+
# find_library(AGL) fails. Apple removed AGL in macOS 14+ (Sonoma), causing
133+
# linker errors on modern SDKs. Pre-create WrapOpenGL::WrapOpenGL without AGL
134+
# so Qt's FindWrapOpenGL takes its early-return path (target already exists).
135+
if(APPLE AND NOT TARGET WrapOpenGL::WrapOpenGL)
136+
find_package(OpenGL QUIET)
137+
if(OpenGL_FOUND)
138+
add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
139+
get_target_property(_fincept_ogl_loc OpenGL::GL IMPORTED_LOCATION)
140+
if(_fincept_ogl_loc AND NOT _fincept_ogl_loc MATCHES "/([^/]+)\\.framework$")
141+
get_filename_component(_fincept_ogl_path "${_fincept_ogl_loc}" DIRECTORY)
142+
endif()
143+
if(NOT _fincept_ogl_path)
144+
set(_fincept_ogl_path "-framework OpenGL")
145+
endif()
146+
target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE "${_fincept_ogl_path}")
147+
set(WrapOpenGL_FOUND ON)
148+
endif()
149+
endif()
150+
130151
if(FINCEPT_ALLOW_QT_DRIFT)
131152
find_package(Qt6 REQUIRED COMPONENTS
132153
Widgets Charts PrintSupport Network Sql Concurrent Multimedia)

0 commit comments

Comments
 (0)