[Development] Qt5.8/Mac: finding the correct OpenGL libraries when pkg-config is also used
René J.V. Bertin
rjvbertin at gmail.com
Wed Jan 18 13:58:41 CET 2017
Hi,
I'm starting a new thread for this, because it's a much bigger problem than the topic of the thread where I already posted this.
It seems the configure process picks up the X11 libGL when it's available and pkg-config is (has to be!) used to find intended dependencies.
I used to protect against that in the configure script (see the patch below), but the OpenGL detection logic has been moved from out of there, as a number of other things :-/
The patch disabled the pkgconfig check for OpenGL when building for Cocoa, but left it in when building for XCB.
IIUC the basic OpenGL test is now done in GtGui/configure.json . I can remove the pkgConfig "gl" test from that file and it seems this has the expected effect (rebuild has just started), but is there a way to do this conditionally?
Also, I had to clean the whole build directory and reconfigure from scratch to get this change to be taken into account. Is there a less brute way to reconfigure?
Thanks ... again. I hope the new configure system was worth it, for now I'm not seeing any of the benefits I understand it's supposed to have!
R.
diff --git a/qtbase/configure b/qtbase/configure
index 0b8b417..91c6bc1 100755
--- a/qtbase/configure
+++ b/qtbase/configure
@@ -5310,8 +5310,19 @@ if [ "$XPLATFORM_MAC" = "yes" ]; then
fi
# auto-detect OpenGL support (es2 = OpenGL ES 2.0 or higher)
+doOpenGLTest() {
+ if [ "$QT_QPA_DEFAULT_PLATFORM" = "cocoa" ] || [ "$QT_QPA_DEFAULT_PLATFORM" = "" -a "$XPLATFORM_MAC" = "yes" ]; then
+ # QT_QPA_DEFAULT_PLATFORM is either empty or set by the user, so we have to check
+ # both manually and automatically selected cocoa. It qpa=cocoa, we do NOT want to
+ # use pkg-config to find the OpenGL libraries because it's too likely to find
+ # OpenGL libraries that are not the system frameworks appropriate for cocoa mode.
+ compileTest unix/opengldesktop "OpenGL"
+ else
+ compileTestWithPkgConfig gl unix/opengldesktop "OpenGL" OPENGL
+ fi
+}
if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
- if compileTestWithPkgConfig gl unix/opengldesktop "OpenGL" OPENGL; then
+ if doOpenGLTest; then
CFG_OPENGL=desktop
elif compileTestWithPkgConfig glesv2 unix/opengles2 "OpenGL ES 2.0" OPENGL_ES2; then
CFG_OPENGL=es2
@@ -5339,7 +5350,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then
fi
elif [ "$CFG_OPENGL" = "desktop" ]; then
# Desktop OpenGL support
- compileTestWithPkgConfig gl unix/opengldesktop "OpenGL" OPENGL
+ doOpenGLTest
if [ $? != "0" ]; then
echo "The OpenGL functionality test failed!"
echo " You might need to modify the include and library search paths by editing"
More information about the Development
mailing list