From 8e8010c40bce0fdea5f572b9ee61899bea37a37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 7 Mar 2019 12:20:04 +0100 Subject: [PATCH] Document and print helpful error messages for GL-dependent features. --- doc/building.dox | 56 ++++++++++--------- src/Magnum/GL/CMakeLists.txt | 4 ++ src/Magnum/GL/OpenGLTester.h | 10 ++++ src/Magnum/Platform/AbstractXApplication.h | 10 ++++ src/Magnum/Platform/CMakeLists.txt | 52 +++++++++++++++++ src/Magnum/Platform/GlutApplication.h | 10 ++++ src/Magnum/Platform/GlxApplication.h | 10 ++++ .../Platform/WindowlessCglApplication.h | 14 +++++ .../Platform/WindowlessEglApplication.h | 10 ++++ .../Platform/WindowlessGlxApplication.h | 14 +++++ .../Platform/WindowlessIosApplication.h | 14 +++++ .../Platform/WindowlessWglApplication.h | 14 +++++ .../WindowlessWindowsEglApplication.h | 14 +++++ src/Magnum/Platform/XEglApplication.h | 10 ++++ src/Magnum/Platform/gl-info.cpp | 3 + src/Magnum/Shaders/CMakeLists.txt | 4 ++ src/Magnum/Text/CMakeLists.txt | 4 ++ src/Magnum/Text/fontconverter.cpp | 4 ++ src/Magnum/TextureTools/CMakeLists.txt | 4 ++ .../TextureTools/distancefieldconverter.cpp | 3 + src/MagnumPlugins/MagnumFont/CMakeLists.txt | 6 ++ 21 files changed, 243 insertions(+), 27 deletions(-) diff --git a/doc/building.dox b/doc/building.dox index da79fd4d6..91e89f3cc 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -543,11 +543,11 @@ going to build any of the @ref example-index "examples", you'll need it. [GLFW](http://glfw.org). - `WITH_GLUTAPPLICATION` @m_class{m-label m-danger} **deprecated** --- Build the @ref Platform::GlutApplication "GlutApplication" library. Depends on - [GLUT](http://freeglut.sourceforge.net/). Enables also building of the GL - library. + [GLUT](http://freeglut.sourceforge.net/). Requires `TARGET_GL` to be + enabled. - `WITH_GLXAPPLICATION` --- Build the @ref Platform::GlxApplication "GlxApplication" library. Depends on **X11**. - Enables also building of the GL library. + Requires `TARGET_GL` to be enabled. - `WITH_SDL2APPLICATION` --- Build the @ref Platform::Sdl2Application "Sdl2Application" library. Depends on [SDL2](http://www.libsdl.org). @@ -556,43 +556,43 @@ going to build any of the @ref example-index "examples", you'll need it. building of the GL library. - `WITH_WINDOWLESSCGLAPPLICATION` --- Build the @ref Platform::WindowlessCglApplication "WindowlessCglApplication" library. - Enables also building of the GL library. + Requires `TARGET_GL` to be enabled. - `WITH_WINDOWLESSEGLAPPLICATION` --- Build the @ref Platform::WindowlessEglApplication "WindowlessEglApplication" library. - Enables also building of the GL library. + Requires `TARGET_GL` to be enabled. - `WITH_WINDOWLESSGLXAPPLICATION` --- Build the @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication" library. - Enables also building of the GL library. + Requires `TARGET_GL` to be enabled. - `WITH_WINDOWLESSIOSAPPLICATION` --- Build the @ref Platform::WindowlessIosApplication "WindowlessIosApplication" library. - Enables also building of the GL library. + Requires `TARGET_GL` to be enabled. - `WITH_WINDOWLESSWGLAPPLICATION` --- Build the @ref Platform::WindowlessWglApplication "WindowlessWglApplication" library. - Enables also building of the GL library. + Requires `TARGET_GL` to be enabled. - `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` --- Build the @ref Platform::WindowlessWindowsEglApplication "WindowlessWindowsEglApplication" - library. Enables also building of the GL library. + library. Requires `TARGET_GL` to be enabled. None of the context libraries is built by default. Similarly to the application libraries, they are always built as static. You need them only if you chose to not use any of the application libraries above (see @ref platform-custom for more information): -- `WITH_CGLCONTEXT` --- Build the CGL context handling library. Enables also - building of the GL library. -- `WITH_EGLCONTEXT` --- Build the EGL context handling library. Enables also - building of the GL library. -- `WITH_GLXCONTEXT` --- Build the GLX context handling library. Enables also - building of the GL library. -- `WITH_WGLCONTEXT` --- Build the WGL context handling library. Enables also - building of the GL library. +- `WITH_CGLCONTEXT` --- Build the CGL context handling library. Requires + `TARGET_GL` to be enabled. +- `WITH_EGLCONTEXT` --- Build the EGL context handling library. Requires + `TARGET_GL` to be enabled. +- `WITH_GLXCONTEXT` --- Build the GLX context handling library. Requires + `TARGET_GL` to be enabled. +- `WITH_WGLCONTEXT` --- Build the WGL context handling library. Requires + `TARGET_GL` to be enabled. There are also extensions to @ref Corrade::TestSuite::Tester for testing GPU code: -- `WITH_OPENGLTESTER` --- The @ref GL::OpenGLTester class. Enables also - building of the GL library and one of the windowless application libraries - based on the target platform. +- `WITH_OPENGLTESTER` --- The @ref GL::OpenGLTester class. Requires + `TARGET_GL` to be enabled; enables building of one of the windowless + application libraries based on the target platform. Magnum also contains a set of dependency-less plugins for importing essential file formats. Additional plugins are provided in a separate plugin repository, @@ -610,7 +610,8 @@ default. plugin. Enables also building of the @ref Trade library. - `WITH_MAGNUMFONT` --- Build the @ref Text::MagnumFont "MagnumFont" plugin. Enables also building of the @ref Text library and the - @ref Trade::TgaImporter "TgaImporter" plugin. + @ref Trade::TgaImporter "TgaImporter" plugin. Requires `TARGET_GL` to be + enabled. - `WITH_MAGNUMFONTCONVERTER` --- Build the @ref Text::MagnumFontConverter "MagnumFontConverter" plugin. Enables also building of the @ref Text library and the @@ -629,8 +630,8 @@ There are also a few command-line utilities, also all disabled by default: - `WITH_GL_INFO` --- Build the @ref magnum-gl-info "magnum-gl-info" executable, which provides information about the engine OpenGL - capabilities. Enables building of one of the windowless application - libraries based on the target platform. + capabilities. Requires `TARGET_GL` to be enabled; enables building of one + of the windowless application libraries based on the target platform. - `WITH_AL_INFO` --- Build the @ref magnum-al-info "magnum-al-info" executable, which provides information about the engine OpenAL capabilities. @@ -638,12 +639,13 @@ There are also a few command-line utilities, also all disabled by default: @ref magnum-distancefieldconverter "magnum-distancefieldconverter" executable for converting black&white images to distance field textures. Enables also building of the @ref TextureTools library. Available only on - desktop GL. Enables building of one of the windowless application libraries - based on the target platform. + desktop GL. Requires `TARGET_GL` to be enabled; enables building of one of + the windowless application libraries based on the target platform. - `WITH_FONTCONVERTER` --- Build the @ref magnum-fontconverter "magnum-fontconverter" executable for converting fonts of different formats. Enables also building - of the @ref Text library. Available only on desktop GL. Enables building of - one of the windowless application libraries based on the target platform. + of the @ref Text library. Available only on desktop GL. Requires + `TARGET_GL` to be enabled; enables building of one of the windowless + application libraries based on the target platform. - `WITH_IMAGECONVERTER` --- Build the @ref magnum-imageconverter "magnum-imageconverter" executable for converting images of different formats. diff --git a/src/Magnum/GL/CMakeLists.txt b/src/Magnum/GL/CMakeLists.txt index 62f2a8ba5..fbc7c7cae 100644 --- a/src/Magnum/GL/CMakeLists.txt +++ b/src/Magnum/GL/CMakeLists.txt @@ -240,6 +240,10 @@ install(FILES ${MagnumGL_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/GL) # OpenGLTester class if(WITH_OPENGLTESTER) + if(NOT TARGET_GL) + message(SEND_ERROR "OpenGLTester is available only if TARGET_GL is enabled") + endif() + find_package(Corrade REQUIRED TestSuite) set(MagnumOpenGLTester_SRCS OpenGLTester.cpp) diff --git a/src/Magnum/GL/OpenGLTester.h b/src/Magnum/GL/OpenGLTester.h index 46c9b36f3..eb0d4ebf6 100644 --- a/src/Magnum/GL/OpenGLTester.h +++ b/src/Magnum/GL/OpenGLTester.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::GL::OpenGLTester, macro @ref MAGNUM_VERIFY_NO_GL_ERROR() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include "Magnum/GL/Renderer.h" @@ -134,6 +137,10 @@ on all platforms and not all GL errors are fatal. This class adds @ref BenchmarkType::GpuTime to the benchmark type enum, allowing you to measure time spent on GPU as opposed to CPU or wall clock time. @requires_gles GPU time benchmarking is not available on WebGL. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class OpenGLTester: public TestSuite::Tester { public: @@ -297,5 +304,8 @@ typedef CORRADE_DEPRECATED("use GL::OpenGLTester instead") Magnum::GL::OpenGLTes #endif } +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/AbstractXApplication.h b/src/Magnum/Platform/AbstractXApplication.h index 95c79f11d..42a9bb18b 100644 --- a/src/Magnum/Platform/AbstractXApplication.h +++ b/src/Magnum/Platform/AbstractXApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::AbstractXApplication */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include @@ -59,6 +62,10 @@ Supports keyboard and mouse handling. See @ref platform for brief introduction. @note Not meant to be used directly, see the @ref GlxApplication and @ref XEglApplication subclasses instead. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class AbstractXApplication { public: @@ -663,5 +670,8 @@ class AbstractXApplication::MouseMoveEvent: public AbstractXApplication::InputEv }; }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/CMakeLists.txt b/src/Magnum/Platform/CMakeLists.txt index c9b28d077..dbfdc3261 100644 --- a/src/Magnum/Platform/CMakeLists.txt +++ b/src/Magnum/Platform/CMakeLists.txt @@ -308,6 +308,10 @@ endif() # GLX application if(WITH_GLXAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "GlxApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_ABSTRACTXAPPLICATION 1) set(NEED_GLXCONTEXTHANDLER 1) set(NEED_GLXCONTEXT 1) @@ -351,6 +355,10 @@ endif() # X/EGL application if(WITH_XEGLAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "XEglApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_ABSTRACTXAPPLICATION 1) set(NEED_EGLCONTEXTHANDLER 1) set(NEED_EGLCONTEXT 1) @@ -394,6 +402,10 @@ endif() # Windowless EGL application if(WITH_WINDOWLESSEGLAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "WindowlessEglApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_EGLCONTEXT 1) set(MagnumWindowlessEglApplication_SRCS @@ -429,6 +441,10 @@ endif() # Windowless GLX application if(WITH_WINDOWLESSGLXAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "WindowlessGlxApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_GLXCONTEXT 1) find_package(X11) @@ -471,6 +487,10 @@ endif() # Windowless iOS application if(WITH_WINDOWLESSIOSAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "WindowlessIosApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_EGLCONTEXT 1) # We need to link to Foundation framework to use ObjC @@ -509,6 +529,10 @@ endif() # Windowless WGL application if(WITH_WINDOWLESSWGLAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "WindowlessWglApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_WGLCONTEXT 1) set(MagnumWindowlessWglApplication_SRCS @@ -540,6 +564,10 @@ endif() # Windowless Windows/EGL application if(WITH_WINDOWLESSWINDOWSEGLAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "WindowlessWindowsEglApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_EGLCONTEXT 1) set(MagnumWindowlessWindowsEglApplication_SRCS @@ -575,6 +603,10 @@ endif() # Windowless CGL application if(WITH_WINDOWLESSCGLAPPLICATION) + if(NOT TARGET_GL) + message(SEND_ERROR "WindowlessCglApplication is available only if TARGET_GL is enabled") + endif() + set(NEED_CGLCONTEXT 1) set(MagnumWindowlessCglApplication_SRCS @@ -706,6 +738,10 @@ if(NEED_CGLCONTEXT OR WITH_CGLCONTEXT) # Also create proper static library, if requested if(WITH_CGLCONTEXT) + if(NOT TARGET_GL) + message(SEND_ERROR "CglContext is available only if TARGET_GL is enabled") + endif() + # CMake-generated XCode projects had some problems when library # consisted only of $ entries, thus compiling the # sources again in this case @@ -747,6 +783,10 @@ if(NEED_EGLCONTEXT OR WITH_EGLCONTEXT) # Also create proper static library, if requested if(WITH_EGLCONTEXT) + if(NOT TARGET_GL) + message(SEND_ERROR "EglContext is available only if TARGET_GL is enabled") + endif() + add_library(MagnumEglContext STATIC $ ${PROJECT_SOURCE_DIR}/src/dummy.cpp) # XCode workaround, see file comment for details @@ -782,6 +822,10 @@ if(NEED_GLXCONTEXT OR WITH_GLXCONTEXT) # Also create proper static library, if requested if(WITH_GLXCONTEXT) + if(NOT TARGET_GL) + message(SEND_ERROR "GlxContext is available only if TARGET_GL is enabled") + endif() + add_library(MagnumGlxContext STATIC $) set_target_properties(MagnumGlxContext PROPERTIES DEBUG_POSTFIX "-d" @@ -816,6 +860,10 @@ if(NEED_WGLCONTEXT OR WITH_WGLCONTEXT) # Also create proper static library, if requested if(WITH_WGLCONTEXT) + if(NOT TARGET_GL) + message(SEND_ERROR "WglContext is available only if TARGET_GL is enabled") + endif() + add_library(MagnumWglContext STATIC $) set_target_properties(MagnumWglContext PROPERTIES DEBUG_POSTFIX "-d" @@ -837,6 +885,10 @@ endif() # Magnum GL Info if(WITH_GL_INFO) + if(NOT TARGET_GL) + message(SEND_ERROR "magnum-gl-info is available only if TARGET_GL is enabled") + endif() + add_executable(magnum-gl-info gl-info.cpp) target_link_libraries(magnum-gl-info PRIVATE MagnumGL) if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) diff --git a/src/Magnum/Platform/GlutApplication.h b/src/Magnum/Platform/GlutApplication.h index 4cacc72c0..98c93fcbf 100644 --- a/src/Magnum/Platform/GlutApplication.h +++ b/src/Magnum/Platform/GlutApplication.h @@ -34,6 +34,9 @@ as soon as possible. */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include @@ -115,6 +118,10 @@ MAGNUM_GLUTAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::Application @ce and the macro is aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class CORRADE_DEPRECATED("scheduled for removal, consider switching to Sdl2Application or GlfwApplication instead") GlutApplication { public: @@ -883,5 +890,8 @@ CORRADE_ENUMSET_OPERATORS(GlutApplication::MouseMoveEvent::Buttons) CORRADE_IGNORE_DEPRECATED_POP }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/GlxApplication.h b/src/Magnum/Platform/GlxApplication.h index 726768544..06c2062a1 100644 --- a/src/Magnum/Platform/GlxApplication.h +++ b/src/Magnum/Platform/GlxApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::GlxApplication, macro @ref MAGNUM_GLXAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include "Magnum/Platform/AbstractXApplication.h" #include "Magnum/Platform/Platform.h" @@ -82,6 +85,10 @@ MAGNUM_GLXAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::Application @ce and the macro is aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class GlxApplication: public AbstractXApplication { public: @@ -145,5 +152,8 @@ typedef BasicScreenedApplication ScreenedApplication; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/WindowlessCglApplication.h b/src/Magnum/Platform/WindowlessCglApplication.h index 976639c1d..61c109fda 100644 --- a/src/Magnum/Platform/WindowlessCglApplication.h +++ b/src/Magnum/Platform/WindowlessCglApplication.h @@ -31,6 +31,9 @@ * @brief Class @ref Magnum::Platform::WindowlessCglApplication, @ref Magnum::Platform::WindowlessCglContext, macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include "Magnum/Magnum.h" @@ -55,6 +58,10 @@ Meant to be used when there is a need to manage (multiple) GL contexts manually. See @ref platform-windowless-contexts for more information. If no other application header is included, this class is also aliased to @cpp Platform::WindowlessGLContext @ce. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessCglContext { public: @@ -194,6 +201,10 @@ MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessCglApplication { public: @@ -334,5 +345,8 @@ typedef WindowlessCglContext WindowlessGLContext; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/WindowlessEglApplication.h b/src/Magnum/Platform/WindowlessEglApplication.h index 5618f9450..9d985ebe4 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.h +++ b/src/Magnum/Platform/WindowlessEglApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::WindowlessEglApplication, @ref Magnum::Platform::WindowlessEglContext, macro @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include /* undef Xlib nonsense to avoid conflicts */ @@ -57,6 +60,10 @@ Meant to be used when there is a need to manage (multiple) GL contexts manually. See @ref platform-windowless-contexts for more information. If no other application header is included, this class is also aliased to @cpp Platform::WindowlessGLContext @ce. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessEglContext { public: @@ -473,5 +480,8 @@ typedef WindowlessEglContext WindowlessGLContext; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/WindowlessGlxApplication.h b/src/Magnum/Platform/WindowlessGlxApplication.h index 5217615b3..79018e622 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.h +++ b/src/Magnum/Platform/WindowlessGlxApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::WindowlessGlxApplication, @ref Magnum::Platform::WindowlessGlxContext, macro @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include @@ -61,6 +64,10 @@ Meant to be used when there is a need to manage (multiple) GL contexts manually. See @ref platform-windowless-contexts for more information. If no other application header is included, this class is also aliased to @cpp Platform::WindowlessGLContext @ce. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessGlxContext { public: @@ -289,6 +296,10 @@ MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessGlxApplication { public: @@ -429,5 +440,8 @@ typedef WindowlessGlxContext WindowlessGLContext; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/WindowlessIosApplication.h b/src/Magnum/Platform/WindowlessIosApplication.h index 41295c9fb..9ab7e67ee 100644 --- a/src/Magnum/Platform/WindowlessIosApplication.h +++ b/src/Magnum/Platform/WindowlessIosApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::WindowlessIosApplication, @ref Magnum::Platform::WindowlessIosContext, macro @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include #include @@ -56,6 +59,10 @@ Meant to be used when there is a need to manage (multiple) GL contexts manually. See @ref platform-windowless-contexts for more information. If no other application header is included, this class is also aliased to @cpp Platform::WindowlessGLContext @ce. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessIosContext { public: @@ -192,6 +199,10 @@ MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessIosApplication { public: @@ -332,5 +343,8 @@ typedef WindowlessIosContext WindowlessGLContext; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/WindowlessWglApplication.h b/src/Magnum/Platform/WindowlessWglApplication.h index 3484759c5..ab31d5a37 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.h +++ b/src/Magnum/Platform/WindowlessWglApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::WindowlessWglApplication, @ref Magnum::Platform::WindowlessWglContext, macro @ref MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #ifndef DOXYGEN_GENERATING_OUTPUT #define WIN32_LEAN_AND_MEAN 1 #define VC_EXTRALEAN @@ -61,6 +64,10 @@ Meant to be used when there is a need to manage (multiple) GL contexts manually. See @ref platform-windowless-contexts for more information. If no other application header is included, this class is also aliased to @cpp Platform::WindowlessGLContext @ce. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessWglContext { public: @@ -287,6 +294,10 @@ MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessWglApplication { public: @@ -427,5 +438,8 @@ typedef WindowlessWglContext WindowlessGLContext; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/WindowlessWindowsEglApplication.h b/src/Magnum/Platform/WindowlessWindowsEglApplication.h index b49de67f1..bee9ff276 100644 --- a/src/Magnum/Platform/WindowlessWindowsEglApplication.h +++ b/src/Magnum/Platform/WindowlessWindowsEglApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::WindowlessWindowsEglApplication, @ref Magnum::Platform::WindowlessWindowsEglContext, macro @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #ifndef DOXYGEN_GENERATING_OUTPUT #define WIN32_LEAN_AND_MEAN 1 #define VC_EXTRALEAN @@ -56,6 +59,10 @@ Meant to be used when there is a need to manage (multiple) GL contexts manually. See @ref platform-windowless-contexts for more information. If no other application header is included, this class is also aliased to @cpp Platform::WindowlessGLContext @ce. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessWindowsEglContext { public: @@ -260,6 +267,10 @@ MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class WindowlessWindowsEglApplication { public: @@ -398,5 +409,8 @@ typedef WindowlessWindowsEglContext WindowlessGLContext; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/XEglApplication.h b/src/Magnum/Platform/XEglApplication.h index e42ef0765..ed11f2b49 100644 --- a/src/Magnum/Platform/XEglApplication.h +++ b/src/Magnum/Platform/XEglApplication.h @@ -29,6 +29,9 @@ * @brief Class @ref Magnum::Platform::XEglApplication, macro @ref MAGNUM_XEGLAPPLICATION_MAIN() */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_TARGET_GL #include "Magnum/Platform/Platform.h" #include "Magnum/Platform/AbstractXApplication.h" @@ -83,6 +86,10 @@ MAGNUM_XEGLAPPLICATION_MAIN(MyApplication) If no other application header is included, this class is also aliased to @cpp Platform::Application @ce and the macro is aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting. + +@note This class is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class XEglApplication: public AbstractXApplication { public: @@ -146,5 +153,8 @@ typedef BasicScreenedApplication ScreenedApplication; #endif }} +#else +#error this header is available only in the OpenGL build +#endif #endif diff --git a/src/Magnum/Platform/gl-info.cpp b/src/Magnum/Platform/gl-info.cpp index bac3f9abf..73822f95a 100644 --- a/src/Magnum/Platform/gl-info.cpp +++ b/src/Magnum/Platform/gl-info.cpp @@ -181,6 +181,9 @@ Vendor extension support: ... @endcode +@note This executable is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ class MagnumInfo: public Platform::WindowlessApplication { diff --git a/src/Magnum/Shaders/CMakeLists.txt b/src/Magnum/Shaders/CMakeLists.txt index 7f6d71eaf..6a5c30a8e 100644 --- a/src/Magnum/Shaders/CMakeLists.txt +++ b/src/Magnum/Shaders/CMakeLists.txt @@ -23,6 +23,10 @@ # DEALINGS IN THE SOFTWARE. # +if(NOT WITH_GL) + message(SEND_ERROR "Shaders are available only if WITH_GL is enabled") +endif() + corrade_add_resource(MagnumShaders_RCS resources.conf) set_target_properties(MagnumShaders_RCS-dependencies PROPERTIES FOLDER "Magnum/Shaders") diff --git a/src/Magnum/Text/CMakeLists.txt b/src/Magnum/Text/CMakeLists.txt index 8cfa5bfd6..72eca933e 100644 --- a/src/Magnum/Text/CMakeLists.txt +++ b/src/Magnum/Text/CMakeLists.txt @@ -104,6 +104,10 @@ install(TARGETS MagnumText install(FILES ${MagnumText_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Text) if(WITH_FONTCONVERTER) + if(NOT TARGET_GL) + message(SEND_ERROR "magnum-fontconverter is available only if TARGET_GL is enabled") + endif() + add_executable(magnum-fontconverter fontconverter.cpp) target_link_libraries(magnum-fontconverter PRIVATE Magnum diff --git a/src/Magnum/Text/fontconverter.cpp b/src/Magnum/Text/fontconverter.cpp index dd487dddc..a7021871a 100644 --- a/src/Magnum/Text/fontconverter.cpp +++ b/src/Magnum/Text/fontconverter.cpp @@ -120,6 +120,10 @@ According to @ref Text::MagnumFontConverter "MagnumFontConverter" plugin documentation, this will generate files `myfont.conf` and `myfont.tga` in current directory. You can then load and use them via the @ref Text::MagnumFont "MagnumFont" plugin. + +@note This executable is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ namespace Text { diff --git a/src/Magnum/TextureTools/CMakeLists.txt b/src/Magnum/TextureTools/CMakeLists.txt index a331fd068..e4390fda5 100644 --- a/src/Magnum/TextureTools/CMakeLists.txt +++ b/src/Magnum/TextureTools/CMakeLists.txt @@ -67,6 +67,10 @@ install(TARGETS MagnumTextureTools install(FILES ${MagnumTextureTools_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/TextureTools) if(WITH_DISTANCEFIELDCONVERTER) + if(NOT TARGET_GL) + message(SEND_ERROR "magnum-distancefieldconverter is available only if TARGET_GL is enabled") + endif() + add_executable(magnum-distancefieldconverter distancefieldconverter.cpp) target_link_libraries(magnum-distancefieldconverter PRIVATE Magnum diff --git a/src/Magnum/TextureTools/distancefieldconverter.cpp b/src/Magnum/TextureTools/distancefieldconverter.cpp index 4ffdd8f6e..0585bf858 100644 --- a/src/Magnum/TextureTools/distancefieldconverter.cpp +++ b/src/Magnum/TextureTools/distancefieldconverter.cpp @@ -124,6 +124,9 @@ This will open monochrome `logo-src.png` image using any plugin that can open PNG files and converts it to 256x256 distance field `logo.png` using any plugin that can write PNG files. +@note This executable is available only if Magnum is compiled with + @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features + for more information. */ namespace TextureTools { diff --git a/src/MagnumPlugins/MagnumFont/CMakeLists.txt b/src/MagnumPlugins/MagnumFont/CMakeLists.txt index 1acdabe19..66443bf09 100644 --- a/src/MagnumPlugins/MagnumFont/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFont/CMakeLists.txt @@ -23,6 +23,12 @@ # DEALINGS IN THE SOFTWARE. # +if(NOT TARGET_GL) + # TODO: remove (and update all other docs) when we have better + # createGlyphCache() APIs + message(SEND_ERROR "MagnumFont is available only if TARGET_GL is enabled") +endif() + find_package(Corrade REQUIRED PluginManager) if(BUILD_PLUGINS_STATIC)