diff --git a/CMakeLists.txt b/CMakeLists.txt index f6a2e2c..8f6125f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ endif() option(UTILS "Build various utils" ${_plugins_default_}) option(DESIGNER_PLUGINS "Build Qt designer plugins" ${_plugins_default_}) +option(HAS_GL "Build with OpenGL" ${_plugins_default_}) macro(qad_library NAME _MODULES _LIBS) shstk_qad_project(qad_${NAME} FALSE "qad" "${_MODULES}" "${_LIBS}" ${ARGN}) diff --git a/libs/graphic/CMakeLists.txt b/libs/graphic/CMakeLists.txt index 8ef4b88..81dc702 100644 --- a/libs/graphic/CMakeLists.txt +++ b/libs/graphic/CMakeLists.txt @@ -1 +1,10 @@ -qad_library(graphic "Gui;Widgets;OpenGL;OpenGLWidgets" "qad_widgets;${OPENGL_LIBRARIES}") +set(_mods Gui Widgets) +set(_libs qad_widgets) +if (HAS_GL) + list(APPEND _mods OpenGL OpenGLWidgets) + list(APPEND _libs ${OPENGL_LIBRARIES}) +endif() +qad_library(graphic "${_mods}" "${_libs}") +if (NOT HAS_GL) + qad_target_compile_definitions(qad_graphic PRIVATE FORCE_NO_GL) +endif() diff --git a/libs/graphic/graphic.cpp b/libs/graphic/graphic.cpp index 7c6e6e7..7a1135e 100644 --- a/libs/graphic/graphic.cpp +++ b/libs/graphic/graphic.cpp @@ -15,7 +15,9 @@ # include #endif #ifndef Q_OS_ANDROID -# define HAS_GL +# ifndef FORCE_NO_GL +# define HAS_GL +# endif #endif #ifdef HAS_GL # ifndef GL_MULTISAMPLE @@ -361,7 +363,7 @@ void Graphic::canvasPaintEvent() { if (grid) drawGrid(); p.setRenderHint(QPainter::Antialiasing, aalias); -#ifndef ANDROID +#ifdef HAS_GL if (isOGL) { if (aalias) glEnable(GL_MULTISAMPLE); else glDisable(GL_MULTISAMPLE); @@ -1627,6 +1629,10 @@ void Graphic::on_graphic_buttonConfigure_clicked() { conf->ui->comboStyleGrid->setCurrentIndex((int)grid_pen.style()); conf->ui->spinWidthGrid->setValue(grid_pen.widthF()); conf->ui->checkOGL->setChecked(isOGL); +#ifndef HAS_GL + conf->ui->checkOGL->setEnabled(false); + conf->ui->checkOGL->setChecked(false); +#endif conf->ui->checkAAlias->setChecked(aalias); conf->ui->checkInputs->setChecked(borderInputsVisible()); conf->ui->checkStatus->setChecked(statusVisible()); diff --git a/libs/qglview/CMakeLists.txt b/libs/qglview/CMakeLists.txt index d12965a..7296f0c 100644 --- a/libs/qglview/CMakeLists.txt +++ b/libs/qglview/CMakeLists.txt @@ -1,4 +1,4 @@ -if (((DEFINED QGLVIEW) AND QGLVIEW) OR (NOT DEFINED QGLVIEW)) +if (((DEFINED QGLVIEW) AND QGLVIEW AND HAS_GL) OR (NOT DEFINED QGLVIEW)) find_package(OpenGL REQUIRED) shstk_qad_project(qglview FALSE "qad" "Gui;OpenGL;Xml" "qad_widgets;qad_utils;${OPENGL_LIBRARIES}") shstk_qad_install("qad" FALSE qglview "${out_HDR}" "${out_QM}")