added an option for choosing between OpenGL/Angle at building time

This commit is contained in:
Luis Ángel San Martín
2015-06-09 19:19:04 +02:00
parent 0461509765
commit ba8892f344
8 changed files with 113 additions and 41 deletions

View File

@ -11,12 +11,17 @@ DEFINES += NOMINMAX YACREADER
#load default build flags
include (../config.pri)
unix:!macx{
QMAKE_CXXFLAGS += -std=c++11
unix:!macx{
QMAKE_CXXFLAGS += -std=c++11
}
Release:DESTDIR = ../release
Debug:DESTDIR = ../debug
CONFIG(force_angle) {
Release:DESTDIR = ../release_angle
Debug:DESTDIR = ../debug_angle
} else {
Release:DESTDIR = ../release
Debug:DESTDIR = ../debug
}
SOURCES += main.cpp
@ -29,15 +34,25 @@ INCLUDEPATH += ../common \
INCLUDEPATH += ../common/gl \
}
#there are going to be two builds for windows, OpenGL based and ANGLE based
win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lopengl32 -lglu32 -luser32
CONFIG(force_angle) {
message("using ANGLE")
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
#linking extra libs are necesary for a successful compilation, a better approach should be
#to remove any OpenGL (desktop) dependencies
#the OpenGL stuff should be migrated to OpenGL ES
DEFINES += FORCE_ANGLE
} else {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32
}
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
QMAKE_CXXFLAGS_RELEASE += /02 /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}
unix:!macx{

View File

@ -59,6 +59,7 @@ class YACReaderApplication: public QApplication
int main(int argc, char * argv[])
{
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
@ -78,9 +79,13 @@ int main(int argc, char * argv[])
QApplication app(argc, argv);
#endif
#ifdef FORCE_ANGLE
app.setAttribute(Qt::AA_UseOpenGLES);
#endif
app.setApplicationName("YACReader");
app.setOrganizationName("YACReader");
qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
//simple command line parser
//will be replaced by QCommandLineParser in the future
QStringList optlist;