From 7e1037ceda1ca7b64cf30dd0f71e4fb0c5401e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 14:47:42 +0100 Subject: [PATCH 01/10] FindMagnum: added also MAGNUM_WINDOWLESSAPPLICATION_* aliases. --- modules/FindMagnum.cmake | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index ceae0e368..d779170e8 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -41,10 +41,11 @@ # MAGNUM_*_FOUND - Whether the component was found # MAGNUM_*_LIBRARIES - Component library and dependent libraries # MAGNUM_*_INCLUDE_DIRS - Include dirs of module dependencies -# If exactly one *Application component is requested and found, its -# libraries and include dirs are also available in convenience aliases -# MAGNUM_APPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS to -# simplify porting. +# If exactly one *Application or exactly one Windowless*Application +# component is requested and found, its libraries and include dirs are +# available in convenience aliases MAGNUM_APPLICATION_LIBRARIES or +# MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS +# or MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS to simplify porting. # # Features of found Magnum library are exposed in these variables: # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES @@ -288,10 +289,17 @@ foreach(component ${Magnum_FIND_COMPONENTS}) # Don't expose variables w/o dependencies to end users mark_as_advanced(FORCE MAGNUM_${_COMPONENT}_LIBRARY _MAGNUM_${_COMPONENT}_INCLUDE_DIR) - # If this is application library, make it available also in global - # MAGNUM_APPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS. If - # these variables are already set, unset them to avoid ambiguity. - if(${component} MATCHES .+Application) + # Global aliases for Windowless*Application and *Application components. + # If already set, unset them to avoid ambiguity. + if(${component} MATCHES Windowless.+Application) + if(NOT DEFINED MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES AND NOT DEFINED MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS) + set(MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES ${MAGNUM_${_COMPONENT}_LIBRARIES}) + set(MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS ${MAGNUM_${_COMPONENT}_INCLUDE_DIRS}) + else() + unset(MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES) + unset(MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS) + endif() + elseif(${component} MATCHES .+Application) if(NOT DEFINED MAGNUM_APPLICATION_LIBRARIES AND NOT DEFINED MAGNUM_APPLICATION_INCLUDE_DIRS) set(MAGNUM_APPLICATION_LIBRARIES ${MAGNUM_${_COMPONENT}_LIBRARIES}) set(MAGNUM_APPLICATION_INCLUDE_DIRS ${MAGNUM_${_COMPONENT}_INCLUDE_DIRS}) From 29cb2a8d7a1b9e174ca5434201e4a88f4d871fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 14:49:40 +0100 Subject: [PATCH 02/10] Platform: added MAGNUM_WINDOWLESSAPPLICATION_MAIN() alias. Treating windowless application differently to windowed ones, as they don't share any API with them. --- src/Platform/WindowlessGlxApplication.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Platform/WindowlessGlxApplication.h b/src/Platform/WindowlessGlxApplication.h index 71569af0a..8a34e1f91 100644 --- a/src/Platform/WindowlessGlxApplication.h +++ b/src/Platform/WindowlessGlxApplication.h @@ -96,8 +96,8 @@ int main(int argc, char** argv) { return app.exec(); } @endcode -When no other application header is included this macro is also aliased to -`MAGNUM_APPLICATION_MAIN()`. +When no other windowless application header is included this macro is also +aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. */ #define MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(className) \ int main(int argc, char** argv) { \ @@ -106,10 +106,10 @@ When no other application header is included this macro is also aliased to } #ifndef DOXYGEN_GENERATING_OUTPUT -#ifndef MAGNUM_APPLICATION_MAIN -#define MAGNUM_APPLICATION_MAIN(className) MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(className) +#ifndef MAGNUM_WINDOWLESSAPPLICATION_MAIN +#define MAGNUM_WINDOWLESSAPPLICATION_MAIN(className) MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(className) #else -#undef MAGNUM_APPLICATION_MAIN +#undef MAGNUM_WINDOWLESSAPPLICATION_MAIN #endif #endif From 508dd4d94d823659c49f6a6fb77918df33ae7dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 14:55:59 +0100 Subject: [PATCH 03/10] Platform: have special MAGNUM_*APPLICATION_MAIN() for each class. --- src/Platform/AbstractXApplication.h | 30 ------------------------- src/Platform/GlxApplication.h | 34 +++++++++++++++++++++++++++-- src/Platform/XEglApplication.h | 34 +++++++++++++++++++++++++++-- 3 files changed, 64 insertions(+), 34 deletions(-) diff --git a/src/Platform/AbstractXApplication.h b/src/Platform/AbstractXApplication.h index 415105fa1..04fdad3c6 100644 --- a/src/Platform/AbstractXApplication.h +++ b/src/Platform/AbstractXApplication.h @@ -370,36 +370,6 @@ class AbstractXApplication::MouseMoveEvent: public AbstractXApplication::InputEv const Vector2i _position; }; -/** @hideinitializer -@brief Entry point for X11-based applications -@param className Class name - -Can be used with AbstractXApplication subclasses as equivalent to the -following code to achieve better portability, see @ref portability-applications -for more information. -@code -int main(int argc, char** argv) { - className app(argc, argv); - return app.exec(); -} -@endcode -When no other application header is included this macro is also aliased to -`MAGNUM_APPLICATION_MAIN()`. -*/ -#define MAGNUM_XAPPLICATION_MAIN(className) \ - int main(int argc, char** argv) { \ - className app(argc, argv); \ - return app.exec(); \ - } - -#ifndef DOXYGEN_GENERATING_OUTPUT -#ifndef MAGNUM_APPLICATION_MAIN -#define MAGNUM_APPLICATION_MAIN(className) MAGNUM_XAPPLICATION_MAIN(className) -#else -#undef MAGNUM_APPLICATION_MAIN -#endif -#endif - /* Implementations for inline functions with unused parameters */ inline void AbstractXApplication::keyPressEvent(KeyEvent&) {} inline void AbstractXApplication::keyReleaseEvent(KeyEvent&) {} diff --git a/src/Platform/GlxApplication.h b/src/Platform/GlxApplication.h index 1f1f4ea5f..5fb0b4f88 100644 --- a/src/Platform/GlxApplication.h +++ b/src/Platform/GlxApplication.h @@ -43,12 +43,12 @@ targetting OpenGL ES. Uses GlxContextHandler. You need to implement at least drawEvent() and viewportEvent() to be able to draw on the screen. The subclass can be then used directly in `main()` - see -convenience macro MAGNUM_XAPPLICATION_MAIN(). +convenience macro MAGNUM_GLXAPPLICATION_MAIN(). @code class MyApplication: public Magnum::Platform::GlxApplication { // implement required methods... }; -MAGNUM_XAPPLICATION_MAIN(MyApplication) +MAGNUM_GLXAPPLICATION_MAIN(MyApplication) @endcode */ class GlxApplication: public AbstractXApplication { @@ -63,6 +63,36 @@ class GlxApplication: public AbstractXApplication { inline explicit GlxApplication(int& argc, char** argv, const std::string& title = "Magnum GLX application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new GlxContextHandler, argc, argv, title, size) {} }; +/** @hideinitializer +@brief Entry point for GLX-based applications +@param className Class name + +Can be used with GlxApplication subclasses as equivalent to the following code +to achieve better portability, see @ref portability-applications for more +information. +@code +int main(int argc, char** argv) { + className app(argc, argv); + return app.exec(); +} +@endcode +When no other application header is included this macro is also aliased to +`MAGNUM_APPLICATION_MAIN()`. +*/ +#define MAGNUM_GLXAPPLICATION_MAIN(className) \ + int main(int argc, char** argv) { \ + className app(argc, argv); \ + return app.exec(); \ + } + +#ifndef DOXYGEN_GENERATING_OUTPUT +#ifndef MAGNUM_APPLICATION_MAIN +#define MAGNUM_APPLICATION_MAIN(className) MAGNUM_GLXAPPLICATION_MAIN(className) +#else +#undef MAGNUM_APPLICATION_MAIN +#endif +#endif + }} #endif diff --git a/src/Platform/XEglApplication.h b/src/Platform/XEglApplication.h index b37ac0328..3a0e71703 100644 --- a/src/Platform/XEglApplication.h +++ b/src/Platform/XEglApplication.h @@ -43,12 +43,12 @@ EglContextHandler. You need to implement at least drawEvent() and viewportEvent() to be able to draw on the screen. The subclass can be then used directly in `main()` - see -convenience macro MAGNUM_XAPPLICATION_MAIN(). +convenience macro MAGNUM_XEGLAPPLICATION_MAIN(). @code class MyApplication: public Magnum::Platform::XEglApplication { // implement required methods... }; -MAGNUM_XAPPLICATION_MAIN(MyApplication) +MAGNUM_XEGLAPPLICATION_MAIN(MyApplication) @endcode */ class XEglApplication: public AbstractXApplication { @@ -63,6 +63,36 @@ class XEglApplication: public AbstractXApplication { inline explicit XEglApplication(int& argc, char** argv, const std::string& title = "Magnum X/EGL application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new EglContextHandler, argc, argv, title, size) {} }; +/** @hideinitializer +@brief Entry point for X/EGL-based applications +@param className Class name + +Can be used with XEglApplication subclasses as equivalent to the following code +to achieve better portability, see @ref portability-applications for more +information. +@code +int main(int argc, char** argv) { + className app(argc, argv); + return app.exec(); +} +@endcode +When no other application header is included this macro is also aliased to +`MAGNUM_APPLICATION_MAIN()`. +*/ +#define MAGNUM_XEGLAPPLICATION_MAIN(className) \ + int main(int argc, char** argv) { \ + className app(argc, argv); \ + return app.exec(); \ + } + +#ifndef DOXYGEN_GENERATING_OUTPUT +#ifndef MAGNUM_APPLICATION_MAIN +#define MAGNUM_APPLICATION_MAIN(className) MAGNUM_XEGLAPPLICATION_MAIN(className) +#else +#undef MAGNUM_APPLICATION_MAIN +#endif +#endif + }} #endif From 2c8a4c306c8dac910d6ff865619b12f69ade043c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 15:10:18 +0100 Subject: [PATCH 04/10] Platform: added Application and WindowlessApplication aliases. If only one *Application or Windowless*Application header is included, the class is aliased to Application or WindowlessApplication to simplify porting. --- doc/portability.dox | 19 ++++++++----------- src/Platform/GlutApplication.h | 5 +++++ src/Platform/GlxApplication.h | 5 +++++ src/Platform/NaClApplication.h | 5 +++++ src/Platform/Sdl2Application.h | 5 +++++ src/Platform/WindowlessGlxApplication.h | 5 +++++ src/Platform/XEglApplication.h | 5 +++++ 7 files changed, 38 insertions(+), 11 deletions(-) diff --git a/doc/portability.dox b/doc/portability.dox index 113177123..ff79d2ec9 100644 --- a/doc/portability.dox +++ b/doc/portability.dox @@ -164,9 +164,12 @@ mouse movement events etc. In most cases the entry point is classic `main()` function, but some platforms (e.g. Native Client) have different requirements. To make things easier, entry -points are handled using macros, which take care of the rest. Each application -has its own specific macro and if no other application header is included, the -macro is also aliased to MAGNUM_APPLICATION_MAIN() to save you typing. +points are handled using macros, which take care of the rest. + +If only one `*Application` or `*WindowlessApplication` header is included, the +application class is aliased to `Platform::Application` or `Platform::WindowlessApplication` +and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` or `MAGNUM_WINDOWLESSAPPLICATION_MAIN()` +to simplify porting. Example application, which targets both embedded Linux (using plain X and EGL) and desktop (using SDL2 toolkit). Thanks to static polymorphism most of the @@ -179,15 +182,9 @@ particular *Event class implementations: #include #endif -#ifndef MAGNUM_TARGET_GLES -typedef Platform::Sdl2Application ApplicationBase; -#else -typedef Platform::XEglApplication ApplicationBase; -#endif - -class MyApplication: public ApplicationBase { +class MyApplication: public Platform::Application { public: - MyApplication(int& argc, char** argv): ApplicationBase(argc, argv, "My Application") { + MyApplication(int& argc, char** argv): Platform::Application(argc, argv, "My Application") { // ... } diff --git a/src/Platform/GlutApplication.h b/src/Platform/GlutApplication.h index 2dd33de0c..ccf90113a 100644 --- a/src/Platform/GlutApplication.h +++ b/src/Platform/GlutApplication.h @@ -60,6 +60,10 @@ class MyApplication: public Magnum::Platform::GlutApplication { }; MAGNUM_GLUTAPPLICATION_MAIN(MyApplication) @endcode + +If no other application header is included this class is also aliased to +`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` +to simplify porting. */ class GlutApplication { public: @@ -386,6 +390,7 @@ When no other application header is included this macro is also aliased to #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_APPLICATION_MAIN +typedef GlutApplication Application; #define MAGNUM_APPLICATION_MAIN(className) MAGNUM_GLUTAPPLICATION_MAIN(className) #else #undef MAGNUM_APPLICATION_MAIN diff --git a/src/Platform/GlxApplication.h b/src/Platform/GlxApplication.h index 5fb0b4f88..e5f8f470b 100644 --- a/src/Platform/GlxApplication.h +++ b/src/Platform/GlxApplication.h @@ -50,6 +50,10 @@ class MyApplication: public Magnum::Platform::GlxApplication { }; MAGNUM_GLXAPPLICATION_MAIN(MyApplication) @endcode + +If no other application header is included this class is also aliased to +`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` +to simplify porting. */ class GlxApplication: public AbstractXApplication { public: @@ -87,6 +91,7 @@ When no other application header is included this macro is also aliased to #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_APPLICATION_MAIN +typedef GlxApplication Application; #define MAGNUM_APPLICATION_MAIN(className) MAGNUM_GLXAPPLICATION_MAIN(className) #else #undef MAGNUM_APPLICATION_MAIN diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index da9c6a497..7ba5aa39d 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -67,6 +67,10 @@ class MyApplication: public Magnum::Platform::Sdl2Application { }; MAGNUM_NACLAPPLICATION_MAIN(MyApplication) @endcode + +If no other application header is included this class is also aliased to +`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` +to simplify porting. */ class NaClApplication: public pp::Instance, public pp::Graphics3DClient, public pp::MouseLock { public: @@ -483,6 +487,7 @@ When no other application header is included this macro is also aliased to #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_APPLICATION_MAIN +typedef NaClApplication Application; #define MAGNUM_APPLICATION_MAIN(className) MAGNUM_NACLAPPLICATION_MAIN(className) #else #undef MAGNUM_APPLICATION_MAIN diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index e7c69601b..356b5109d 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -62,6 +62,10 @@ class MyApplication: public Magnum::Platform::Sdl2Application { }; MAGNUM_SDL2APPLICATION_MAIN(MyApplication) @endcode + +If no other application header is included this class is also aliased to +`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` +to simplify porting. */ class Sdl2Application { public: @@ -435,6 +439,7 @@ When no other application header is included this macro is also aliased to #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_APPLICATION_MAIN +typedef Sdl2Application Application; #define MAGNUM_APPLICATION_MAIN(className) MAGNUM_SDL2APPLICATION_MAIN(className) #else #undef MAGNUM_APPLICATION_MAIN diff --git a/src/Platform/WindowlessGlxApplication.h b/src/Platform/WindowlessGlxApplication.h index 8a34e1f91..b3b86ddea 100644 --- a/src/Platform/WindowlessGlxApplication.h +++ b/src/Platform/WindowlessGlxApplication.h @@ -55,6 +55,10 @@ class MyApplication: public Magnum::Platform::WindowlessGlxApplication { }; MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(MyApplication) @endcode + +If no other application header is included this class is also aliased to +`Platform::WindowlessApplication` and the macro is aliased to +`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. */ class WindowlessGlxApplication { public: @@ -107,6 +111,7 @@ aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_WINDOWLESSAPPLICATION_MAIN +typedef WindowlessGlxApplication WindowlessApplication; #define MAGNUM_WINDOWLESSAPPLICATION_MAIN(className) MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(className) #else #undef MAGNUM_WINDOWLESSAPPLICATION_MAIN diff --git a/src/Platform/XEglApplication.h b/src/Platform/XEglApplication.h index 3a0e71703..65cc2d5ae 100644 --- a/src/Platform/XEglApplication.h +++ b/src/Platform/XEglApplication.h @@ -50,6 +50,10 @@ class MyApplication: public Magnum::Platform::XEglApplication { }; MAGNUM_XEGLAPPLICATION_MAIN(MyApplication) @endcode + +If no other application header is included this class is also aliased to +`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` +to simplify porting. */ class XEglApplication: public AbstractXApplication { public: @@ -87,6 +91,7 @@ When no other application header is included this macro is also aliased to #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_APPLICATION_MAIN +typedef XEglApplication Application; #define MAGNUM_APPLICATION_MAIN(className) MAGNUM_XEGLAPPLICATION_MAIN(className) #else #undef MAGNUM_APPLICATION_MAIN From 804cd71f3da1c8ec49e01e01c3eed0f9ca67c77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 15:12:01 +0100 Subject: [PATCH 05/10] Link to namespace-related documentation from namespaces. --- doc/namespaces.dox | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/namespaces.dox b/doc/namespaces.dox index 179c15fc5..e15b9876f 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -50,7 +50,7 @@ Base classes for creating applications with various toolkits. @brief %Math library Template classes for matrix and vector calculations. See @ref matrix-vector -for brief introduction. +and @ref transformations for introduction. */ /** @dir Math/Algorithms @@ -77,7 +77,8 @@ Functions for computing intersections, distances, areas and volumes. /** @namespace Magnum::DebugTools @brief %Debug tools -Debugging helpers, renderers and profilers. +Debugging helpers, renderers and profilers. See @ref debug-tools for +introduction. */ /** @dir MeshTools From 3a8a95107f813d0f6f41f83afd429178ff298c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 19:59:30 +0100 Subject: [PATCH 06/10] Updated FindCorrade.cmake from Corrade repository. --- modules/FindCorrade.cmake | 50 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index fee294752..ef56feca3 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -4,30 +4,25 @@ # find_package(Corrade [REQUIRED]) # This module tries to find Corrade library and then defines: # CORRADE_FOUND - True if Corrade library is found -# CORRADE_INCLUDE_DIR - Include dir for Corrade -# CORRADE_INTERCONNECT_LIBRARIES - Corrade Interconnect library and -# dependent libraries -# CORRADE_UTILITY_LIBRARIES - Corrade Utility library and -# dependent libraries -# CORRADE_PLUGINMANAGER_LIBRARIES - Corrade PluginManager library and -# dependent libraries -# CORRADE_TESTSUITE_LIBRARIES - Corrade TestSuite library and -# dependent libraries -# CORRADE_RC_EXECUTABLE - Corrade resource compiler executable -# Additionally these variables are defined for internal usage: -# CORRADE_INTERCONNECT_LIBRARY - Corrade Interconnect library (w/o -# dependencies) -# CORRADE_UTILITY_LIBRARY - Corrade Utility library (w/o -# dependencies) -# CORRADE_PLUGINMANAGER_LIBRARY - Corrade Plugin manager library (w/o -# dependencies) -# CORRADE_TESTSUITE_LIBRARY - Corrade TestSuite library (w/o -# dependencies) +# CORRADE_INCLUDE_DIR - Root include dir +# CORRADE_INTERCONNECT_LIBRARIES - Interconnect library and dependent +# libraries +# CORRADE_UTILITY_LIBRARIES - Utility library and dependent +# libraries +# CORRADE_PLUGINMANAGER_LIBRARIES - PluginManager library and dependent +# libraries +# CORRADE_TESTSUITE_LIBRARIES - TestSuite library and dependent +# libraries +# CORRADE_RC_EXECUTABLE - Resource compiler executable # Corrade configures the compiler to use C++11 standard. Additionally you can # use CORRADE_CXX_FLAGS to enable additional pedantic set of warnings and enable # hidden visibility by default. # -# If Corrade library is found, these macros and functions are defined: +# Features of found Corrade library are exposed in these variables: +# CORRADE_GCC46_COMPATIBILITY - Defined if compiled with compatibility +# mode for GCC 4.6 +# +# Corrade provides these macros and functions: # # # Add unit test using Corrade's TestSuite. @@ -36,7 +31,7 @@ # [LIBRARIES libraries...]) # Test name is also executable name. You can also specify libraries to link # with instead of using target_link_libraries(). CORRADE_TESTSUITE_LIBRARIES -# are linked atuomatically to each test. Note that the enable_testing() +# are linked automatically to each test. Note that the enable_testing() # function must be called explicitly. # # @@ -47,7 +42,7 @@ # Depends on corrade-rc, which is part of Corrade utilities. This command # generates resource file with group group_name from given files in current # build directory. Argument name is name under which the resources can be -# explicitly loaded. Variable 'name' contains compiled resource filename, +# explicitly loaded. Variable `name` contains compiled resource filename, # which is then used for compiling library / executable. Example usage: # corrade_add_resource(name group_name file1 ALIAS alias1 file2 file3) # add_executable(app source1 source2 ... ${name}) @@ -58,7 +53,7 @@ # The macro adds preprocessor directive CORRADE_DYNAMIC_PLUGIN. Additional # libraries can be linked in via target_link_libraries(plugin_name ...). If # install_dir is set to CMAKE_CURRENT_BINARY_DIR (e.g. for testing purposes), -# the files are copied directly, without need to run 'make install'. +# the files are copied directly, without need to run `make install`. # # # Add static plugin. @@ -84,6 +79,15 @@ # also contain paths, they will be installed into exact specified path. If an # DLL is not found, fatal error message is printed. # +# +# Additionally these variables are defined for internal usage: +# CORRADE_INTERCONNECT_LIBRARY - Interconnect library (w/o +# dependencies) +# CORRADE_UTILITY_LIBRARY - Utility library (w/o dependencies) +# CORRADE_PLUGINMANAGER_LIBRARY - Plugin manager library (w/o +# dependencies) +# CORRADE_TESTSUITE_LIBRARY - TestSuite library (w/o dependencies) +# # # This file is part of Corrade. From fe45143617d53af1747dc0b4a3da60aa2328901d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 20:01:08 +0100 Subject: [PATCH 07/10] Added dummy documentation file for Platform namespace. Will be written later, hopefully. --- doc/features.dox | 1 + doc/namespaces.dox | 3 ++- doc/platform.dox | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 doc/platform.dox diff --git a/doc/features.dox b/doc/features.dox index 2e0813e95..f06747f7c 100644 --- a/doc/features.dox +++ b/doc/features.dox @@ -26,6 +26,7 @@ namespace Magnum { /** @page features Feature overview @brief Fundamental principles and design goals +- @subpage platform -- @copybrief platform - @subpage types -- @copybrief types - @subpage matrix-vector -- @copybrief matrix-vector - @subpage transformations -- @copybrief transformations diff --git a/doc/namespaces.dox b/doc/namespaces.dox index e15b9876f..3fd741cb4 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -40,7 +40,8 @@ Contains classes for interacting with OpenGL. /** @namespace Magnum::Platform @brief Platform-specific application and context creation -Base classes for creating applications with various toolkits. +Base classes for creating applications with various toolkits. See @ref platform +for introduction. */ /** @dir Math diff --git a/doc/platform.dox b/doc/platform.dox new file mode 100644 index 000000000..15e664c7c --- /dev/null +++ b/doc/platform.dox @@ -0,0 +1,35 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +namespace Magnum { +/** @page platform Platform support + +@brief Integration into windowing toolkits and creation of windowless contexts + +@tableofcontents + +@todoc write when the API is stabilized + +*/ +} From 2040e34dd6c9bc0cd759a4170b6b6afcef703402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 20:02:23 +0100 Subject: [PATCH 08/10] Documented also CMake side of platform portability. --- doc/portability.dox | 53 ++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/doc/portability.dox b/doc/portability.dox index ff79d2ec9..b8f7082c8 100644 --- a/doc/portability.dox +++ b/doc/portability.dox @@ -166,10 +166,15 @@ In most cases the entry point is classic `main()` function, but some platforms (e.g. Native Client) have different requirements. To make things easier, entry points are handled using macros, which take care of the rest. -If only one `*Application` or `*WindowlessApplication` header is included, the -application class is aliased to `Platform::Application` or `Platform::WindowlessApplication` -and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` or `MAGNUM_WINDOWLESSAPPLICATION_MAIN()` -to simplify porting. +If exactly one `*Application` or `*Windowless*Application` header is included, +the application class is aliased to `Platform::Application` or +`Platform::WindowlessApplication` and the macro is aliased to +`MAGNUM_APPLICATION_MAIN()` or `MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to +simplify porting. The same is with CMake code, if exactly one `*Application` or +`Windowless*Application` component , the libraries and include dirs are +available in `MAGNUM_APPLICATION_LIBRARIES` / `MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES` +and `MAGNUM_APPLICATION_INCLUDE_DIRS` / `MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS` +variables. Example application, which targets both embedded Linux (using plain X and EGL) and desktop (using SDL2 toolkit). Thanks to static polymorphism most of the @@ -184,26 +189,38 @@ particular *Event class implementations: class MyApplication: public Platform::Application { public: - MyApplication(int& argc, char** argv): Platform::Application(argc, argv, "My Application") { - // ... - } + MyApplication(int& argc, char** argv): Platform::Application(argc, argv, "My Application"); protected: - void viewportEvent(const Vector2i& size) override { - // ... - } - - void drawEvent() override { - // ... - } - - void keyPressEvent(KeyEvent& event) override { - // ... - } + void viewportEvent(const Vector2i& size) override; + void drawEvent() override; + void keyPressEvent(KeyEvent& event) override; }; +// ... + MAGNUM_APPLICATION_MAIN(MyApplication) @endcode +And corresponding CMake code. Note that we need to call `find_package()` twice, +first to get variable `MAGNUM_TARGET_GLES` and then again to find proper +application library based on its value: +@code +find_package(Magnum REQUIRED) + +if(MAGNUM_TARGET_GLES) + find_package(Magnum REQUIRED Sdl2Application) +else() + find_package(Magnum REQUIRED XEglApplication) +endif() + +include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_APPLICATION_INCLUDE_DIRS}) + +add_executable(myapplication MyApplication.cpp) +target_link_libraries(myapplication + ${MAGNUM_LIBRARIES} + ${MAGNUM_APPLICATION_LIBRARIES}) +@endcode + */ } From ecccbcc1bf62b6a8cd2f32d0167878d41d6b8963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 20:03:55 +0100 Subject: [PATCH 09/10] Documented CMake usage and preprocessor variables. --- doc/building.dox | 24 ++++---- doc/cmake.dox | 110 ++++++++++++++++++++++++++++++++++++ doc/namespaces.dox | 48 ++++++++++++++++ doc/portability.dox | 16 +++--- doc/required-extensions.dox | 13 ++++- modules/FindMagnum.cmake | 37 ++++++------ src/Extensions.h | 3 + src/Magnum.h | 57 +++++++++++++++++++ 8 files changed, 266 insertions(+), 42 deletions(-) create mode 100644 doc/cmake.dox diff --git a/doc/building.dox b/doc/building.dox index df562d963..e8bb33d3a 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -122,17 +122,19 @@ None of the @ref Platform "application libraries" is built by default (and you need at least one). Choose the one which suits your requirements and your platform best: - - `WITH_XEGLAPPLICATION` - @ref Platform::XEglApplication "XEglApplication", - available only if targeting OpenGL ES (see above). Requires **X11** and - **EGL** libraries. - - `WITH_GLXAPPLICATION` - @ref Platform::GlxApplication "GlxApplication". - Requires **X11** and **GLX** libraries. - - `WITH_WINDOWLESSGLXAPPLICATION` - @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication". - Requires **X11** and **GLX** libraries. - - `WITH_GLUTAPPLICATION` - @ref Platform::GlutApplication "GlutApplication", - available only if targeting desktop OpenGL. Requires **GLUT** library. - - `WITH_SDL2APPLICATION` - @ref Platform::Sdl2Application "Sdl2Application". - Requires **SDL2** library. +- `WITH_GLUTAPPLICATION` - @ref Platform::GlutApplication "GlutApplication", + available only if targeting desktop OpenGL. Requires **GLUT** library. +- `WITH_GLXAPPLICATION` - @ref Platform::GlxApplication "GlxApplication". + Requires **X11** and **GLX** libraries. +- `WITH_NACLAPPLICATION` - @ref Platform::NaClApplication "NaClApplication", + available only if targeting Google Chrome Native Client (see below). +- `WITH_SDL2APPLICATION` - @ref Platform::Sdl2Application "Sdl2Application". + Requires **SDL2** library. +- `WITH_XEGLAPPLICATION` - @ref Platform::XEglApplication "XEglApplication", + available only if targeting OpenGL ES (see above). Requires **X11** and + **EGL** libraries. +- `WITH_WINDOWLESSGLXAPPLICATION` - @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication". + Requires **X11** and **GLX** libraries. @subsection building-tests Building and running unit tests diff --git a/doc/cmake.dox b/doc/cmake.dox new file mode 100644 index 000000000..6c3bcd853 --- /dev/null +++ b/doc/cmake.dox @@ -0,0 +1,110 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +namespace Magnum { +/** @page cmake Usage with CMake +@brief Guide how to find and use %Magnum with CMake build system + +%Magnum uses CMake build system for both building and integration into your +projects. The logic is in module `FindMagnum.cmake` distributed with the engine +in `modules/` directory, you are encouraged to copy it (and its dependencies) +into your project and add path to the files to `CMAKE_MODULE_PATH`. Otherwise, +if CMake won't be able to find this file in predefined locations, it will error +out even if %Magnum might be installed on the system. + +Basic usage is: + + find_package(Magnum REQUIRED) + +This command tries to find base %Magnum library and then defines these +variables: + +- `MAGNUM_FOUND` -- Whether the library was found +- `MAGNUM_LIBRARIES` -- %Magnum library and dependent libraries +- `MAGNUM_INCLUDE_DIRS` -- Root include dir and include dirs of dependencies +- `MAGNUM_PLUGINS_IMPORTER_DIR` -- Directory with importer plugins + +However, this command will try to find only the base library, not the optional +components. The base library depends on %Corrade, OpenGL and GLEW libraries (or +OpenGL ES libraries). Additional dependencies are specified by the components. +The optional components are: + +- `%DebugTools` -- DebugTools library (depends on `%MeshTools`, `%Physics`, + `%Primitives`, `%SceneGraph` and `%Shaders` components) +- `%MeshTools` -- MeshTools library +- `%Physics` -- Physics library (depends on `%SceneGraph` component) +- `%Primitives` -- Primitives library +- `%SceneGraph` -- SceneGraph library +- `%Shaders` -- Shaders library +- `%Text` -- Text library (depends on `%TextureTools` component, FreeType + library and possibly HarfBuzz library, see below) +- `%TextureTools` -- TextureTools library + +Platform namespace is split into more components: + +- `%GlutApplication` -- @ref Platform::GlutApplication "GlutApplication" + (depends on GLUT library) +- `%GlxApplication` -- @ref Platform::GlxApplication "GlxApplication" (depends + on GLX and X11 libraries) +- `%NaClApplication` -- @ref Platform::NaClApplication "NaClApplication" + (only if targeting Google Chrome Native Client) +- `%Sdl2Application` -- @ref Platform::Sdl2Application "Sdl2Application" + (depends on SDL2 library) +- `%XEglApplication` -- @ref Platform::XEglApplication "XEglApplication" + (depends on EGL and X11 libraries) +- `%WindowlessGlxApplication` -- @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication" + (depends on GLX and X11 libraries) + +Example usage with specifying additional components is: + + find_package(Magnum REQUIRED MeshTools Primitives GlutApplication) + +For each component is then defined: + +- `MAGNUM_*_FOUND` -- Whether the component was found +- `MAGNUM_*_LIBRARIES` -- Component library and dependent libraries +- `MAGNUM_*_INCLUDE_DIRS` -- Include dirs of module dependencies + +If exactly one `*Application` or exactly one `Windowless*Application` component +is requested and found, its libraries and include dirs are available in +convenience aliases `MAGNUM_APPLICATION_LIBRARIES` / +`MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES` and `MAGNUM_APPLICATION_INCLUDE_DIRS` +/ `MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS` to simplify porting. + +Features of found %Magnum library are exposed in these CMake variables, they +are also available as preprocessor variables if including Magnum.h: + +- `MAGNUM_TARGET_GLES` -- Defined if compiled for OpenGL ES +- `MAGNUM_TARGET_GLES2` -- Defined if compiled for OpenGL ES 2.0 +- `MAGNUM_TARGET_DESKTOP_GLES` -- Defined if compiled with OpenGL ES emulation + on desktop OpenGL +- `MAGNUM_TARGET_NACL` -- Defined if compiled for Google Chrome Native Client +- `MAGNUM_USE_HARFBUZZ` -- Defined if HarfBuzz library is used for text + rendering + +%Corrade library provides also its own set of CMake macros and variables, see +@ref corrade-cmake "its documentation" for more information. + +*/ +} diff --git a/doc/namespaces.dox b/doc/namespaces.dox index 3fd741cb4..e60a77c03 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -32,6 +32,9 @@ @brief Root namespace Contains classes for interacting with OpenGL. + +This library is built by default and found by default in CMake. See +@ref building and @ref cmake for more information. */ /** @dir Platform @@ -42,6 +45,10 @@ Contains classes for interacting with OpenGL. Base classes for creating applications with various toolkits. See @ref platform for introduction. + +Parts of this namespace are built when `WITH_*APPLICATION` is enabled and found +as `*Application` component in CMake. See @ref building and @ref cmake for more +information. */ /** @dir Math @@ -52,6 +59,9 @@ for introduction. Template classes for matrix and vector calculations. See @ref matrix-vector and @ref transformations for introduction. + +This library is built by default and found by default in CMake. See +@ref building and @ref cmake for more information. */ /** @dir Math/Algorithms @@ -61,6 +71,9 @@ and @ref transformations for introduction. @brief %Algorithms Various matrix and vector algorithms. + +This library is built by default and found by default in CMake. See +@ref building and @ref cmake for more information. */ /** @dir Math/Geometry @@ -70,6 +83,9 @@ Various matrix and vector algorithms. @brief %Geometry library Functions for computing intersections, distances, areas and volumes. + +This library is built by default and found by default in CMake. See +@ref building and @ref cmake for more information. */ /** @dir DebugTools @@ -80,6 +96,10 @@ Functions for computing intersections, distances, areas and volumes. Debugging helpers, renderers and profilers. See @ref debug-tools for introduction. + +This library is built when `WITH_DEBUGTOOLS` is enabled and found as +`%DebugTools` component in CMake. See @ref building and @ref cmake for more +information. */ /** @dir MeshTools @@ -89,6 +109,10 @@ introduction. @brief %Mesh tools Tools for generating, optimizing and cleaning meshes. + +This library is built when `WITH_MESHTOOLS` is enabled and found as +`%MeshTools` component in CMake. See @ref building and @ref cmake for more +information. */ /** @dir Primitives @@ -98,6 +122,10 @@ Tools for generating, optimizing and cleaning meshes. @brief Primitive library Basic primitives for testing purposes. + +This library is built when `WITH_PRIMITIVES` is enabled and found as +`%Primitives` component in CMake. See @ref building and @ref cmake for more +information. */ /** @dir SceneGraph @@ -109,6 +137,10 @@ Basic primitives for testing purposes. Managing object hierarchy, transformations and interactions. See @ref scenegraph for introduction. + +This library is built when `WITH_SCENEGRAPH` is enabled and found as +`%SceneGraph` component in CMake. See @ref building and @ref cmake for more +information. */ /** @dir Shaders @@ -118,6 +150,9 @@ Managing object hierarchy, transformations and interactions. See @brief Sample shaders Collection of shaders for testing purposes. + +This library is built when `WITH_SHADERS` is enabled and found as `%Shaders` +component in CMake. See @ref building and @ref cmake for more information. */ /** @dir Physics @@ -128,6 +163,9 @@ Collection of shaders for testing purposes. Collision detection system and rigid body objects. See @ref collision-detection for introduction. + +This library is built when `WITH_PHYSICS` is enabled and found as `%Physics` +component in CMake. See @ref building and @ref cmake for more information. */ /** @dir Text @@ -137,6 +175,9 @@ for introduction. @brief %Text rendering Font texture creation and text layouting. + +This library is built when `WITH_TEXT` is enabled and found as `%Text` +component in CMake. See @ref building and @ref cmake for more information. */ /** @dir TextureTools @@ -146,6 +187,10 @@ Font texture creation and text layouting. @brief %Texture tools Tools for generating, compressing and optimizing textures. + +This library is built when `WITH_TEXTURETOOLS` is enabled and found as +`%TextureTools` component in CMake. See @ref building and @ref cmake for more +information. */ /** @dir Trade @@ -156,4 +201,7 @@ Tools for generating, compressing and optimizing textures. Contains plugin interfaces for importing data of various formats and classes for direct access to the data. + +This library is built by default and found by default in CMake. See +@ref building and @ref cmake for more information. */ diff --git a/doc/portability.dox b/doc/portability.dox index b8f7082c8..b0ef9fd3e 100644 --- a/doc/portability.dox +++ b/doc/portability.dox @@ -39,9 +39,11 @@ format is not supported. If you include Magnum.h, you get these predefined macros: - - `MAGNUM_TARGET_GLES` if targetting OpenGL ES 2.0 or 3.0 - - `MAGNUM_TARGET_GLES2` if targetting OpenGL ES 2.0 - - `MAGNUM_TARGET_NACL` if targetting Google Chrome Native Client +- @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES" if targeting OpenGL ES 2.0 or + 3.0 +- @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" if targeting OpenGL ES 2.0 +- @ref MAGNUM_TARGET_NACL_ "MAGNUM_TARGET_NACL" if targeting Google Chrome + Native Client Example usage: @code @@ -63,12 +65,8 @@ possible. Many features from C++11 are used to simplify things and make them faster and more secure, but on the other hand it requires fairly recent compiler with good enough support of the new standard. Currently %Magnum is written with GCC 4.7 and Clang 3.1 in mind, but support for some other -compilers is also available: - - - GCC 4.6 support can be explicitly enabled with CMake option - `MAGNUM_GCC46_COMPATIBILITY` - -The options are also available as predefined macros when including Magnum.h. +compilers is also available and handled by Corrade library. See Corrade.h for +more information. Each feature is marked accordingly if it is not available on some compilers, see @ref SceneGraph::DrawableGroup3D for an example. It is up to you (or your diff --git a/doc/required-extensions.dox b/doc/required-extensions.dox index 554359a1f..610e4542b 100644 --- a/doc/required-extensions.dox +++ b/doc/required-extensions.dox @@ -27,8 +27,10 @@ The engine is meant to be run on OpenGL 3 capable hardware, but most of the functionality is working in OpenGL 2.1 hardware too (i.e. integrated Intel -GPUs), unless stated otherwise. OpenGL ES is also supported, see @ref building -for guide how to build the engine for it. +GPUs), unless stated otherwise. OpenGL ES is also supported. + +@see @ref building, @ref cmake, @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES", + @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" Following are lists of functionality requiring specific OpenGL version. In most cases it is also specified which extension is required for given @@ -51,6 +53,8 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only). - @subpage unsupported @page requires-gl Functionality requiring desktop OpenGL (not available on OpenGL ES) +@see @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES" + @page requires-gl30 Functionality requiring OpenGL 3.0 @page requires-gl31 Functionality requiring OpenGL 3.1 @page requires-gl32 Functionality requiring OpenGL 3.2 @@ -59,8 +63,13 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only). @page requires-gl41 Functionality requiring OpenGL 4.1 @page requires-gl42 Functionality requiring OpenGL 4.2 @page requires-gl43 Functionality requiring OpenGL 4.3 + @page requires-extension Functionality requiring specific OpenGL extension + @page requires-gles30 Functionality requiring OpenGL ES 3.0 +@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" + @page requires-es-extension Functionality requiring specific OpenGL ES extension +@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" */ diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index d779170e8..509e806e5 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -2,11 +2,8 @@ # # Basic usage: # find_package(Magnum [REQUIRED]) -# This command tries to find Magnum library and then defines: -# MAGNUM_FOUND - Whether the library was found -# MAGNUM_TARGET_GLES - Defined if Magnum was built for OpenGL -# ES, slightly reducing feature count. The same variable is also -# #defined in Magnum headers. +# This command tries to find base Magnum library and then defines: +# MAGNUM_FOUND - Whether the base library was found # MAGNUM_LIBRARIES - Magnum library and dependent libraries # MAGNUM_INCLUDE_DIRS - Root include dir and include dirs of # dependencies @@ -18,22 +15,22 @@ # DebugTools - DebugTools library (depends on MeshTools, Physics, # Primitives, SceneGraph and Shaders components) # MeshTools - MeshTools library -# Physics - Physics library -# Primitives - Library with stock geometric primitives (static) -# SceneGraph - Scene graph library -# Shaders - Library with stock shaders -# Text - Text rendering library (depends on TextureTools -# component, FreeType library and possibly HarfBuzz -# library, see below) +# Physics - Physics library (depends on SceneGraph component) +# Primitives - Primitives library +# SceneGraph - SceneGraph library +# Shaders - Shaders library +# Text - Text library (depends on TextureTools component, +# FreeType library and possibly HarfBuzz library, +# see below) # TextureTools - TextureTools library -# GlxApplication - GLX application (depends on X11 libraries) -# XEglApplication - X/EGL application (depends on EGL and X11 libraries) -# WindowlessGlxApplication - Windowless GLX application (depends on X11 -# libraries) # GlutApplication - GLUT application (depends on GLUT library) -# Sdl2Application - SDL2 application (depends on SDL2 library) -# NaClApplication - NaCl application (only if targetting Google Chrome +# GlxApplication - GLX application (depends on GLX and X11 libraries) +# NaClApplication - NaCl application (only if targeting Google Chrome # Native Client) +# Sdl2Application - SDL2 application (depends on SDL2 library) +# XEglApplication - X/EGL application (depends on EGL and X11 libraries) +# WindowlessGlxApplication - Windowless GLX application (depends on GLX +# and X11 libraries) # Example usage with specifying additional components is: # find_package(Magnum [REQUIRED|COMPONENTS] # MeshTools Primitives GlutApplication) @@ -43,9 +40,9 @@ # MAGNUM_*_INCLUDE_DIRS - Include dirs of module dependencies # If exactly one *Application or exactly one Windowless*Application # component is requested and found, its libraries and include dirs are -# available in convenience aliases MAGNUM_APPLICATION_LIBRARIES or +# available in convenience aliases MAGNUM_APPLICATION_LIBRARIES / # MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS -# or MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS to simplify porting. +# / MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS to simplify porting. # # Features of found Magnum library are exposed in these variables: # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES diff --git a/src/Extensions.h b/src/Extensions.h index d1fdf312b..de1d5c285 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -41,6 +41,9 @@ the same public methods as Extension class (requiredVersion(), coreVersion() and string(), but these structs are better suited for compile-time decisions rather than %Extension instances. See Context::isExtensionSupported() for example usage. + +This namespace is built by default and found by default in CMake. See +@ref building and @ref cmake for more information. @see MAGNUM_ASSERT_EXTENSION_SUPPORTED() @todo Manual indices for extensions, this has gaps */ diff --git a/src/Magnum.h b/src/Magnum.h index b443cf30a..c597594a1 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -65,6 +65,63 @@ using Corrade::Utility::Warning; using Corrade::Utility::Error; #endif +#ifdef DOXYGEN_GENERATING_OUTPUT + +/** @todoc remove trailing underscores when Doxygen can handle `undef` */ + +/** +@brief OpenGL ES target + +`MAGNUM_TARGET_GLES` is defined if the engine is built for OpenGL ES 3.0 or +OpenGL ES 2.0. +@see @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES", + @ref MAGNUM_TARGET_DESKTOP_GLES_ "MAGNUM_TARGET_DESKTOP_GLES", + @ref MAGNUM_TARGET_NACL_ "MAGNUM_TARGET_NACL", @ref building +*/ +#define MAGNUM_TARGET_GLES_ + +/** +@brief OpenGL ES 2.0 target. + +`MAGNUM_TARGET_GLES2` is defined if the engine is built for OpenGL ES 2.0. +Implies also @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES". +@see @ref MAGNUM_TARGET_DESKTOP_GLES_ "MAGNUM_TARGET_DESKTOP_GLES", + @ref MAGNUM_TARGET_NACL_ "MAGNUM_TARGET_NACL", @ref building +*/ +#define MAGNUM_TARGET_GLES2_ + +/** +@brief Desktop emulation of OpenGL ES target + +`MAGNUM_TARGET_DESKTOP_GLES` is defined if the engine is built for OpenGL ES +3.0 or OpenGL ES 2.0 emulated within standard desktop OpenGL. Implies also +@ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES". +@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2", + @ref MAGNUM_TARGET_NACL_ "MAGNUM_TARGET_NACL", @ref building +*/ +#define MAGNUM_TARGET_DESKTOP_GLES_ + +/** +@brief Google Chrome Native Client target + +`MAGNUM_TARGET_NACL` is defined if the engine is built for OpenGL ES 2.0 on +Google Chrome Native Client. Implies also @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES" +and @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES". +@see @ref building +*/ +#define MAGNUM_TARGET_NACL_ + +/** +@brief HarfBuzz library usage + +`MAGNUM_USE_HARFBUZZ` is defined if HarfBuzz library is used for text +rendering. +@see Text::HarfBuzzFont +*/ +#define MAGNUM_USE_HARFBUZZ_ + +#endif + /** @{ @name Basic type definitions See @ref types for more information. From 5f77a12f478125c032320b50d0629de30f786ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 20:18:13 +0100 Subject: [PATCH 10/10] Fixed typos (ahem). --- CMakeLists.txt | 2 +- src/Platform/CMakeLists.txt | 2 +- src/Platform/GlxApplication.h | 2 +- src/Platform/GlxContextHandler.h | 2 +- src/Platform/WindowlessGlxApplication.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d879b26f3..1ad8c561b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules/") -# If targetting NaCl, set explicit OpenGL ES 2.0 support +# If targeting NaCl, set explicit OpenGL ES 2.0 support if(${CMAKE_SYSTEM_NAME} STREQUAL NaCl) set(TARGET_GLES 1) set(TARGET_GLES2 1) diff --git a/src/Platform/CMakeLists.txt b/src/Platform/CMakeLists.txt index 378c14cbc..6f7b75b18 100644 --- a/src/Platform/CMakeLists.txt +++ b/src/Platform/CMakeLists.txt @@ -63,7 +63,7 @@ endif() # NaCl application if(WITH_NACLAPPLICATION) if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL NaCl) - message(FATAL_ERROR "NaClApplication is available only when targetting Google Chrome Native Client. Set WITH_NACLAPPLICATION to OFF to skip building it.") + message(FATAL_ERROR "NaClApplication is available only when targeting Google Chrome Native Client. Set WITH_NACLAPPLICATION to OFF to skip building it.") endif() add_library(MagnumNaClApplication STATIC diff --git a/src/Platform/GlxApplication.h b/src/Platform/GlxApplication.h index e5f8f470b..4984ad6f1 100644 --- a/src/Platform/GlxApplication.h +++ b/src/Platform/GlxApplication.h @@ -37,7 +37,7 @@ namespace Magnum { namespace Platform { @brief GLX application Creates window with double-buffered OpenGL or OpenGL ES 2.0 context, if -targetting OpenGL ES. Uses GlxContextHandler. +targeting OpenGL ES. Uses GlxContextHandler. @section GlxApplication-usage Usage diff --git a/src/Platform/GlxContextHandler.h b/src/Platform/GlxContextHandler.h index d5455c5d0..60494e0f9 100644 --- a/src/Platform/GlxContextHandler.h +++ b/src/Platform/GlxContextHandler.h @@ -44,7 +44,7 @@ namespace Magnum { namespace Platform { /** @brief GLX context -Creates OpenGL or OpenGL ES 2.0 context, if targetting OpenGL ES. Used in +Creates OpenGL or OpenGL ES 2.0 context, if targeting OpenGL ES. Used in GlxApplication. */ class GlxContextHandler: public AbstractContextHandler { diff --git a/src/Platform/WindowlessGlxApplication.h b/src/Platform/WindowlessGlxApplication.h index b3b86ddea..47c0cbced 100644 --- a/src/Platform/WindowlessGlxApplication.h +++ b/src/Platform/WindowlessGlxApplication.h @@ -68,7 +68,7 @@ class WindowlessGlxApplication { * @param argv Arguments of `main()` function * * Creates window with double-buffered OpenGL 3.2 core context or - * OpenGL ES 2.0 context, if targetting OpenGL ES. + * OpenGL ES 2.0 context, if targeting OpenGL ES. */ explicit WindowlessGlxApplication(int& argc, char** argv);