Skip to content

Commit

Permalink
Compile fixes for GL ES and Mac
Browse files Browse the repository at this point in the history
For QPA the unix tests are used to determine the availability of OpenGL
ES, so they need to compile even on Mac. Similarly the includes in the
OpenGL module have to be adapted on Mac.

Acked-by: Jørgen Lind
  • Loading branch information
con committed Apr 5, 2011
1 parent 25054c7 commit f3d82a8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 18 deletions.
6 changes: 5 additions & 1 deletion config.tests/unix/opengles1/opengles1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
**
****************************************************************************/

#include <GLES/gl.h>
#ifdef BUILD_ON_MAC
#include <OpenGLES/ES1/gl.h>
#else
#include <GLES/gl.h>
#endif

int main(int, char **)
{
Expand Down
4 changes: 4 additions & 0 deletions config.tests/unix/opengles1/opengles1.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ for(p, QMAKE_LIBDIR_OPENGL_ES1) {

CONFIG -= qt
LIBS += $$QMAKE_LIBS_OPENGL_ES1
mac {
DEFINES += BUILD_ON_MAC
CONFIG -= app_bundle
}
6 changes: 5 additions & 1 deletion config.tests/unix/opengles2/opengles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
**
****************************************************************************/

#include <GLES2/gl2.h>
#ifdef BUILD_ON_MAC
#include <OpenGLES/ES2/gl.h>
#else
#include <GLES2/gl2.h>
#endif

int main(int, char **)
{
Expand Down
4 changes: 4 additions & 0 deletions config.tests/unix/opengles2/opengles2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ for(p, QMAKE_LIBDIR_OPENGL_ES2) {

CONFIG -= qt
LIBS += $$QMAKE_LIBS_OPENGL_ES2
mac {
DEFINES += BUILD_ON_MAC
CONFIG -= app_bundle
}
5 changes: 4 additions & 1 deletion mkspecs/qws/macx-iphonedevice-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER

# You may need to change this to point to the iOS SDK you want to use.
QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneOS.platform/Developer
QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneOS4.2.sdk
QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneOS4.3.sdk
DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200

#clear
QMAKE_MACOSX_DEPLOYMENT_TARGET =

QMAKE_LIBS_OPENGL_ES1 += -framework OpenGLES
QMAKE_LIBS_OPENGL_ES2 += -framework OpenGLES

# TARGET_PLATFORM = ios
QMAKE_CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
Expand Down
3 changes: 3 additions & 0 deletions mkspecs/qws/macx-iphonesimulator-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200
#clear
QMAKE_MACOSX_DEPLOYMENT_TARGET =

QMAKE_LIBS_OPENGL_ES1 += -framework OpenGLES
QMAKE_LIBS_OPENGL_ES2 += -framework OpenGLES

# TARGET_PLATFORM = ios
QMAKE_CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2
QMAKE_CXX = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2
Expand Down
2 changes: 1 addition & 1 deletion src/opengl/opengl.pro
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ x11 {
LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
}

mac {
mac:!qpa {
OBJECTIVE_SOURCES += qgl_mac.mm \
qglpixelbuffer_mac.mm
LIBS_PRIVATE += -framework AppKit -framework Carbon
Expand Down
32 changes: 20 additions & 12 deletions src/opengl/qgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,29 @@ QT_BEGIN_HEADER
#if defined(Q_WS_MAC)
# include <OpenGL/gl.h>
#elif defined(QT_OPENGL_ES_1)
# include <GLES/gl.h>
#ifndef GL_DOUBLE
# define GL_DOUBLE GL_FLOAT
#endif
#ifndef GLdouble
# if defined(Q_OS_MAC)
# include <OpenGLES/ES1/gl.h>
# else
# include <GLES/gl.h>
# endif
# ifndef GL_DOUBLE
# define GL_DOUBLE GL_FLOAT
# endif
# ifndef GLdouble
typedef GLfloat GLdouble;
#endif
# endif
#elif defined(QT_OPENGL_ES_2)
# include <GLES2/gl2.h>
#ifndef GL_DOUBLE
# define GL_DOUBLE GL_FLOAT
#endif
#ifndef GLdouble
# if defined(Q_OS_MAC)
# include <OpenGLES/ES2/gl.h>
# else
# include <GLES2/gl2.h>
# endif
# ifndef GL_DOUBLE
# define GL_DOUBLE GL_FLOAT
# endif
# ifndef GLdouble
typedef GLfloat GLdouble;
#endif
# endif
#else
# include <GL/gl.h>
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/platforms/uikit/README
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ After configuring and building Qt you need to also build src/plugins/platforms/u

Simulator:
----------
configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations
configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -opengl es1 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations

Device:
-------
configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -release -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations
configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -release -opengl es1 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations

2) XCode setup:
- there are examples in the examples subdirectory of the platform plugin
Expand Down

0 comments on commit f3d82a8

Please sign in to comment.