Browse Source

Modern CMake usage: reworked to use target-specific properties.

As with Corrade, this is not exactly backwards compatible, but for
common use case without OBJECT libraries this should not be a problem.
In any case, recreate the build dir and update your copy of all
Find*.cmake modules to avoid weird things happening.

User-facing changes:

 * Documentation of all Find*.cmake modules converted to
   reStructuredText to follow official CMake guidelines.
 * The newfangled way to use the libraries is to link to Magnum::Shaders
   instead of adding ${MAGNUM_SHADERS_INCLUDE_DIRS} to include path and
   linking to ${MAGNUM_SHADERS_LIBRARIES}.
 * The old ${MAGNUM_*_LIBRARIES} are deprecated and now just expand to
   Magnum::* target. Use the target directly. These are also enabled
   only when building with MAGNUM_BUILD_DEPRECATED.
 * The old ${MAGNUM_*_INCLUDE_DIRS} are removed as the Magnum::* targets
   cover these too.

Internal changes:

 * Global state such as include_directories() was replaced with
   target-specific settings.
pull/142/head
Vladimír Vondruš 10 years ago
parent
commit
01ffbe93a9
  1. 6
      CMakeLists.txt
  2. 49
      doc/cmake.dox
  3. 23
      doc/generated/CMakeLists.txt
  4. 11
      doc/getting-started.dox
  5. 77
      doc/namespaces.dox
  6. 32
      doc/platform.dox
  7. 2
      doc/plugins.dox
  8. 6
      doc/portability.dox
  9. 19
      modules/FindEGL.cmake
  10. 728
      modules/FindMagnum.cmake
  11. 30
      modules/FindOpenGLES2.cmake
  12. 28
      modules/FindOpenGLES3.cmake
  13. 42
      modules/FindSDL2.cmake
  14. 14
      src/CMakeLists.txt
  15. 11
      src/Magnum/Audio/CMakeLists.txt
  16. 10
      src/Magnum/Audio/Extensions.h
  17. 3
      src/Magnum/Audio/Test/CMakeLists.txt
  18. 34
      src/Magnum/CMakeLists.txt
  19. 4
      src/Magnum/DebugTools/CMakeLists.txt
  20. 5
      src/Magnum/Extensions.h
  21. 2
      src/Magnum/Math/Geometry/Test/CMakeLists.txt
  22. 14
      src/Magnum/Math/Test/CMakeLists.txt
  23. 14
      src/Magnum/MeshTools/CMakeLists.txt
  24. 11
      src/Magnum/MeshTools/Test/CMakeLists.txt
  25. 12
      src/Magnum/Platform/AndroidApplication.h
  26. 139
      src/Magnum/Platform/CMakeLists.txt
  27. 10
      src/Magnum/Platform/GlutApplication.h
  28. 8
      src/Magnum/Platform/GlxApplication.h
  29. 8
      src/Magnum/Platform/NaClApplication.h
  30. 7
      src/Magnum/Platform/Sdl2Application.h
  31. 12
      src/Magnum/Platform/WindowlessGlxApplication.h
  32. 12
      src/Magnum/Platform/WindowlessWglApplication.h
  33. 12
      src/Magnum/Platform/WindowlessWindowsEglApplication.h
  34. 7
      src/Magnum/Platform/XEglApplication.h
  35. 5
      src/Magnum/Primitives/CMakeLists.txt
  36. 14
      src/Magnum/SceneGraph/CMakeLists.txt
  37. 5
      src/Magnum/SceneGraph/Test/CMakeLists.txt
  38. 3
      src/Magnum/Shaders/CMakeLists.txt
  39. 5
      src/Magnum/Shapes/CMakeLists.txt
  40. 11
      src/Magnum/Test/CMakeLists.txt
  41. 19
      src/Magnum/Text/CMakeLists.txt
  42. 4
      src/Magnum/Text/Test/CMakeLists.txt
  43. 19
      src/Magnum/TextureTools/CMakeLists.txt
  44. 4
      src/Magnum/Trade/Test/CMakeLists.txt
  45. 7
      src/MagnumExternal/OpenGL/GL/CMakeLists.txt
  46. 7
      src/MagnumExternal/OpenGL/GLES2/CMakeLists.txt
  47. 7
      src/MagnumExternal/OpenGL/GLES3/CMakeLists.txt
  48. 7
      src/MagnumPlugins/MagnumFont/CMakeLists.txt
  49. 4
      src/MagnumPlugins/MagnumFont/MagnumFont.h
  50. 3
      src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt
  51. 7
      src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt
  52. 5
      src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h
  53. 5
      src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt
  54. 4
      src/MagnumPlugins/ObjImporter/CMakeLists.txt
  55. 4
      src/MagnumPlugins/ObjImporter/ObjImporter.h
  56. 3
      src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt
  57. 8
      src/MagnumPlugins/TgaImageConverter/CMakeLists.txt
  58. 8
      src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt
  59. 5
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h
  60. 8
      src/MagnumPlugins/TgaImporter/CMakeLists.txt
  61. 5
      src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt
  62. 4
      src/MagnumPlugins/TgaImporter/TgaImporter.h
  63. 12
      src/MagnumPlugins/WavAudioImporter/CMakeLists.txt
  64. 3
      src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt
  65. 4
      src/MagnumPlugins/WavAudioImporter/WavImporter.h

6
CMakeLists.txt

@ -31,9 +31,10 @@ if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
# Find Corrade first so we can check on the target
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")
find_package(Corrade REQUIRED)
# Find Corrade first so we can check on the target
find_package(Corrade REQUIRED PluginManager Utility)
include(CMakeDependentOption)
@ -131,6 +132,7 @@ option(BUILD_PLUGINS_STATIC "Build static plugins (default are dynamic)" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code" OFF "BUILD_TESTS" OFF)
if(BUILD_TESTS)
find_package(Corrade REQUIRED TestSuite)
enable_testing()
endif()

49
doc/cmake.dox

@ -50,12 +50,10 @@ Basic usage is:
find_package(Magnum REQUIRED)
This command tries to find base Magnum library and then defines these
variables:
This module tries to find base Magnum library and then defines:
- `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_FOUND` -- Whether the library was found
- `Magnum::Magnum` -- Base library imported target
- `MAGNUM_PLUGINS_DEBUG_DIR` -- Base directory with dynamic plugins for debug
builds, defaults to `magnum-d/` subdirectory of dir where Magnum library
was found
@ -135,6 +133,12 @@ dependencies, you need to find the dependency and then link to it.
- `TgaImporter` -- @ref Trade::TgaImporter "TgaImporter" plugin
- `WavAudioImporter` -- @ref Audio::WavImporter "WavAudioImporter" plugin
Lastly, a few utility executables are available:
- `distancefieldconverter` -- @ref magnum-distancefieldconverter executable
- `fontconverter` -- @ref magnum-fontconverter executable
- `info` -- @ref magnum-info executable
Note that [each namespace](namespaces.html), all @ref Platform libraries and
each plugin class contain more detailed information about dependencies,
availability on particular platform and also guide how to enable given library
@ -146,18 +150,14 @@ Example usage with specifying additional components is:
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
- `Magnum_*_FOUND` -- Whether the component was found
- `Magnum::*` -- Component imported target
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. Similarly,
if exactly one `*Context` component is requested and found, its libraries and
include dirs are available in convenience aliases `MAGNUM_CONTEXT_LIBRARIES`
and `MAGNUM_CONTEXT_INCLUDE_DIRS`.
is requested and found, its target is available in convenience alias
`Magnum::Application` / `Magnum::WindowlessApplication` to simplify porting.
Similarly, if exactly one `*Context` component is requested and found, its
target is available in convenience alias `Magnum::Context`.
The package is found if either debug or release version of each requested
library (or plugin) is found. If both debug and release libraries (or plugins)
@ -184,10 +184,25 @@ are also available as preprocessor variables if including
emulation on desktop OpenGL
- `MAGNUM_TARGET_WEBGL` --- Defined if compiled for WebGL
Workflows without imported targets are deprecated and the following variables
are included just for backwards compatibility and only if
@ref MAGNUM_BUILD_DEPRECATED is enabled:
- `MAGNUM_LIBRARIES` -- Expands to `Magnum::Magnum` target. Use `Magnum::Magnum`
target directly instead.
- `MAGNUM_*_LIBRARIES` -- Expands to `Magnum::*` target. Use `Magnum::*`
target directly instead.
- `MAGNUM_APPLICATION_LIBRARIES` / `MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES`
-- Expands to `Magnum::Application` / `Magnum::WindowlessApplication`
target. Use `Magnum::Application` / `Magnum::WindowlessApplication` target
directly instead.
- `MAGNUM_CONTEXT_LIBRARIES` -- Expands to `Magnum::Context` target. Use
`Magnum::Context` target directly instead.
Corrade library provides also its own set of CMake macros and variables, see
@ref corrade-cmake "its documentation" for more information.
@ref cmake-plugins "Plugins repository" and @ref cmake-integration "Integration library"
have also their own CMake modules.
@ref cmake-plugins "Plugins repository", @ref cmake-integration "Integration repository"
and @ref cmake-extras "Extras repository" have also their own CMake modules.
*/
}

23
doc/generated/CMakeLists.txt

@ -34,6 +34,8 @@ find_package(Magnum REQUIRED
Shaders
Sdl2Application)
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
if(CORRADE_TARGET_APPLE)
find_package(Magnum REQUIRED WindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX)
@ -46,22 +48,17 @@ endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}")
include_directories(${MAGNUM_INCLUDE_DIRS}
${MAGNUM_APPLICATION_INCLUDE_DIRS}
${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS})
add_executable(hello hello.cpp)
target_link_libraries(hello
${MAGNUM_LIBRARIES}
${MAGNUM_APPLICATION_LIBRARIES})
Magnum::Magnum
Magnum::Application)
add_executable(shaders shaders.cpp)
target_include_directories(shaders PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(shaders
${MAGNUM_LIBRARIES}
${MAGNUM_MESHTOOLS_LIBRARIES}
${MAGNUM_PRIMITIVES_LIBRARIES}
${MAGNUM_SHADERS_LIBRARIES}
${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES})
Magnum::Magnum
Magnum::MeshTools
Magnum::Primitives
Magnum::Shaders
Magnum::WindowlessApplication)

11
doc/getting-started.dox

@ -143,18 +143,17 @@ MAGNUM_APPLICATION_MAIN(MyApplication)
The application essentially does nothing, just clears screen framebuffer to
default (dark gray) color and then does buffer swap to actually display it on
the screen. The `src/CMakeLists.txt` file finds Magnum, sets up compiler flags,
creates the executable and links it to all needed libraries:
the screen. The `src/CMakeLists.txt` file finds Magnum, creates the executable
and links it to all needed libraries:
@code
find_package(Magnum REQUIRED Sdl2Application)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}")
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_APPLICATION_INCLUDE_DIRS})
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
add_executable(MyApplication MyApplication.cpp)
target_link_libraries(MyApplication
${MAGNUM_LIBRARIES}
${MAGNUM_APPLICATION_LIBRARIES})
Magnum::Magnum
Magnum::Application)
@endcode
In the following tutorials the code will be explained more thoroughly.

77
doc/namespaces.dox

@ -32,9 +32,8 @@
Contains classes for interacting with OpenGL.
This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more
information.
find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
and @ref cmake for more information.
*/
/** @dir Magnum/Platform
@ -48,9 +47,8 @@ Base classes for creating applications with various toolkits.
Parts of this namespace are built if `WITH_*APPLICATION` is enabled when
building Magnum, with each library having specific toolkit dependencies and
platform requirements. To use particular application library, you need to
request given `*Application` component of `Magnum` package in CMake, add
`${MAGNUM_*APPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_*APPLICATION_LIBRARIES}`. See particular `*Application` class
request given `*Application` component of `Magnum` package in CMake and link to
`Magnum::*Application` target. See particular `*Application` class
documentation, @ref building, @ref cmake and @ref platform for more
information.
*/
@ -64,9 +62,8 @@ information.
Template classes for matrix and vector calculations.
This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link
to `${MAGNUM_LIBRARIES}`. See @ref building, @ref cmake, @ref matrix-vector and
@ref transformations for more information.
find `Magnum` package and link to `Magnum::Magnum` target. See @ref building,
@ref cmake, @ref matrix-vector and @ref transformations for more information.
*/
/** @dir Magnum/Math/Algorithms
@ -78,9 +75,8 @@ to `${MAGNUM_LIBRARIES}`. See @ref building, @ref cmake, @ref matrix-vector and
Various matrix and vector algorithms.
This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more
information.
find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
and @ref cmake for more information.
*/
/** @dir Magnum/Math/Geometry
@ -92,9 +88,8 @@ information.
Functions for computing intersections, distances, areas and volumes.
This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more
information.
find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
and @ref cmake for more information.
*/
/** @dir Magnum/Audio
@ -107,11 +102,11 @@ Audio import, playback and integration with @ref SceneGraph.
This library depends on **OpenAL** library. It is built if `WITH_AUDIO` is
enabled when building Magnum. To use this library, you need to request
`Audio` component of `Magnum` package in CMake, add `${MAGNUM_AUDIO_INCLUDE_DIRS}`
to include path and link to `${MAGNUM_AUDIO_LIBRARIES}`. See @ref building and
@ref cmake for more information. Additional plugins are enabled separately, see
particular `*Importer` class documentation, @ref building-plugins,
@ref cmake-plugins and @ref plugins for more information.
`Audio` component of `Magnum` package in CMake and link to
`Magnum::Audio` target. See @ref building and @ref cmake for more information.
Additional plugins are enabled separately, see particular `Audio::*Importer`
class documentation, @ref building-plugins, @ref cmake-plugins and @ref plugins
for more information.
*/
/** @dir Magnum/DebugTools
@ -124,8 +119,8 @@ Debugging helpers, renderers and profilers.
This library is built if `WITH_DEBUGTOOLS` is enabled when building Magnum. To
use this library, you need to request `DebugTools` component of `Magnum`
package in CMake and link to `${MAGNUM_DEBUGTOOLS_LIBRARIES}`. See
@ref building, @ref cmake and @ref debug-tools for more information.
package in CMake and link to `Magnum::DebugTools` target. See @ref building,
@ref cmake and @ref debug-tools for more information.
*/
/** @dir Magnum/MeshTools
@ -138,8 +133,8 @@ Tools for generating, optimizing and cleaning meshes.
This library is built if `WITH_MESHTOOLS` is enabled when building Magnum. To
use this library, you need to request `MeshTools` component of `Magnum`
package in CMake and link to `${MAGNUM_MESHTOOLS_LIBRARIES}`. See @ref building
and @ref cmake for more information.
package in CMake and link to `Magnum::MeshTools` target. See @ref building and
@ref cmake for more information.
*/
/** @dir Magnum/Primitives
@ -152,8 +147,8 @@ Basic primitives for testing purposes.
This library is built if `WITH_PRIMITIVES` is enabled when building Magnum. To
use this library, you need to request `Primitives` component of `Magnum`
package in CMake and link to `${MAGNUM_PRIMITIVES_LIBRARIES}`. See
@ref building and @ref cmake for more information.
package in CMake and link to `Magnum::Primitives` target. See @ref building and
@ref cmake for more information.
*/
/** @dir Magnum/SceneGraph
@ -166,8 +161,8 @@ Managing object hierarchy, transformations and interactions.
This library is built if `WITH_SCENEGRAPH` is enabled when building Magnum. To
use this library, you need to request `SceneGraph` component of `Magnum`
package in CMake and link to `${MAGNUM_SCENEGRAPH_LIBRARIES}`. See
@ref building, @ref cmake and @ref scenegraph for more information.
package in CMake and link to `Magnum::SceneGraph` target. See @ref building,
@ref cmake and @ref scenegraph for more information.
*/
/** @dir Magnum/Shaders
@ -180,8 +175,8 @@ Collection of shaders for easy prototyping and basic usage.
This library is built if `WITH_SHADERS` is enabled when building Magnum. To
use this library, you need to request `Shaders` component of `Magnum` package
in CMake and link to `${MAGNUM_MESHTOOLS_SHADERS}`. See @ref building and
@ref cmake and @ref shaders for more information.
in CMake and link to `Magnum::Shaders` target. See @ref building, @ref cmake
and @ref shaders for more information.
*/
/** @dir Magnum/Shapes
@ -194,8 +189,8 @@ Collision detection system.
This library is built if `WITH_SHAPES` is enabled when building Magnum. To use
this library, you need to request `Shapes` component of `Magnum` package in
CMake and link to `${MAGNUM_SHAPES_LIBRARIES}`. See @ref building, @ref cmake
and @ref shapes for more information.
CMake and link to `Magnum::Shapes` target. See @ref building, @ref cmake and
@ref shapes for more information.
*/
/** @dir Magnum/Text
@ -208,8 +203,8 @@ Font texture creation and text layouting.
This library is built if `WITH_TEXT` is enabled when building Magnum. To use
this library, you need to request `Text` component of `Magnum` package in
CMake and link to `${MAGNUM_TEXT_LIBRARIES}`. See @ref building and @ref cmake
for more information. Additional plugins are enabled separately, see particular
CMake and link to `Magnum::Text` target. See @ref building and @ref cmake for
more information. Additional plugins are enabled separately, see particular
`*Font` and `*FontConverter` class documentation, @ref building-plugins,
@ref cmake-plugins and @ref plugins for more information.
*/
@ -224,8 +219,8 @@ Tools for generating, compressing and optimizing textures.
This library is built if `WITH_TEXTURETOOLS` is enabled when building Magnum.
To use this library, you need to request `TextureTools` component of `Magnum`
package in CMake and link to `${MAGNUM_TEXTURETOOLS_LIBRARIES}`. See
@ref building and @ref cmake for more information.
package in CMake and link to `Magnum::TextureTools`. See @ref building and
@ref cmake for more information.
*/
/** @dir Magnum/Trade
@ -238,11 +233,11 @@ Contains plugin interfaces for importing data of various formats and classes
for direct access to the data.
This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more
information. Additional plugins are enabled separately, see particular
`*Importer` and `*ImageConverter` class documentation, @ref building-plugins,
@ref cmake-plugins and @ref plugins for more information.
find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
and @ref cmake for more information. Additional plugins are enabled separately,
see particular `Trade::*Importer` and `*ImageConverter` class documentation,
@ref building-plugins, @ref cmake-plugins and @ref plugins for more
information.
*/
/** @dir magnum/src/MagnumPlugins

32
doc/platform.dox

@ -182,15 +182,12 @@ MAGNUM_WINDOWLESSAPPLICATION_MAIN(MyApplication)
@section platform-compilation Compilation with CMake
Barebone compilation consists just of finding Magnum library with required
`*Application` component, adding Magnum's `${MAGNUM_INCLUDE_DIRS}` and
application-specific `${MAGNUM_SDL2APPLICATION_INCLUDE_DIRS}` to include path,
compilation of the executable and linking `${MAGNUM_LIBRARIES}` and
`${MAGNUM_SDL2APPLICATION_LIBRARIES}` to it.
Again, to simplify porting, you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}`
and `${MAGNUM_APPLICATION_LIBRARIES}` aliases (or `${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}`,
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` for windowless applications), but
Barebone compilation consists just of finding Magnum library with, for example,
`Sdl2Application` component, compilation of the executable and linking
`Magnum::Magnum` and `Magnum::Sdl2Application` to it.
Again, to simplify porting, you can also use generic `Magnum::Application`
aliases (or `Magnum::WindowlessApplication` for windowless applications), but
only if only one application (windowless application) component is requested to
avoid ambiguity. Changing the build script to use different toolkit is then
matter of replacing only the requested `*Application` component (and one
@ -199,12 +196,10 @@ matter of replacing only the requested `*Application` component (and one
@code
find_package(Magnum REQUIRED Sdl2Application)
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_APPLICATION_INCLUDE_DIRS})
add_executable(myapplication MyApplication.cpp)
target_link_libraries(myapplication
${MAGNUM_LIBRARIES}
${MAGNUM_APPLICATION_LIBRARIES})
Magnum::Magnum
Magnum::Application)
@endcode
@section platform-configuration Specifying configuration
@ -311,20 +306,17 @@ Systems not listed here (such as Emscripten or NaCl) don't need any `Context`
library, because dynamic function pointer loading is not available on these.
For example, when you create the OpenGL context using GLX, you need to find
`GlxContext` component, include `${MAGNUM_GLXCONTEXT_INCLUDE_DIRS}` and link to
`${MAGNUM_GLXCONTEXT_LIBRARIES}`. Similarly to application libraries, you can
also use generic `${MAGNUM_CONTEXT_INCLUDE_DIRS}` and `${MAGNUM_CONTEXT_LIBRARIES}`,
`GlxContext` component, and link to `Magnum::GlxContext` target. Similarly to
application libraries, you can also use generic `Magnum::Context` target,
providing you requested only one `*Context` component in the `find_package()`
call. Complete example:
@code
find_package(Magnum REQUIRED GlxContext)
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_CONTEXT_INCLUDE_DIRS})
add_executable(myapplication MyCustomApplication.cpp)
target_link_libraries(myapplication
${MAGNUM_LIBRARIES}
${MAGNUM_CONTEXT_LIBRARIES})
Magnum::Magnum
Magnum::Context)
@endcode
- Next page: @ref types

2
doc/plugins.dox

@ -182,7 +182,7 @@ and @ref cmake-plugins for additional information.
find_package(Magnum REQUIRED TgaImporter)
add_executable(MyApp ...)
target_link_libraries(MyApp ... ${MAGNUM_TGAIMPORTER_LIBRARIES})
target_link_libraries(MyApp ... Magnum::TgaImporter)
@endcode
The only user-visible behavioral change will be that

6
doc/portability.dox

@ -223,12 +223,10 @@ 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})
Magnum::Magnum
Magnum::Application)
@endcode
*/

19
modules/FindEGL.cmake

@ -1,8 +1,14 @@
# - Find EGL
#.rst:
# Find EGL
# --------
#
# This module defines:
# Finds the EGL library. This module defines:
#
# EGL_FOUND - True if EGL library is found
# EGL::EGL - EGL imported target
#
# Additionally these variables are defined for internal usage:
#
# EGL_LIBRARY - EGL library
# EGL_INCLUDE_DIR - Include dir
#
@ -50,6 +56,13 @@ find_path(EGL_INCLUDE_DIR NAMES
EAGL.h)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("EGL" DEFAULT_MSG
find_package_handle_standard_args(EGL DEFAULT_MSG
EGL_LIBRARY
EGL_INCLUDE_DIR)
if(NOT TARGET EGL::EGL)
add_library(EGL::EGL UNKNOWN IMPORTED)
set_target_properties(EGL::EGL PROPERTIES
IMPORTED_LOCATION ${EGL_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${EGL_INCLUDE_DIR})
endif()

728
modules/FindMagnum.cmake

@ -1,12 +1,15 @@
# - Find Magnum
#.rst:
# Find Magnum
# -----------
#
# Basic usage:
# find_package(Magnum [REQUIRED])
# 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
# Finds the Magnum library. Basic usage::
#
# find_package(Magnum REQUIRED)
#
# This module tries to find the base Magnum library and then defines the
# following:
#
# Magnum_FOUND - Whether the base library was found
# MAGNUM_PLUGINS_DEBUG_DIR - Base directory with dynamic plugins for
# debug builds, defaults to magnum-d/ subdirectory of dir where Magnum
# library was found
@ -14,11 +17,11 @@
# release builds, defaults to magnum/ subdirectory of dir where Magnum
# library was found
# MAGNUM_PLUGINS_DIR - Base directory with dynamic plugins, defaults
# to MAGNUM_PLUGINS_RELEASE_DIR in release builds and multi-configuration
# builds or to MAGNUM_PLUGINS_DEBUG_DIR in debug builds. You can modify all
# three variable (e.g. set them to . when deploying on Windows with plugins
# stored relatively to the executable), the following MAGNUM_PLUGINS_*_DIR
# variables depend on it.
# to :variable:`MAGNUM_PLUGINS_RELEASE_DIR` in release builds and
# multi-configuration builds or to :variable:`MAGNUM_PLUGINS_DEBUG_DIR` in
# debug builds. You can modify all three variables (e.g. set them to ``.``
# when deploying on Windows with plugins stored relatively to the
# executable), the following ``MAGNUM_PLUGINS_*_DIR`` variables depend on it.
# MAGNUM_PLUGINS_FONT[|_DEBUG|_RELEASE]_DIR - Directory with dynamic font
# plugins
# MAGNUM_PLUGINS_FONTCONVERTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
@ -29,10 +32,12 @@
# importer plugins
# MAGNUM_PLUGINS_AUDIOIMPORTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
# audio importer plugins
#
# This command will try to find only the base library, not the optional
# components. The base library depends on Corrade and OpenGL libraries (or
# OpenGL ES libraries). Additional dependencies are specified by the
# components. The optional components are:
#
# Audio - Audio library
# DebugTools - DebugTools library
# MeshTools - MeshTools library
@ -42,12 +47,6 @@
# Shapes - Shapes library
# Text - Text library
# TextureTools - TextureTools library
# MagnumFont - Magnum bitmap font plugin
# MagnumFontConverter - Magnum bitmap font converter plugin
# ObjImporter - OBJ importer plugin
# TgaImageConverter - TGA image converter plugin
# TgaImporter - TGA importer plugin
# WavAudioImporter - WAV audio importer plugin
# GlutApplication - GLUT application
# GlxApplication - GLX application
# NaClApplication - NaCl application
@ -62,33 +61,44 @@
# EglContext - EGL context
# GlxContext - GLX context
# WglContext - WGL context
# Example usage with specifying additional components is:
# find_package(Magnum [REQUIRED|COMPONENTS]
# MeshTools Primitives GlutApplication)
# MagnumFont - Magnum bitmap font plugin
# MagnumFontConverter - Magnum bitmap font converter plugin
# ObjImporter - OBJ importer plugin
# TgaImageConverter - TGA image converter plugin
# TgaImporter - TGA importer plugin
# WavAudioImporter - WAV audio importer plugin
# distancefieldconverter - magnum-distancefieldconverter executable
# fontconverter - magnum-fontconverter executable
# info - magnum-info executable
#
# 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. Similarly,
# if exactly one *Context component is requested and found, its libraries and
# include dirs are available in convenience aliases MAGNUM_CONTEXT_LIBRARIES
# and MAGNUM_CONTEXT_INCLUDE_DIRS.
#
# Magnum_*_FOUND - Whether the component was found
# Magnum::* - Component imported target
#
# If exactly one ``*Application`` or exactly one ``Windowless*Application``
# component is requested and found, its target is available in convenience
# alias ``Magnum::Application`` / ``Magnum::WindowlessApplication`` to simplify
# porting. Similarly, if exactly one ``*Context`` component is requested and
# found, its target is available in convenience alias ``Magnum::Context``.
#
# The package is found if either debug or release version of each requested
# library (or plugin) is found. If both debug and release libraries (or
# plugins) are found, proper version is chosen based on actual build
# configuration of the project (i.e. Debug build is linked to debug libraries,
# Release build to release libraries). Note that this autodetection might fail
# for the MAGNUM_PLUGINS_DIR variable, especially on multi-configuration build
# systems. You can make use of CORRADE_IS_DEBUG_BUILD preprocessor variable
# along with MAGNUM_PLUGINS_*_DEBUG_DIR / MAGNUM_PLUGINS_*_RELEASE_DIR
# variables to decide in preprocessing step.
# for the :variable:`MAGNUM_PLUGINS_DIR` variable, especially on
# multi-configuration build systems. You can make use of
# ``CORRADE_IS_DEBUG_BUILD`` preprocessor variable along with
# ``MAGNUM_PLUGINS_*_DEBUG_DIR`` / ``MAGNUM_PLUGINS_*_RELEASE_DIR`` variables
# to decide in preprocessing step.
#
# Features of found Magnum library are exposed in these variables:
#
# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated APIs
# included
# MAGNUM_BUILD_STATIC - Defined if compiled as static libraries
@ -100,6 +110,7 @@
# MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL
#
# Additionally these variables are defined for internal usage:
#
# MAGNUM_INCLUDE_DIR - Root include dir (w/o dependencies)
# MAGNUM_LIBRARY - Magnum library (w/o dependencies)
# MAGNUM_LIBRARY_DEBUG - Debug version of Magnum library, if found
@ -124,6 +135,21 @@
# MAGNUM_INCLUDE_INSTALL_DIR - Header installation directory
# MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation directory
#
# Workflows without imported targets are deprecated and the following variables
# are included just for backwards compatibility and only if
# :variable:`MAGNUM_BUILD_DEPRECATED` is enabled:
#
# MAGNUM_LIBRARIES - Expands to ``Magnum::Magnum`` target. Use
# ``Magnum::Magnum`` target directly instead.
# MAGNUM_*_LIBRARIES - Expands to ``Magnum::*`` target. Use
# ``Magnum::*`` target directly instead.
# MAGNUM_APPLICATION_LIBRARIES / MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES
# - Expands to ``Magnum::Application`` /
# ``Magnum::WindowlessApplication`` target. Use ``Magnum::Application`` /
# ``Magnum::WindowlessApplication`` target directly instead.
# MAGNUM_CONTEXT_LIBRARIES - Expands to ``Magnum::Context`` target. Use
# ``Magnum::Context`` target directly instead.
#
#
# This file is part of Magnum.
@ -151,34 +177,12 @@
#
# Dependencies
find_package(Corrade REQUIRED)
# Base Magnum library
find_library(MAGNUM_LIBRARY_DEBUG Magnum-d)
find_library(MAGNUM_LIBRARY_RELEASE Magnum)
# Set the MAGNUM_LIBRARY variable based on what was found, use that information
# to guess also build type of dynamic plugins
if(MAGNUM_LIBRARY_DEBUG AND MAGNUM_LIBRARY_RELEASE)
set(MAGNUM_LIBRARY
debug ${MAGNUM_LIBRARY_DEBUG}
optimized ${MAGNUM_LIBRARY_RELEASE})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_DEBUG} PATH)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_MAGNUM_PLUGINS_DIR_SUFFIX "-d")
endif()
elseif(MAGNUM_LIBRARY_DEBUG)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_DEBUG})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_DEBUG} PATH)
set(_MAGNUM_PLUGINS_DIR_SUFFIX "-d")
elseif(MAGNUM_LIBRARY_RELEASE)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_RELEASE})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_RELEASE} PATH)
endif()
find_package(Corrade REQUIRED Utility PluginManager)
# Root include dir
find_path(MAGNUM_INCLUDE_DIR
NAMES Magnum/Magnum.h)
mark_as_advanced(MAGNUM_INCLUDE_DIR)
# Configuration file
find_file(_MAGNUM_CONFIGURE_FILE configure.h
@ -190,10 +194,10 @@ find_file(_MAGNUM_CONFIGURE_FILE configure.h
if(NOT MAGNUM_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Magnum
REQUIRED_VARS MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR _MAGNUM_CONFIGURE_FILE)
REQUIRED_VARS MAGNUM_INCLUDE_DIR _MAGNUM_CONFIGURE_FILE)
endif()
# Configuration
# Read flags from configuration
file(READ ${_MAGNUM_CONFIGURE_FILE} _magnumConfigure)
set(_magnumFlags
BUILD_DEPRECATED
@ -210,62 +214,102 @@ foreach(_magnumFlag ${_magnumFlags})
endif()
endforeach()
# Dependent libraries and includes
set(MAGNUM_INCLUDE_DIRS ${MAGNUM_INCLUDE_DIR}
${MAGNUM_INCLUDE_DIR}/MagnumExternal/OpenGL
${CORRADE_INCLUDE_DIRS})
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARY}
${CORRADE_UTILITY_LIBRARIES}
${CORRADE_PLUGINMANAGER_LIBRARIES})
if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)
# Base Magnum library
if(NOT TARGET Magnum::Magnum)
add_library(Magnum::Magnum UNKNOWN IMPORTED)
# Try to find both debug and release version
find_library(MAGNUM_LIBRARY_DEBUG Magnum-d)
find_library(MAGNUM_LIBRARY_RELEASE Magnum)
mark_as_advanced(MAGNUM_LIBRARY_DEBUG
MAGNUM_LIBRARY_RELEASE)
# Set the MAGNUM_LIBRARY variable based on what was found, use that
# information to guess also build type of dynamic plugins
if(MAGNUM_LIBRARY_DEBUG AND MAGNUM_LIBRARY_RELEASE)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_RELEASE})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_DEBUG} PATH)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_MAGNUM_PLUGINS_DIR_SUFFIX "-d")
endif()
elseif(MAGNUM_LIBRARY_DEBUG)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_DEBUG})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_DEBUG} PATH)
set(_MAGNUM_PLUGINS_DIR_SUFFIX "-d")
elseif(MAGNUM_LIBRARY_RELEASE)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_RELEASE})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_RELEASE} PATH)
endif()
if(MAGNUM_LIBRARY_RELEASE)
set_property(TARGET Magnum::Magnum APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_property(TARGET Magnum::Magnum PROPERTY
IMPORTED_LOCATION_RELEASE ${MAGNUM_LIBRARY_RELEASE})
endif()
if(MAGNUM_LIBRARY_DEBUG)
set_property(TARGET Magnum::Magnum APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET Magnum::Magnum PROPERTY
IMPORTED_LOCATION_DEBUG ${MAGNUM_LIBRARY_DEBUG})
endif()
# Include directories
set_property(TARGET Magnum::Magnum APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${MAGNUM_INCLUDE_DIR}
${MAGNUM_INCLUDE_DIR}/MagnumExternal/OpenGL)
# Dependent libraries
set_property(TARGET Magnum::Magnum APPEND PROPERTY INTERFACE_LINK_LIBRARIES
Corrade::Utility
Corrade::PluginManager)
# Dependent libraries and includes
if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)
find_package(OpenGL REQUIRED)
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARIES} ${OPENGL_gl_LIBRARY})
elseif(MAGNUM_TARGET_GLES2)
set_property(TARGET Magnum::Magnum APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${OPENGL_gl_LIBRARY})
elseif(MAGNUM_TARGET_GLES2)
find_package(OpenGLES2 REQUIRED)
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARIES} ${OPENGLES2_LIBRARY})
elseif(MAGNUM_TARGET_GLES3)
set_property(TARGET Magnum::Magnum APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenGLES2::OpenGLES2)
elseif(MAGNUM_TARGET_GLES3)
find_package(OpenGLES3 REQUIRED)
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARIES} ${OPENGLES3_LIBRARY})
endif()
# If the configure file is somewhere else than in root include dir (e.g. when
# using CMake subproject), we need to include that dir too
if(NOT ${MAGNUM_INCLUDE_DIR}/Magnum/configure.h STREQUAL ${_MAGNUM_CONFIGURE_FILE})
# Go two levels up
get_filename_component(_MAGNUM_CONFIGURE_FILE_INCLUDE_DIR ${_MAGNUM_CONFIGURE_FILE} DIRECTORY)
get_filename_component(_MAGNUM_CONFIGURE_FILE_INCLUDE_DIR ${_MAGNUM_CONFIGURE_FILE_INCLUDE_DIR} DIRECTORY)
list(APPEND MAGNUM_INCLUDE_DIRS ${_MAGNUM_CONFIGURE_FILE_INCLUDE_DIR})
endif()
set_property(TARGET Magnum::Magnum APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3)
endif()
# Emscripten needs special flag to use WebGL 2
if(CORRADE_TARGET_EMSCRIPTEN AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "USE_WEBGL2")
# Emscripten needs special flag to use WebGL 2
if(CORRADE_TARGET_EMSCRIPTEN AND NOT MAGNUM_TARGET_GLES2)
# TODO: give me INTERFACE_LINK_OPTIONS or something, please
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
endif()
endif()
# Ensure that all inter-component dependencies are specified as well
set(_MAGNUM_ADDITIONAL_COMPONENTS )
foreach(component ${Magnum_FIND_COMPONENTS})
string(TOUPPER ${component} _COMPONENT)
foreach(_component ${Magnum_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# The dependencies need to be sorted by their dependency order as well
if(component STREQUAL Shapes)
if(_component STREQUAL Shapes)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES SceneGraph)
elseif(component STREQUAL Text)
elseif(_component STREQUAL Text)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES TextureTools)
elseif(component STREQUAL DebugTools)
elseif(_component STREQUAL DebugTools)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES MeshTools Primitives SceneGraph Shaders Shapes)
elseif(component STREQUAL MagnumFont)
elseif(_component STREQUAL MagnumFont)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES TgaImporter) # and below
elseif(component STREQUAL MagnumFontConverter)
elseif(_component STREQUAL MagnumFontConverter)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES TgaImageConverter) # and below
elseif(component STREQUAL ObjImporter)
elseif(_component STREQUAL ObjImporter)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES MeshTools)
endif()
if(component MATCHES ".+AudioImporter")
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES ${_MAGNUM_${_COMPONENT}_DEPENDENCIES} Audio)
elseif(component MATCHES ".+(Font|FontConverter)")
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES ${_MAGNUM_${_COMPONENT}_DEPENDENCIES} Text TextureTools)
if(_component MATCHES ".+AudioImporter")
list(APPEND _MAGNUM_${_COMPONENT}_DEPENDENCIES Audio)
elseif(_component MATCHES ".+(Font|FontConverter)")
list(APPEND _MAGNUM_${_COMPONENT}_DEPENDENCIES Text TextureTools)
endif()
list(APPEND _MAGNUM_ADDITIONAL_COMPONENTS ${_MAGNUM_${_COMPONENT}_DEPENDENCIES})
@ -279,227 +323,222 @@ if(Magnum_FIND_COMPONENTS)
list(REMOVE_DUPLICATES Magnum_FIND_COMPONENTS)
endif()
# Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories)
set(_MAGNUM_LIBRARY_COMPONENTS "^(Audio|DebugTools|MeshTools|Primitives|SceneGraph|Shaders|Shapes|Text|TextureTools|GlutApplication|GlxApplication|NaClApplication|Sdl2Application|XEglApplication|WindowlessCglApplication|WindowlessGlxApplication|WindowlessNaClApplication|WindowlessWindowsEglApplication|CglContext|EglContext|GlxContext|WglContext)$")
set(_MAGNUM_PLUGIN_COMPONENTS "^(MagnumFont|MagnumFontConverter|ObjImporter|TgaImageConverter|TgaImporter|WavAudioImporter)$")
set(_MAGNUM_EXECUTABLE_COMPONENTS "^(distancefieldconverter|fontconverter|info)$")
# Find all components
foreach(component ${Magnum_FIND_COMPONENTS})
string(TOUPPER ${component} _COMPONENT)
foreach(_component ${Magnum_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# Create imported target in case the library is found. If the project is
# added as subproject to CMake, the target already exists and all the
# required setup is already done from the build tree.
if(TARGET Magnum::${_component})
set(Magnum_${_component}_FOUND TRUE)
else()
# Library components
if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS})
add_library(Magnum::${_component} UNKNOWN IMPORTED)
# Set library defaults, find the library
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/${_component})
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h)
# Try to find both debug and release version
find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG Magnum${_component}-d)
find_library(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE Magnum${_component})
mark_as_advanced(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG
MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
endif()
# Plugin components
if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS})
add_library(Magnum::${_component} UNKNOWN IMPORTED)
# AudioImporter plugin specific name suffixes
if(${component} MATCHES ".+AudioImporter$")
set(_MAGNUM_${_COMPONENT}_IS_PLUGIN 1)
if(_component MATCHES ".+AudioImporter$")
set(_MAGNUM_${_COMPONENT}_PATH_SUFFIX audioimporters)
# Audio importer class is Audio::*Importer, thus we need to convert
# *AudioImporter.h to *Importer.h
string(REPLACE "AudioImporter" "Importer" _MAGNUM_${_COMPONENT}_HEADER_NAME "${component}")
# Audio importer class is Audio::*Importer, thus we need to
# convert *AudioImporter.h to *Importer.h
string(REPLACE "AudioImporter" "Importer" _MAGNUM_${_COMPONENT}_HEADER_NAME "${_component}")
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES ${_MAGNUM_${_COMPONENT}_HEADER_NAME}.h)
# Importer plugin specific name suffixes
elseif(${component} MATCHES ".+Importer$")
set(_MAGNUM_${_COMPONENT}_IS_PLUGIN 1)
elseif(_component MATCHES ".+Importer$")
set(_MAGNUM_${_COMPONENT}_PATH_SUFFIX importers)
# Font plugin specific name suffixes
elseif(${component} MATCHES ".+Font$")
set(_MAGNUM_${_COMPONENT}_IS_PLUGIN 1)
elseif(_component MATCHES ".+Font$")
set(_MAGNUM_${_COMPONENT}_PATH_SUFFIX fonts)
# ImageConverter plugin specific name suffixes
elseif(${component} MATCHES ".+ImageConverter$")
set(_MAGNUM_${_COMPONENT}_IS_PLUGIN 1)
elseif(_component MATCHES ".+ImageConverter$")
set(_MAGNUM_${_COMPONENT}_PATH_SUFFIX imageconverters)
# FontConverter plugin specific name suffixes
elseif(${component} MATCHES ".+FontConverter$")
set(_MAGNUM_${_COMPONENT}_IS_PLUGIN 1)
elseif(_component MATCHES ".+FontConverter$")
set(_MAGNUM_${_COMPONENT}_PATH_SUFFIX fontconverters)
endif()
# Set plugin defaults, find the plugin
if(_MAGNUM_${_COMPONENT}_IS_PLUGIN)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX MagnumPlugins/${component})
# Don't override the one for *AudioImporter plugins
# Don't override the exception for *AudioImporter plugins
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX MagnumPlugins/${_component})
if(NOT _MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES ${component}.h)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h)
endif()
# Dynamic plugins don't have any prefix (e.g. `lib` on Linux), search
# with empty prefix and then reset that back so we don't accidentaly
# break something else
# Dynamic plugins don't have any prefix (e.g. `lib` on Linux),
# search with empty prefix and then reset that back so we don't
# accidentaly break something else
set(_tmp_prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "")
find_library(MAGNUM_${_COMPONENT}_LIBRARY ${component}
PATH_SUFFIXES magnum/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX})
# Try to find both debug and release version. Dynamic and static debug
# libraries are on different places.
find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${component}
# Try to find both debug and release version. Dynamic and static
# debug libraries are in different places.
find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${_component}
PATH_SUFFIXES magnum-d/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX})
find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${component}-d
find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${_component}-d
PATH_SUFFIXES magnum/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX})
find_library(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE ${component}
find_library(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE ${_component}
PATH_SUFFIXES magnum/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX})
mark_as_advanced(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG
MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
# Set the _LIBRARY variable based on what was found
if(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG AND MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
set(MAGNUM_${_COMPONENT}_LIBRARY
debug ${MAGNUM_${_COMPONENT}_LIBRARY_DEBUG}
optimized ${MAGNUM_${_COMPONENT}_LIBRARY_RELEASE})
elseif(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG)
set(MAGNUM_${_COMPONENT}_LIBRARY ${MAGNUM_${_COMPONENT}_LIBRARY_DEBUG})
elseif(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
set(MAGNUM_${_COMPONENT}_LIBRARY ${MAGNUM_${_COMPONENT}_LIBRARY_RELEASE})
# Reset back
set(CMAKE_FIND_LIBRARY_PREFIXES ${_tmp_prefixes})
endif()
set(CMAKE_FIND_LIBRARY_PREFIXES ${_tmp_prefixes})
# Library location for libraries/plugins
if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS})
if(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_property(TARGET Magnum::${_component} PROPERTY
IMPORTED_LOCATION_RELEASE ${MAGNUM_${_COMPONENT}_LIBRARY_RELEASE})
endif()
# Set library defaults, find the library
else()
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/${component})
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES ${component}.h)
if(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET Magnum::${_component} PROPERTY
IMPORTED_LOCATION_DEBUG ${MAGNUM_${_COMPONENT}_LIBRARY_DEBUG})
endif()
endif()
# Try to find both debug and release version
find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG Magnum${component}-d)
find_library(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE Magnum${component})
# Executables
if(_component MATCHES ${_MAGNUM_EXECUTABLE_COMPONENTS})
add_executable(Magnum::${_component} IMPORTED)
find_program(MAGNUM_${_COMPONENT}_EXECUTABLE magnum-${_component})
mark_as_advanced(MAGNUM_${_COMPONENT}_EXECUTABLE)
# Set the _LIBRARY variable based on what was found
if(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG AND MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
set(MAGNUM_${_COMPONENT}_LIBRARY
debug ${MAGNUM_${_COMPONENT}_LIBRARY_DEBUG}
optimized ${MAGNUM_${_COMPONENT}_LIBRARY_RELEASE})
elseif(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG)
set(MAGNUM_${_COMPONENT}_LIBRARY ${MAGNUM_${_COMPONENT}_LIBRARY_DEBUG})
elseif(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
set(MAGNUM_${_COMPONENT}_LIBRARY ${MAGNUM_${_COMPONENT}_LIBRARY_RELEASE})
if(MAGNUM_${_COMPONENT}_EXECUTABLE)
set_property(TARGET Magnum::${_component} PROPERTY
IMPORTED_LOCATION ${MAGNUM_${_COMPONENT}_EXECUTABLE})
endif()
endif()
# Applications
if(${component} MATCHES ".+Application")
if(_component MATCHES ".+Application")
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/Platform)
# Android application dependencies
if(${component} STREQUAL AndroidApplication)
if(_component STREQUAL AndroidApplication)
find_package(EGL)
if(EGL_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES android ${EGL_LIBRARY})
set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${ANDROID_NATIVE_APP_GLUE_INCLUDE_DIR})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${ANDROID_NATIVE_APP_GLUE_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES android EGL::EGL)
# GLUT application dependencies
elseif(${component} STREQUAL GlutApplication)
elseif(_component STREQUAL GlutApplication)
find_package(GLUT)
if(GLUT_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${GLUT_glut_LIBRARY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${GLUT_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${GLUT_glut_LIBRARY})
# SDL2 application dependencies
elseif(${component} STREQUAL Sdl2Application)
elseif(_component STREQUAL Sdl2Application)
find_package(SDL2)
if(SDL2_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${SDL2_LIBRARIES})
set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
# Find also EGL library, if on ES (and not on WebGL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL)
find_package(EGL)
if(EGL_FOUND)
list(APPEND _MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES SDL2::SDL2)
# (Windowless) NaCl application dependencies
elseif(${component} STREQUAL NaClApplication OR ${component} STREQUAL WindowlessNaClApplication)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ppapi_cpp ppapi)
elseif(_component STREQUAL NaClApplication OR _component STREQUAL WindowlessNaClApplication)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ppapi_cpp ppapi)
# (Windowless) GLX application dependencies
elseif(${component} STREQUAL GlxApplication OR ${component} STREQUAL WindowlessGlxApplication)
elseif(_component STREQUAL GlxApplication OR _component STREQUAL WindowlessGlxApplication)
find_package(X11)
if(X11_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${X11_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES})
# Windowless CGL application has no additional dependencies
# Windowless WGL application has no additional dependencies
# Windowless Windows/EGL application dependencies
elseif(${component} STREQUAL WindowlessWindowsEglApplication)
elseif(_component STREQUAL WindowlessWindowsEglApplication)
find_package(EGL)
if(EGL_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL)
# X/EGL application dependencies
elseif(${component} STREQUAL XEglApplication)
elseif(_component STREQUAL XEglApplication)
find_package(EGL)
find_package(X11)
if(EGL_FOUND AND X11_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARY} ${X11_LIBRARIES})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${X11_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL ${X11_LIBRARIES})
endif()
# Context libraries
elseif(${component} MATCHES ".+Context")
elseif(_component MATCHES ".+Context")
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/Platform)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Context.h)
# GLX context dependencies
if(${component} STREQUAL GlxContext)
if(_component STREQUAL GlxContext)
find_package(X11)
if(X11_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${X11_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES})
endif()
# EGL context dependencies
if(${component} STREQUAL EglContext)
if(_component STREQUAL EglContext)
find_package(EGL)
if(EGL_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARIES})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL)
endif()
# No additional dependencies for CGL context
# No additional dependencies for WGL context
# Audio library
elseif(${component} STREQUAL Audio)
elseif(_component STREQUAL Audio)
find_package(OpenAL)
if(OPENAL_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${OPENAL_LIBRARY})
set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${OPENAL_INCLUDE_DIR})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${OPENAL_LIBRARY})
# No special setup for DebugTools library
# Mesh tools library
elseif(${component} STREQUAL MeshTools)
elseif(_component STREQUAL MeshTools)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES CompressIndices.h)
# Primitives library
elseif(${component} STREQUAL Primitives)
elseif(_component STREQUAL Primitives)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Cube.h)
# No special setup for SceneGraph library
@ -508,94 +547,163 @@ foreach(component ${Magnum_FIND_COMPONENTS})
# No special setup for Text library
# TextureTools library
elseif(${component} STREQUAL TextureTools)
elseif(_component STREQUAL TextureTools)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Atlas.h)
endif()
# No special setup for plugins
# Try to find the includes
if(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES)
# Find library/plugin includes
if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS})
find_path(_MAGNUM_${_COMPONENT}_INCLUDE_DIR
NAMES ${_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES}
HINTS ${MAGNUM_INCLUDE_DIR}/${_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX})
mark_as_advanced(_MAGNUM_${_COMPONENT}_INCLUDE_DIR)
endif()
# Add inter-project dependencies, mark the component as not found if
# any dependency is not found
set(_MAGNUM_${_COMPONENT}_DEPENDENCY_LIBRARIES )
set(_MAGNUM_${_COMPONENT}_DEPENDENCY_INCLUDE_DIRS )
foreach(dependency ${_MAGNUM_${_COMPONENT}_DEPENDENCIES})
string(TOUPPER ${dependency} _DEPENDENCY)
if(MAGNUM_${_DEPENDENCY}_LIBRARY)
list(APPEND _MAGNUM_${_COMPONENT}_DEPENDENCY_LIBRARIES ${MAGNUM_${_DEPENDENCY}_LIBRARY} ${_MAGNUM_${_DEPENDENCY}_LIBRARIES})
list(APPEND _MAGNUM_${_COMPONENT}_DEPENDENCY_INCLUDE_DIRS ${_MAGNUM_${_DEPENDENCY}_INCLUDE_DIRS})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
# Link to core Magnum library, add inter-library dependencies
if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::Magnum)
foreach(_dependency ${_MAGNUM_${_COMPONENT}_DEPENDENCIES})
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::${_dependency})
endforeach()
endif()
# Decide if the library was found
if(MAGNUM_${_COMPONENT}_LIBRARY AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR)
set(MAGNUM_${_COMPONENT}_LIBRARIES
${MAGNUM_${_COMPONENT}_LIBRARY}
${_MAGNUM_${_COMPONENT}_LIBRARIES}
${_MAGNUM_${_COMPONENT}_DEPENDENCY_LIBRARIES}
${MAGNUM_LIBRARIES})
set(MAGNUM_${_COMPONENT}_INCLUDE_DIRS
${_MAGNUM_${_COMPONENT}_INCLUDE_DIRS}
${_MAGNUM_${_COMPONENT}_DEPENDENCY_INCLUDE_DIRS})
set(Magnum_${component}_FOUND TRUE)
# Don't expose variables w/o dependencies to end users
mark_as_advanced(FORCE
MAGNUM_${_COMPONENT}_LIBRARY_DEBUG
MAGNUM_${_COMPONENT}_LIBRARY_RELEASE
MAGNUM_${_COMPONENT}_LIBRARY
_MAGNUM_${_COMPONENT}_INCLUDE_DIR)
# Global aliases for Windowless*Application and *Application
if(((_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS}) AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR AND (MAGNUM_${_COMPONENT}_LIBRARY_DEBUG OR MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)) OR (_component MATCHES ${_MAGNUM_EXECUTABLE_COMPONENTS} AND MAGNUM_${_COMPONENT}_EXECUTABLE))
set(Magnum_${_component}_FOUND TRUE)
else()
set(Magnum_${_component}_FOUND FALSE)
endif()
endif()
# Global aliases for Windowless*Application, *Application and *Context
# 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})
elseif(NOT MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES STREQUAL MAGNUM_${_COMPONENT}_LIBRARIES AND NOT MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS STREQUAL MAGNUM_${_COMPONENT}_INCLUDE_DIRS)
set(MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES-NOTFOUND)
set(MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS-NOTFOUND)
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})
else(NOT MAGNUM_APPLICATION_LIBRARIES STREQUAL MAGNUM_${_COMPONENT}_LIBRARIES AND NOT MAGNUM_APPLICATION_INCLUDE_DIRS STREQUAL MAGNUM_${_COMPONENT}_INCLUDE_DIRS)
set(MAGNUM_APPLICATION_LIBRARIES MAGNUM_APPLICATION_LIBRARIES-NOTFOUND)
set(MAGNUM_APPLICATION_INCLUDE_DIRS MAGNUM_APPLICATION_INCLUDE_DIRS-NOTFOUND)
endif()
endif()
# Global aliases for *Context components. If already set, unset them to
# avoid ambiguity.
if(${component} MATCHES ".+Context")
if(NOT DEFINED MAGNUM_CONTEXT_LIBRARIES AND NOT DEFINED MAGNUM_CONTEXT_INCLUDE_DIRS)
set(MAGNUM_CONTEXT_LIBRARIES ${MAGNUM_${_COMPONENT}_LIBRARIES})
set(MAGNUM_CONTEXT_INCLUDE_DIRS ${MAGNUM_${_COMPONENT}_INCLUDE_DIRS})
if(_component MATCHES "Windowless.+Application")
if(NOT DEFINED _MAGNUM_WINDOWLESSAPPLICATION_ALIAS)
set(_MAGNUM_WINDOWLESSAPPLICATION_ALIAS Magnum::${_component})
else()
unset(MAGNUM_CONTEXT_LIBRARIES)
unset(MAGNUM_CONTEXT_INCLUDE_DIRS)
unset(_MAGNUM_WINDOWLESSAPPLICATION_ALIAS)
endif()
elseif(_component MATCHES ".+Application")
if(NOT DEFINED _MAGNUM_APPLICATION_ALIAS)
set(_MAGNUM_APPLICATION_ALIAS Magnum::${_component})
else()
unset(_MAGNUM_APPLICATION_ALIAS)
endif()
elseif(_component MATCHES ".+Context")
if(NOT DEFINED _MAGNUM_CONTEXT_ALIAS)
set(_MAGNUM_CONTEXT_ALIAS Magnum::${_component})
else()
set(Magnum_${component}_FOUND FALSE)
unset(_MAGNUM_CONTEXT_ALIAS)
endif()
endif()
# Deprecated variables
if(MAGNUM_BUILD_DEPRECATED AND _component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS})
set(MAGNUM_${_COMPONENT}_LIBRARIES Magnum::${_component})
endif()
endforeach()
# Complete the check with also all components
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Magnum
REQUIRED_VARS MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR
HANDLE_COMPONENTS)
# Create Windowless*Application, *Application and *Context aliases
# TODO: ugh why can't I make an alias of IMPORTED target?
if(_MAGNUM_WINDOWLESSAPPLICATION_ALIAS AND NOT TARGET Magnum::WindowlessApplication)
get_target_property(_MAGNUM_WINDOWLESSAPPLICATION_ALIASED_TARGET ${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS} ALIASED_TARGET)
if(_MAGNUM_WINDOWLESSAPPLICATION_ALIASED_TARGET)
add_library(${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS} ALIAS ${_MAGNUM_WINDOWLESSAPPLICATION_ALIASED_TARGET})
else()
add_library(Magnum::WindowlessApplication UNKNOWN IMPORTED)
get_target_property(_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_CONFIGURATIONS ${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS} IMPORTED_CONFIGURATIONS)
get_target_property(_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_RELEASE ${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS} IMPORTED_LOCATION_RELEASE)
get_target_property(_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_DEBUG ${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS} IMPORTED_LOCATION_DEBUG)
set_target_properties(Magnum::WindowlessApplication PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS},INTERFACE_INCLUDE_DIRECTORIES>
INTERFACE_COMPILE_DEFINITIONS $<TARGET_PROPERTY:${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS},INTERFACE_COMPILE_DEFINITIONS>
INTERFACE_COMPILE_OPTIONS $<TARGET_PROPERTY:${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS},INTERFACE_COMPILE_OPTIONS>
INTERFACE_LINK_LIBRARIES $<TARGET_PROPERTY:${_MAGNUM_WINDOWLESSAPPLICATION_ALIAS},INTERFACE_LINK_LIBRARIES>
IMPORTED_CONFIGURATIONS ${_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_CONFIGURATIONS})
if(_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_RELEASE)
set_target_properties(Magnum::WindowlessApplication PROPERTIES
IMPORTED_LOCATION_RELEASE ${_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_RELEASE})
endif()
if(_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_DEBUG)
set_target_properties(Magnum::WindowlessApplication PROPERTIES
IMPORTED_LOCATION_DEBUG ${_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_DEBUG})
endif()
endif()
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES Magnum::WindowlessApplication)
endif()
# Prevent creating the alias again
unset(_MAGNUM_WINDOWLESSAPPLICATION_ALIAS)
endif()
if(_MAGNUM_APPLICATION_ALIAS AND NOT TARGET Magnum::Application)
get_target_property(_MAGNUM_APPLICATION_ALIASED_TARGET ${_MAGNUM_APPLICATION_ALIAS} ALIASED_TARGET)
if(_MAGNUM_APPLICATION_ALIASED_TARGET)
add_library(${_MAGNUM_APPLICATION_ALIAS} ALIAS ${_MAGNUM_APPLICATION_ALIASED_TARGET})
else()
add_library(Magnum::Application UNKNOWN IMPORTED)
get_target_property(_MAGNUM_APPLICATION_IMPORTED_CONFIGURATIONS ${_MAGNUM_APPLICATION_ALIAS} IMPORTED_CONFIGURATIONS)
get_target_property(_MAGNUM_APPLICATION_IMPORTED_LOCATION_RELEASE ${_MAGNUM_APPLICATION_ALIAS} IMPORTED_LOCATION_RELEASE)
get_target_property(_MAGNUM_APPLICATION_IMPORTED_LOCATION_DEBUG ${_MAGNUM_APPLICATION_ALIAS} IMPORTED_LOCATION_DEBUG)
set_target_properties(Magnum::Application PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${_MAGNUM_APPLICATION_ALIAS},INTERFACE_INCLUDE_DIRECTORIES>
INTERFACE_COMPILE_DEFINITIONS $<TARGET_PROPERTY:${_MAGNUM_APPLICATION_ALIAS},INTERFACE_COMPILE_DEFINITIONS>
INTERFACE_COMPILE_OPTIONS $<TARGET_PROPERTY:${_MAGNUM_APPLICATION_ALIAS},INTERFACE_COMPILE_OPTIONS>
INTERFACE_LINK_LIBRARIES $<TARGET_PROPERTY:${_MAGNUM_APPLICATION_ALIAS},INTERFACE_LINK_LIBRARIES>
IMPORTED_CONFIGURATIONS ${_MAGNUM_APPLICATION_IMPORTED_CONFIGURATIONS})
if(_MAGNUM_APPLICATION_IMPORTED_LOCATION_RELEASE)
set_target_properties(Magnum::Application PROPERTIES
IMPORTED_LOCATION_RELEASE ${_MAGNUM_APPLICATION_IMPORTED_LOCATION_RELEASE})
endif()
if(_MAGNUM_APPLICATION_IMPORTED_LOCATION_DEBUG)
set_target_properties(Magnum::Application PROPERTIES
IMPORTED_LOCATION_DEBUG ${_MAGNUM_APPLICATION_IMPORTED_LOCATION_DEBUG})
endif()
endif()
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_APPLICATION_LIBRARIES Magnum::Application)
endif()
# Prevent creating the alias again
unset(_MAGNUM_APPLICATION_ALIAS)
endif()
if(_MAGNUM_CONTEXT_ALIAS AND NOT TARGET Magnum::Context)
get_target_property(_MAGNUM_CONTEXT_ALIASED_TARGET ${_MAGNUM_CONTEXT_ALIAS} ALIASED_TARGET)
if(_MAGNUM_CONTEXT_ALIASED_TARGET)
add_library(${_MAGNUM_CONTEXT_ALIAS} ALIAS ${_MAGNUM_CONTEXT_ALIASED_TARGET})
else()
add_library(Magnum::Context UNKNOWN IMPORTED)
get_target_property(_MAGNUM_CONTEXT_IMPORTED_CONFIGURATIONS ${_MAGNUM_CONTEXT_ALIAS} IMPORTED_CONFIGURATIONS)
get_target_property(_MAGNUM_CONTEXT_IMPORTED_LOCATION_RELEASE ${_MAGNUM_CONTEXT_ALIAS} IMPORTED_LOCATION_RELEASE)
get_target_property(_MAGNUM_CONTEXT_IMPORTED_LOCATION_DEBUG ${_MAGNUM_CONTEXT_ALIAS} IMPORTED_LOCATION_DEBUG)
set_target_properties(Magnum::Context PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${_MAGNUM_CONTEXT_ALIAS},INTERFACE_INCLUDE_DIRECTORIES>
INTERFACE_COMPILE_DEFINITIONS $<TARGET_PROPERTY:${_MAGNUM_CONTEXT_ALIAS},INTERFACE_COMPILE_DEFINITIONS>
INTERFACE_COMPILE_OPTIONS $<TARGET_PROPERTY:${_MAGNUM_CONTEXT_ALIAS},INTERFACE_COMPILE_OPTIONS>
INTERFACE_LINK_LIBRARIES $<TARGET_PROPERTY:${_MAGNUM_CONTEXT_ALIAS},INTERFACE_LINK_LIBRARIES>
IMPORTED_CONFIGURATIONS ${_MAGNUM_CONTEXT_IMPORTED_CONFIGURATIONS})
if(_MAGNUM_CONTEXT_IMPORTED_LOCATION_RELEASE)
set_target_properties(Magnum::Context PROPERTIES
IMPORTED_LOCATION_RELEASE ${_MAGNUM_CONTEXT_IMPORTED_LOCATION_RELEASE})
endif()
if(_MAGNUM_CONTEXT_IMPORTED_LOCATION_DEBUG)
set_target_properties(Magnum::Context PROPERTIES
IMPORTED_LOCATION_DEBUG ${_MAGNUM_CONTEXT_IMPORTED_LOCATION_DEBUG})
endif()
endif()
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_CONTEXT_LIBRARIES Magnum::Context)
endif()
# Prevent creating the alias again
unset(_MAGNUM_CONTEXT_ALIAS)
endif()
# Installation dirs
include(${CORRADE_LIB_SUFFIX_MODULE})
set(MAGNUM_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
@ -615,29 +723,6 @@ set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTAL
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/audioimporters)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins)
mark_as_advanced(FORCE
MAGNUM_LIBRARY_DEBUG
MAGNUM_LIBRARY_RELEASE
MAGNUM_LIBRARY
MAGNUM_INCLUDE_DIR
MAGNUM_BINARY_INSTALL_DIR
MAGNUM_LIBRARY_INSTALL_DIR
MAGNUM_PLUGINS_DEBUG_INSTALL_DIR
MAGNUM_PLUGINS_RELEASE_INSTALL_DIR
MAGNUM_PLUGINS_FONT_DEBUG_INSTALL_DIR
MAGNUM_PLUGINS_FONT_RELEASE_INSTALL_DIR
MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_INSTALL_DIR
MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_INSTALL_DIR
MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_INSTALL_DIR
MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_INSTALL_DIR
MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR
MAGNUM_PLUGINS_IMPORTER_RELEASE_INSTALL_DIR
MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR
MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR
MAGNUM_CMAKE_MODULE_INSTALL_DIR
MAGNUM_INCLUDE_INSTALL_DIR
MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR
_MAGNUM_CONFIGURE_FILE)
# Get base plugin directory from main library location
set(MAGNUM_PLUGINS_DEBUG_DIR ${_MAGNUM_LIBRARY_PATH}/magnum-d
@ -663,3 +748,8 @@ set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters)
# Deprecated variables
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_LIBRARIES Magnum::Magnum)
endif()

30
modules/FindOpenGLES2.cmake

@ -1,8 +1,14 @@
# - Find OpenGL ES 2
#.rst:
# Find OpenGL ES 2
# ----------------
#
# This module defines:
# Finds the OpenGL ES 2 library. This module defines:
#
# OpenGLES2_FOUND - True if OpenGL ES 2 library is found
# OpenGLES2::OpenGLES2 - OpenGL ES 2 imported target
#
# Additionally these variables are defined for internal usage:
#
# OPENGLES2_FOUND - True if OpenGL ES 2 library is found
# OPENGLES2_LIBRARY - OpenGL ES 2 library
# OPENGLES2_INCLUDE_DIR - Include dir
#
@ -57,6 +63,22 @@ find_path(OPENGLES2_INCLUDE_DIR NAMES
ES2/gl.h)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("OpenGLES2" DEFAULT_MSG
find_package_handle_standard_args(OpenGLES2 DEFAULT_MSG
${OPENGLES2_LIBRARY_NEEDED}
OPENGLES2_INCLUDE_DIR)
if(NOT TARGET OpenGLES2::OpenGLES2)
if(OPENGLES2_LIBRARY_NEEDED)
add_library(OpenGLES2::OpenGLES2 UNKNOWN IMPORTED)
set_property(TARGET OpenGLES2::OpenGLES2 PROPERTY
IMPORTED_LOCATION ${OPENGLES2_LIBRARY})
else()
# This won't work in CMake 2.8.12, but that affects Emscripten only so
# I assume people building for that are not on that crap old Ubuntu
# 14.04 LTS
add_library(OpenGLES2::OpenGLES2 INTERFACE IMPORTED)
endif()
set_property(TARGET OpenGLES2::OpenGLES2 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${OPENGLES2_INCLUDE_DIR})
endif()

28
modules/FindOpenGLES3.cmake

@ -1,8 +1,14 @@
# - Find OpenGL ES 3
#.rst:
# Find OpenGL ES 3
# ----------------
#
# This module defines:
# Finds the OpenGL ES 3 library. This module defines:
#
# OpenGLES3_FOUND - True if OpenGL ES 3 library is found
# OpenGLES3::OpenGLES3 - OpenGL ES 3 imported target
#
# Additionally these variables are defined for internal usage:
#
# OPENGLES3_FOUND - True if OpenGL ES 3 library is found
# OPENGLES3_LIBRARY - OpenGL ES 3 library
# OPENGLES3_INCLUDE_DIR - Include dir
#
@ -61,3 +67,19 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("OpenGLES3" DEFAULT_MSG
${OPENGLES3_LIBRARY_NEEDED}
OPENGLES3_INCLUDE_DIR)
if(NOT TARGET OpenGLES3::OpenGLES3)
if(OPENGLES3_LIBRARY_NEEDED)
add_library(OpenGLES3::OpenGLES3 UNKNOWN IMPORTED)
set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY
IMPORTED_LOCATION ${OPENGLES3_LIBRARY})
else()
# This won't work in CMake 2.8.12, but that affects Emscripten only so
# I assume people building for that are not on that crap old Ubuntu
# 14.04 LTS
add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED)
endif()
set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${OPENGLES3_INCLUDE_DIR})
endif()

42
modules/FindSDL2.cmake

@ -1,14 +1,16 @@
# - Find SDL2
#.rst:
# Find SDL2
# ---------
#
# This module defines:
# Finds the SDL2 library. This module defines:
#
# SDL2_FOUND - True if SDL2 library is found
# SDL2_LIBRARIES - SDL2 library and dependent libraries
# SDL2_INCLUDE_DIRS - Root include dir and include dirs of dependencies
# SDL2::SDL2 - SDL2 imported target
#
# Additionally these variables are defined for internal usage:
# SDL2_INCLUDE_DIR - Root include dir (w/o dependencies)
# SDL2_LIBRARY - SDL2 library (w/o dependencies)
#
# SDL2_LIBRARY - SDL2 library
# SDL2_INCLUDE_DIR - Root include dir
#
#
@ -89,5 +91,29 @@ find_package_handle_standard_args("SDL2" DEFAULT_MSG
${_SDL2_FRAMEWORK_LIBRARY_NAMES}
SDL2_INCLUDE_DIR)
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
set(SDL2_LIBRARIES ${SDL2_LIBRARY} ${_SDL2_FRAMEWORK_LIBRARIES})
if(NOT TARGET SDL2::SDL2)
if(SDL2_LIBRARY_NEEDED)
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY})
# Link frameworks on iOS
if(CORRADE_TARGET_IOS)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${_SDL2_FRAMEWORK_LIBRARIES})
endif()
# Link also EGL library, if on ES (and not on WebGL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL)
endif()
else()
# This won't work in CMake 2.8.12, but that affects Emscripten only so
# I assume people building for that are not on that crap old Ubuntu
# 14.04 LTS
add_library(SDL2::SDL2 INTERFACE IMPORTED)
endif()
set_property(TARGET SDL2::SDL2 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR})
endif()

14
src/CMakeLists.txt

@ -27,7 +27,7 @@
# without any warning, only in release build, any attempt to add debug print
# results in issue disappearing. Not an issue on Clang or GCC < 4.8.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
add_compile_options("-fno-strict-aliasing")
endif()
# On MSVC remove /W3, as we are replacing it with /W4
@ -37,17 +37,13 @@ endif()
# Emscripten needs special flag to use WebGL 2
if(CORRADE_TARGET_EMSCRIPTEN AND NOT TARGET_GLES2)
# TODO: give me INTERFACE_LINK_OPTIONS or something, please
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CORRADE_INCLUDE_DIRS})
# We can use both implicit include path (GLES2/gl2.h) where our headers can
# be overriden with system ones or explicit (MagnumExternal/OpenGL/GLES2/gl2ext.h)
# where only our headers will be used
include_directories(${PROJECT_SOURCE_DIR}/src/MagnumExternal/OpenGL)
set_directory_properties(PROPERTIES
CORRADE_CXX_STANDARD 11
CORRADE_USE_PEDANTIC_FLAGS ON)
add_subdirectory(MagnumExternal)
add_subdirectory(Magnum)

11
src/Magnum/Audio/CMakeLists.txt

@ -25,8 +25,6 @@
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
set(MagnumAudio_SRCS
AbstractImporter.cpp
Audio.cpp
@ -60,13 +58,12 @@ endif()
add_library(MagnumAudio ${SHARED_OR_STATIC}
${MagnumAudio_SRCS}
${MagnumAudio_HEADERS})
target_include_directories(MagnumAudio PUBLIC ${OPENAL_INCLUDE_DIR})
set_target_properties(MagnumAudio PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumAudio PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumAudio Magnum ${CORRADE_PLUGINMANAGER_LIBRARIES} ${OPENAL_LIBRARY})
target_link_libraries(MagnumAudio Magnum Corrade::PluginManager ${OPENAL_LIBRARY})
if(WITH_SCENEGRAPH)
target_link_libraries(MagnumAudio MagnumSceneGraph)
endif()
@ -81,5 +78,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum Audio library for superprojects
set(MAGNUM_AUDIO_LIBRARY MagnumAudio CACHE INTERNAL "")
# Magnum Audio target alias for superprojects
add_library(Magnum::Audio ALIAS MagnumAudio)

10
src/Magnum/Audio/Extensions.h

@ -50,11 +50,11 @@ usage.
This namespace is not built by default. It is built if `WITH_AUDIO` is
enabled when building Magnum. To use this library, you need to request
`Audio` component of `Magnum` package in CMake, add `${MAGNUM_AUDIO_INCLUDE_DIRS}`
to include path and link to `${MAGNUM_AUDIO_LIBRARIES}`. See @ref building and
@ref cmake for more information. Additional plugins are enabled separately, see
particular `*Importer` class documentation, @ref building-plugins,
@ref cmake-plugins and @ref plugins for more information.
`Audio` component of `Magnum` package in CMake and link to `Magnum::Audio`
target. See @ref building and @ref cmake for more information. Additional
plugins are enabled separately, see particular `*Importer` class documentation,
@ref building-plugins, @ref cmake-plugins and @ref plugins for more
information.
@see @ref MAGNUM_ASSERT_AUDIO_EXTENSION_SUPPORTED()
@todo Manual indices for extensions, this has gaps
*/

3
src/Magnum/Audio/Test/CMakeLists.txt

@ -27,9 +27,8 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(AudioAbstractImporterTest AbstractImporterTest.cpp LIBRARIES MagnumAudio)
target_include_directories(AudioAbstractImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(AudioBufferTest BufferTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioContextTest ContextTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioRendererTest RendererTest.cpp LIBRARIES MagnumAudio)

34
src/Magnum/CMakeLists.txt

@ -232,8 +232,9 @@ set(MagnumMath_SRCS
# Objects shared between main and test library
add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS})
target_include_directories(MagnumMathObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_STATIC)
set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS")
target_compile_definitions(MagnumMathObjects PRIVATE "MagnumMathObjects_EXPORTS")
endif()
if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumMathObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
@ -248,22 +249,27 @@ add_library(Magnum ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumMathObjects>)
set_target_properties(Magnum PROPERTIES DEBUG_POSTFIX "-d")
if(NOT BUILD_STATIC)
set_target_properties(Magnum PROPERTIES COMPILE_FLAGS "-DFlextGL_EXPORTS")
target_compile_definitions(Magnum PRIVATE "FlextGL_EXPORTS")
elseif(BUILD_STATIC_PIC)
set_target_properties(Magnum PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
set(Magnum_LIBS
${CORRADE_UTILITY_LIBRARIES}
${CORRADE_PLUGINMANAGER_LIBRARIES})
# We can use both implicit include path (GLES2/gl2.h) where our headers can
# be overriden with system ones or explicit (MagnumExternal/OpenGL/GLES2/gl2ext.h)
# where only our headers will be used
target_include_directories(Magnum PUBLIC
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
${PROJECT_SOURCE_DIR}/src/MagnumExternal/OpenGL)
target_link_libraries(Magnum
Corrade::Utility
Corrade::PluginManager)
if(NOT TARGET_GLES OR TARGET_DESKTOP_GLES)
set(Magnum_LIBS ${Magnum_LIBS} ${OPENGL_gl_LIBRARY})
target_link_libraries(Magnum ${OPENGL_gl_LIBRARY})
elseif(TARGET_GLES2)
set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES2_LIBRARY})
target_link_libraries(Magnum OpenGLES2::OpenGLES2)
else()
set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES3_LIBRARY})
target_link_libraries(Magnum OpenGLES3::OpenGLES3)
endif()
target_link_libraries(Magnum ${Magnum_LIBS})
install(TARGETS Magnum
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
@ -318,10 +324,10 @@ if(BUILD_TESTS)
add_library(MagnumMathTestLib ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumMathObjects>
Math/dummy.cpp) # XCode workaround, see file comment for details
set_target_properties(MagnumMathTestLib PROPERTIES
COMPILE_FLAGS "-DCORRADE_GRACEFUL_ASSERT"
DEBUG_POSTFIX "-d")
target_link_libraries(MagnumMathTestLib ${CORRADE_UTILITY_LIBRARIES})
target_include_directories(MagnumMathTestLib PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(MagnumMathTestLib PRIVATE "CORRADE_GRACEFUL_ASSERT")
set_target_properties(MagnumMathTestLib PROPERTIES DEBUG_POSTFIX "-d")
target_link_libraries(MagnumMathTestLib Corrade::Utility)
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too

4
src/Magnum/DebugTools/CMakeLists.txt

@ -113,5 +113,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum DebugTools library for superprojects
set(MAGNUM_DEBUGTOOLS_LIBRARY MagnumDebugTools CACHE INTERNAL "")
# Magnum DebugTools target alias for superprojects
add_library(Magnum::DebugTools ALIAS MagnumDebugTools)

5
src/Magnum/Extensions.h

@ -58,9 +58,8 @@ but these structs are better suited for compile-time decisions rather than
@ref Extension instances. See @ref Context::isExtensionSupported() for example
usage.
This namespace is built by default. To use it, you need to add `${MAGNUM_INCLUDE_DIRS}`
to include path and link to `${MAGNUM_LIBRARIES}`. See @ref building and
@ref cmake for more information.
This namespace is built by default. To use it, you need to link to
`Magnum::Magnum` target. See @ref building and @ref cmake for more information.
@see @ref MAGNUM_ASSERT_EXTENSION_SUPPORTED()
@todo Manual indices for extensions, this has gaps
*/

2
src/Magnum/Math/Geometry/Test/CMakeLists.txt

@ -23,5 +23,5 @@
# DEALINGS IN THE SOFTWARE.
#
corrade_add_test(MathGeometryDistanceTest DistanceTest.cpp)
corrade_add_test(MathGeometryDistanceTest DistanceTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathGeometryIntersectionTest IntersectionTest.cpp LIBRARIES MagnumMathTestLib)

14
src/Magnum/Math/Test/CMakeLists.txt

@ -23,11 +23,11 @@
# DEALINGS IN THE SOFTWARE.
#
corrade_add_test(MathBoolVectorTest BoolVectorTest.cpp)
corrade_add_test(MathConstantsTest ConstantsTest.cpp)
corrade_add_test(MathBoolVectorTest BoolVectorTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathConstantsTest ConstantsTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathFunctionsTest FunctionsTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathTagsTest TagsTest.cpp)
corrade_add_test(MathTypeTraitsTest TypeTraitsTest.cpp)
corrade_add_test(MathTagsTest TagsTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathTypeTraitsTest TypeTraitsTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathVectorTest VectorTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathVector2Test Vector2Test.cpp LIBRARIES MagnumMathTestLib)
@ -41,7 +41,7 @@ corrade_add_test(MathMatrix3Test Matrix3Test.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathMatrix4Test Matrix4Test.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathSwizzleTest SwizzleTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathUnitTest UnitTest.cpp)
corrade_add_test(MathUnitTest UnitTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathAngleTest AngleTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathRangeTest RangeTest.cpp LIBRARIES MagnumMathTestLib)
@ -51,7 +51,7 @@ corrade_add_test(MathDualComplexTest DualComplexTest.cpp LIBRARIES MagnumMathTes
corrade_add_test(MathQuaternionTest QuaternionTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(MathDualQuaternionTest DualQuaternionTest.cpp LIBRARIES MagnumMathTestLib)
set_target_properties(
set_property(TARGET
MathVectorTest
MathMatrixTest
MathMatrix3Test
@ -60,4 +60,4 @@ set_target_properties(
MathDualComplexTest
MathQuaternionTest
MathDualQuaternionTest
PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
APPEND PROPERTY COMPILE_DEFINITIONS "CORRADE_GRACEFUL_ASSERT")

14
src/Magnum/MeshTools/CMakeLists.txt

@ -56,8 +56,9 @@ set(MagnumMeshTools_HEADERS
add_library(MagnumMeshToolsObjects OBJECT
${MagnumMeshTools_SRCS}
${MagnumMeshTools_HEADERS})
target_include_directories(MagnumMeshToolsObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_STATIC)
set_target_properties(MagnumMeshToolsObjects PROPERTIES COMPILE_FLAGS "-DMagnumMeshToolsObjects_EXPORTS")
target_compile_definitions(MagnumMeshToolsObjects PRIVATE "MagnumMeshToolsObjects_EXPORTS")
endif()
if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumMeshToolsObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
@ -85,13 +86,12 @@ if(BUILD_TESTS)
add_library(MagnumMeshToolsTestLib ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumMeshToolsObjects>
${MagnumMeshTools_GracefulAssert_SRCS})
set_target_properties(MagnumMeshToolsTestLib PROPERTIES
COMPILE_FLAGS "-DCORRADE_GRACEFUL_ASSERT -DMagnumMeshTools_EXPORTS"
DEBUG_POSTFIX "-d")
set_target_properties(MagnumMeshToolsTestLib PROPERTIES DEBUG_POSTFIX "-d")
target_compile_definitions(MagnumMeshToolsTestLib PRIVATE
"CORRADE_GRACEFUL_ASSERT" "MagnumMeshTools_EXPORTS")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumMeshToolsTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumMeshToolsTestLib Magnum)
# On Windows we need to install first and then run the tests to avoid "DLL
@ -106,5 +106,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum MeshTools library for superprojects
set(MAGNUM_MESHTOOLS_LIBRARY MagnumMeshTools CACHE INTERNAL "")
# Magnum MeshTools target alias for superprojects
add_library(Magnum::MeshTools ALIAS MagnumMeshTools)

11
src/Magnum/MeshTools/Test/CMakeLists.txt

@ -25,18 +25,19 @@
corrade_add_test(MeshToolsCombineIndexedArraysTest CombineIndexedArraysTest.cpp LIBRARIES MagnumMeshToolsTestLib)
corrade_add_test(MeshToolsCompressIndicesTest CompressIndicesTest.cpp LIBRARIES MagnumMeshToolsTestLib)
corrade_add_test(MeshToolsDuplicateTest DuplicateTest.cpp)
corrade_add_test(MeshToolsDuplicateTest DuplicateTest.cpp LIBRARIES Magnum)
corrade_add_test(MeshToolsFlipNormalsTest FlipNormalsTest.cpp LIBRARIES MagnumMeshToolsTestLib)
corrade_add_test(MeshToolsGenerateFlatNormalsTest GenerateFlatNormalsTest.cpp LIBRARIES MagnumMeshToolsTestLib)
corrade_add_test(MeshToolsInterleaveTest InterleaveTest.cpp)
corrade_add_test(MeshToolsInterleaveTest InterleaveTest.cpp LIBRARIES Magnum)
corrade_add_test(MeshToolsRemoveDuplicatesTest RemoveDuplicatesTest.cpp LIBRARIES Magnum)
corrade_add_test(MeshToolsSubdivideTest SubdivideTest.cpp)
corrade_add_test(MeshToolsSubdivideTest SubdivideTest.cpp LIBRARIES Magnum)
# corrade_add_test(MeshToolsSubdivideRemoveDuplicatesBenchmark SubdivideRemoveDuplicatesBenchmark.h SubdivideRemoveDuplicatesBenchmark.cpp MagnumPrimitives)
corrade_add_test(MeshToolsTipsifyTest TipsifyTest.cpp LIBRARIES MagnumMeshTools)
corrade_add_test(MeshToolsTransformTest TransformTest.cpp LIBRARIES MagnumMeshTools)
# Graceful assert for testing
set_target_properties(MeshToolsCombineIndexedArraysTest
set_property(TARGET
MeshToolsCombineIndexedArraysTest
MeshToolsInterleaveTest
MeshToolsSubdivideTest
PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
APPEND PROPERTY COMPILE_DEFINITIONS "CORRADE_GRACEFUL_ASSERT")

12
src/Magnum/Platform/AndroidApplication.h

@ -112,13 +112,11 @@ can be then installed directly on the device or emulator using `adb install`.
For CMake you need to copy `FindEGL.cmake` and `FindOpenGLES2.cmake` (or
`FindOpenGLES3.cmake`) from `modules/` directory in Magnum source to `modules/`
dir in your project (so it is able to find EGL and OpenGL ES libraries).
Request `AndroidApplication` component, add
`${MAGNUM_ANDROIDAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_ANDROIDAPPLICATION_LIBRARIES}`. If no other application is requested,
you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_APPLICATION_LIBRARIES}` aliases to simplify porting. Again, see
@ref building and @ref cmake for more information. Note that unlike on other
platforms you need to create *shared library* instead of executable. The
Request `AndroidApplication` component of `Magnum` package and link to
`Magnum::AndroidApplication` target. If no other application is requested, you
can also use generic `Magnum::Application` alias to simplify porting. Again,
see @ref building and @ref cmake for more information. Note that unlike on
other platforms you need to create *shared library* instead of executable. The
resulting binary then needs to be copied to `lib/armeabi-v7a` and `lib/x86`,
you can do that automatically in CMake using the following commands:

139
src/Magnum/Platform/CMakeLists.txt

@ -61,8 +61,6 @@ if(WITH_ANDROIDAPPLICATION)
set(NEED_EGLCONTEXT 1)
include_directories(${ANDROID_NATIVE_APP_GLUE_INCLUDE_DIR})
set(MagnumAndroidApplication_SRCS
AndroidApplication.cpp
Implementation/Egl.cpp
@ -77,6 +75,7 @@ if(WITH_ANDROIDAPPLICATION)
${MagnumAndroidApplication_HEADERS}
${MagnumAndroidApplication_PRIVATE_HEADERS}
${ANDROID_NATIVE_APP_GLUE_SRC})
target_include_directories(MagnumAndroidApplication PUBLIC ${ANDROID_NATIVE_APP_GLUE_INCLUDE_DIR})
set_target_properties(MagnumAndroidApplication PROPERTIES DEBUG_POSTFIX "-d")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
@ -88,8 +87,8 @@ if(WITH_ANDROIDAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum AndroidApplication library for superprojects
set(MAGNUM_ANDROIDAPPLICATION_LIBRARY MagnumAndroidApplication CACHE INTERNAL "")
# Magnum AndroidApplication target alias for superprojects
add_library(Magnum::AndroidApplication ALIAS MagnumAndroidApplication)
endif()
# GLUT application
@ -110,7 +109,8 @@ if(WITH_GLUTAPPLICATION)
set_target_properties(MagnumGlutApplication PROPERTIES DEBUG_POSTFIX "-d")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumGlutApplication Magnum)
target_include_directories(MagnumGlutApplication PUBLIC ${GLUT_INCLUDE_DIR})
target_link_libraries(MagnumGlutApplication Magnum ${GLUT_glut_LIBRARY})
install(FILES ${MagnumGlutApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumGlutApplication
@ -118,8 +118,8 @@ if(WITH_GLUTAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum GlutApplication library for superprojects
set(MAGNUM_GLUTAPPLICATION_LIBRARY MagnumGlutApplication CACHE INTERNAL "")
# Magnum GlutApplication target alias for superprojects
add_library(Magnum::GlutApplication ALIAS MagnumGlutApplication)
endif()
# SDL2 application
@ -129,8 +129,6 @@ if(WITH_SDL2APPLICATION)
message(FATAL_ERROR "SDL2 library, required by Sdl2Application, was not found. Set WITH_SDL2APPLICATION to OFF to skip building it.")
endif()
include_directories(${SDL2_INCLUDE_DIRS})
set(MagnumSdl2Application_SRCS
Sdl2Application.cpp
${MagnumSomeContext_OBJECTS})
@ -142,7 +140,7 @@ if(WITH_SDL2APPLICATION)
set_target_properties(MagnumSdl2Application PROPERTIES DEBUG_POSTFIX "-d")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumSdl2Application Magnum)
target_link_libraries(MagnumSdl2Application Magnum SDL2::SDL2)
install(FILES ${MagnumSdl2Application_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumSdl2Application
@ -150,8 +148,8 @@ if(WITH_SDL2APPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum Sdl2Application library for superprojects
set(MAGNUM_SDL2APPLICATION_LIBRARY MagnumSdl2Application CACHE INTERNAL "")
# Magnum Sdl2Application target alias for superprojects
add_library(Magnum::Sdl2Application ALIAS MagnumSdl2Application)
endif()
# NaCl application
@ -169,13 +167,16 @@ if(WITH_NACLAPPLICATION)
set_target_properties(MagnumNaClApplication PROPERTIES DEBUG_POSTFIX "-d")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumNaClApplication Magnum)
target_link_libraries(MagnumNaClApplication Magnum ppapi_cpp ppapi)
install(FILES ${MagnumNaClApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumNaClApplication
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum NaClApplication target alias for superprojects
add_library(Magnum::NaClApplication ALIAS MagnumNaClApplication)
endif()
# Windowless NaCl application
@ -191,10 +192,9 @@ if(WITH_WINDOWLESSNACLAPPLICATION)
${MagnumWindowlessNaClApplication_SRCS}
${MagnumWindowlessNaClApplication_HEADERS})
set_target_properties(MagnumWindowlessNaClApplication PROPERTIES DEBUG_POSTFIX "-d")
target_link_libraries(MagnumWindowlessNaClApplication Magnum ppapi_cpp ppapi)
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumWindowlessNaClApplication Magnum)
target_link_libraries(MagnumWindowlessNaClApplication Magnum ppapi_cpp ppapi)
install(FILES ${MagnumWindowlessNaClApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumWindowlessNaClApplication
@ -202,8 +202,8 @@ if(WITH_WINDOWLESSNACLAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum WindowlessNaClApplication library for superprojects
set(MAGNUM_WINDOWLESSNACLAPPLICATION_LIBRARY MagnumWindowlessNaClApplication CACHE INTERNAL "")
# Magnum WindowlessNaClApplication target alias for superprojects
add_library(Magnum::WindowlessNaClApplication ALIAS MagnumWindowlessNaClApplication)
endif()
# JavaScript and CSS stuff for NaCl
@ -243,7 +243,8 @@ if(WITH_GLXAPPLICATION)
set_target_properties(MagnumGlxApplication PROPERTIES DEBUG_POSTFIX "-d")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumGlxApplication Magnum)
target_include_directories(MagnumGlxApplication PUBLIC ${X11_INCLUDE_DIR})
target_link_libraries(MagnumGlxApplication Magnum ${X11_LIBRARIES})
install(FILES ${MagnumGlxApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumGlxApplication
@ -251,8 +252,8 @@ if(WITH_GLXAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum GlxApplication library for superprojects
set(MAGNUM_GLXAPPLICATION_LIBRARY MagnumGlxApplication CACHE INTERNAL "")
# Magnum GlxApplication target alias for superprojects
add_library(Magnum::GlxApplication ALIAS MagnumGlxApplication)
endif()
# X/EGL application
@ -274,7 +275,8 @@ if(WITH_XEGLAPPLICATION)
set_target_properties(MagnumXEglApplication PROPERTIES DEBUG_POSTFIX "-d")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumXEglApplication Magnum)
target_include_directories(MagnumXEglApplication PUBLIC ${X11_INCLUDE_DIR})
target_link_libraries(MagnumXEglApplication Magnum ${X11_LIBRARIES})
install(FILES ${MagnumXEglApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumXEglApplication
@ -282,8 +284,8 @@ if(WITH_XEGLAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum XEglApplication library for superprojects
set(MAGNUM_XEGLAPPLICATION_LIBRARY MagnumXEglApplication CACHE INTERNAL "")
# Magnum XEglApplication target alias for superprojects
add_library(Magnum::XEglApplication ALIAS MagnumXEglApplication)
endif()
if(WITH_WINDOWLESSGLXAPPLICATION OR NEED_ABSTRACTXAPPLICATION)
@ -306,13 +308,12 @@ if(WITH_WINDOWLESSGLXAPPLICATION)
${MagnumWindowlessGlxApplication_SRCS}
${MagnumWindowlessGlxApplication_HEADERS})
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties(MagnumWindowlessGlxApplication PROPERTIES
COMPILE_FLAGS "-Wno-old-style-cast"
DEBUG_POSTFIX "-d")
target_link_libraries(MagnumWindowlessGlxApplication Magnum ${X11_LIBRARIES})
set_target_properties(MagnumWindowlessGlxApplication PROPERTIES DEBUG_POSTFIX "-d")
target_compile_options(MagnumWindowlessGlxApplication PRIVATE "-Wno-old-style-cast")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumWindowlessGlxApplication Magnum)
target_include_directories(MagnumWindowlessGlxApplication PUBLIC ${X11_INCLUDE_DIR})
target_link_libraries(MagnumWindowlessGlxApplication Magnum ${X11_LIBRARIES})
install(FILES ${MagnumWindowlessGlxApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumWindowlessGlxApplication
@ -320,8 +321,8 @@ if(WITH_WINDOWLESSGLXAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum WindowlessGlxApplication library for superprojects
set(MAGNUM_WINDOWLESSGLXAPPLICATION_LIBRARY MagnumWindowlessGlxApplication CACHE INTERNAL "")
# Magnum WindowlessGlxApplication target alias for superprojects
add_library(Magnum::WindowlessGlxApplication ALIAS MagnumWindowlessGlxApplication)
endif()
# Windowless WGL application
@ -336,10 +337,8 @@ if(WITH_WINDOWLESSWGLAPPLICATION)
add_library(MagnumWindowlessWglApplication STATIC
${MagnumWindowlessWglApplication_SRCS}
${MagnumWindowlessWglApplication_HEADERS})
set_target_properties(MagnumWindowlessWglApplication PROPERTIES
COMPILE_FLAGS "-DUNICODE"
DEBUG_POSTFIX "-d")
target_link_libraries(MagnumWindowlessWglApplication Magnum)
set_target_properties(MagnumWindowlessWglApplication PROPERTIES DEBUG_POSTFIX "-d")
target_compile_definitions(MagnumWindowlessWglApplication PRIVATE "UNICODE")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumWindowlessWglApplication Magnum)
@ -350,8 +349,8 @@ if(WITH_WINDOWLESSWGLAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum WindowlessWglApplication library for superprojects
set(MAGNUM_WINDOWLESSWGLAPPLICATION_LIBRARY MagnumWindowlessWglApplication CACHE INTERNAL "")
# Magnum WindowlessWglApplication target alias for superprojects
add_library(Magnum::WindowlessWglApplication ALIAS MagnumWindowlessWglApplication)
endif()
# Windowless Windows/EGL application
@ -371,13 +370,11 @@ if(WITH_WINDOWLESSWINDOWSEGLAPPLICATION)
${MagnumWindowlessWindowsEglApplication_SRCS}
${MagnumWindowlessWindowsEglApplication_HEADERS}
${MagnumWindowlessWindowsEglApplication_PRIVATE_HEADERS})
set_target_properties(MagnumWindowlessWindowsEglApplication PROPERTIES
COMPILE_FLAGS "-DUNICODE"
DEBUG_POSTFIX "-d")
target_link_libraries(MagnumWindowlessWindowsEglApplication Magnum ${EGL_LIBRARY})
set_target_properties(MagnumWindowlessWindowsEglApplication PROPERTIES DEBUG_POSTFIX "-d")
target_compile_definitions(MagnumWindowlessWindowsEglApplication PRIVATE "UNICODE")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumWindowlessWindowsEglApplication Magnum)
target_link_libraries(MagnumWindowlessWindowsEglApplication Magnum EGL::EGL)
install(FILES ${MagnumWindowlessWindowsEglApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumWindowlessWindowsEglApplication
@ -385,8 +382,8 @@ if(WITH_WINDOWLESSWINDOWSEGLAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum WindowlessWindowsEglApplication library for superprojects
set(MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_LIBRARY MagnumWindowlessWindowsEglApplication CACHE INTERNAL "")
# Magnum WindowlessWindowsEglApplication target alias for superprojects
add_library(Magnum::WindowlessWindowsEglApplication ALIAS MagnumWindowlessWindowsEglApplication)
endif()
# Windowless CGL application
@ -402,7 +399,6 @@ if(WITH_WINDOWLESSCGLAPPLICATION)
${MagnumWindowlessCglApplication_SRCS}
${MagnumWindowlessCglApplication_HEADERS})
set_target_properties(MagnumWindowlessCglApplication PROPERTIES DEBUG_POSTFIX "-d")
target_link_libraries(MagnumWindowlessCglApplication Magnum)
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
target_link_libraries(MagnumWindowlessCglApplication Magnum)
@ -414,7 +410,7 @@ if(WITH_WINDOWLESSCGLAPPLICATION)
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum WindowlessCglApplication library for superprojects
set(MAGNUM_WINDOWLESSCGLAPPLICATION_LIBRARY MagnumWindowlessCglApplication CACHE INTERNAL "")
add_library(Magnum::WindowlessCglApplication ALIAS MagnumWindowlessCglApplication)
endif()
# Abstract X application
@ -425,8 +421,9 @@ if(NEED_ABSTRACTXAPPLICATION)
add_library(MagnumAbstractXApplication OBJECT
${MagnumAbstractXApplication_SRCS}
${MagnumAbstractXApplication_HEADERS})
target_include_directories(MagnumAbstractXApplication PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties(MagnumAbstractXApplication PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast")
target_compile_options(MagnumAbstractXApplication PRIVATE "-Wno-old-style-cast")
# Assuming that PIC is not needed because the Application lib is always
# linked to the executable and not to any intermediate shared lib
@ -444,8 +441,9 @@ if(NEED_GLXCONTEXTHANDLER)
add_library(MagnumGlxContextHandler OBJECT
${MagnumGlxContextHandler_SRCS}
${MagnumGlxContextHandler_PRIVATE_HEADERS})
target_include_directories(MagnumGlxContextHandler PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties(MagnumGlxContextHandler PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast")
target_compile_options(MagnumGlxContextHandler PRIVATE "-Wno-old-style-cast")
# Assuming that PIC is not needed because this is part of Application lib,
# which is always linked to the executable and not to any intermediate
# shared lib
@ -458,8 +456,6 @@ if(NEED_EGLCONTEXTHANDLER)
message(FATAL_ERROR "EGL library, required by some contexts, was not found. Set WITH_*EGL*APPLICATION to OFF to skip building them.")
endif()
include_directories(${EGL_INCLUDE_DIR})
set(MagnumEglContextHandler_SRCS
Implementation/EglContextHandler.cpp
Implementation/Egl.cpp)
@ -471,8 +467,11 @@ if(NEED_EGLCONTEXTHANDLER)
add_library(MagnumEglContextHandler OBJECT
${MagnumEglContextHandler_SRCS}
${MagnumEglContextHandler_PRIVATE_HEADERS})
target_include_directories(MagnumEglContextHandler PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:EGL::EGL,INTERFACE_INCLUDE_DIRECTORIES>)
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties(MagnumEglContextHandler PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast")
target_compile_options(MagnumEglContextHandler PRIVATE "-Wno-old-style-cast")
# Assuming that PIC is not needed because this is part of Application lib,
# which is always linked to the executable and not to any intermediate
# shared lib
@ -502,6 +501,7 @@ endif()
# CGL context
if(NEED_CGLCONTEXT OR WITH_CGLCONTEXT)
add_library(MagnumCglContextObjects OBJECT ${MagnumContext_SRCS})
target_include_directories(MagnumCglContextObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(BUILD_STATIC_PIC)
set_target_properties(MagnumCglContextObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -523,8 +523,8 @@ if(NEED_CGLCONTEXT OR WITH_CGLCONTEXT)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum CglContext library for superprojects
set(MAGNUM_CGLCONTEXT_LIBRARY MagnumCglContext CACHE INTERNAL "")
# Magnum CglContext target alias for superprojects
add_library(Magnum::CglContext ALIAS MagnumCglContext)
endif()
endif()
@ -535,10 +535,11 @@ if(NEED_EGLCONTEXT OR WITH_EGLCONTEXT)
message(FATAL_ERROR "EGL library, required by some contexts, was not found. Set WITH_*APPLICATION and/or WITH_EGLCONTEXT to OFF to skip building them.")
endif()
include_directories(${EGL_INCLUDE_DIR})
add_library(MagnumEglContextObjects OBJECT ${MagnumContext_SRCS})
set_target_properties(MagnumEglContextObjects PROPERTIES COMPILE_DEFINITIONS "MAGNUM_PLATFORM_USE_EGL")
target_include_directories(MagnumEglContextObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:EGL::EGL,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(MagnumEglContextObjects PRIVATE "MAGNUM_PLATFORM_USE_EGL")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumEglContextObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -550,22 +551,25 @@ if(NEED_EGLCONTEXT OR WITH_EGLCONTEXT)
if(BUILD_STATIC_PIC)
set_target_properties(MagnumEglContext PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumEglContext Magnum)
target_link_libraries(MagnumEglContext Magnum EGL::EGL)
install(TARGETS MagnumEglContext
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum EglContext library for superprojects
set(MAGNUM_EGLCONTEXT_LIBRARY MagnumEglContext CACHE INTERNAL "")
# Magnum EglContext target alias for superprojects
add_library(Magnum::EglContext ALIAS MagnumEglContext)
endif()
endif()
# GLX context
if(NEED_GLXCONTEXT OR WITH_GLXCONTEXT)
add_library(MagnumGlxContextObjects OBJECT ${MagnumContext_SRCS})
set_target_properties(MagnumGlxContextObjects PROPERTIES COMPILE_DEFINITIONS "MAGNUM_PLATFORM_USE_GLX")
target_include_directories(MagnumGlxContextObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
${X11_INCLUDE_DIR})
target_compile_definitions(MagnumGlxContextObjects PRIVATE "MAGNUM_PLATFORM_USE_GLX")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumGlxContextObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -577,21 +581,23 @@ if(NEED_GLXCONTEXT OR WITH_GLXCONTEXT)
if(BUILD_STATIC_PIC)
set_target_properties(MagnumGlxContext PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumGlxContext Magnum)
target_include_directories(MagnumGlxContext PUBLIC ${X11_INCLUDE_DIR})
target_link_libraries(MagnumGlxContext Magnum ${X11_LIBRARIES})
install(TARGETS MagnumGlxContext
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum GlxContext library for superprojects
set(MAGNUM_GLXCONTEXT_LIBRARY MagnumGlxContext CACHE INTERNAL "")
# Magnum GlxContext target alias for superprojects
add_library(Magnum::GlxContext ALIAS MagnumGlxContext)
endif()
endif()
# WGL context
if(NEED_WGLCONTEXT OR WITH_WGLCONTEXT)
add_library(MagnumWglContextObjects OBJECT ${MagnumContext_SRCS})
target_include_directories(MagnumWglContextObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(BUILD_STATIC_PIC)
set_target_properties(MagnumWglContextObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -610,14 +616,15 @@ if(NEED_WGLCONTEXT OR WITH_WGLCONTEXT)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Magnum WglContext library for superprojects
set(MAGNUM_WGLCONTEXT_LIBRARY MagnumWglContext CACHE INTERNAL "")
# Magnum WglContext target alias for superprojects
add_library(Magnum::WglContext ALIAS MagnumWglContext)
endif()
endif()
# Magnum Info
if(WITH_MAGNUMINFO)
add_executable(magnum-info magnum-info.cpp)
target_link_libraries(magnum-info Magnum)
if(CORRADE_TARGET_APPLE)
target_link_libraries(magnum-info MagnumWindowlessCglApplication)
elseif(CORRADE_TARGET_NACL)
@ -633,7 +640,6 @@ if(WITH_MAGNUMINFO)
else()
message(FATAL_ERROR "magnum-info is not available on this platform. Set WITH_MAGNUMINFO to OFF to skip building it.")
endif()
target_link_libraries(magnum-info Magnum)
install(TARGETS magnum-info DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})
if(CORRADE_TARGET_NACL)
@ -641,6 +647,9 @@ if(WITH_MAGNUMINFO)
install(FILES magnum-info-nacl.nmf DESTINATION ${MAGNUM_DATA_INSTALL_DIR} RENAME magnum-info.nmf)
list(APPEND MagnumPlatform_FILES magnum-info-nacl.html magnum-info-nacl.nmf)
endif()
# Magnum info target alias for superprojects
add_executable(Magnum::info ALIAS magnum-info)
endif()
# Force IDEs display also all header files and additional files in project view

10
src/Magnum/Platform/GlutApplication.h

@ -71,12 +71,10 @@ See @ref cmake for more information.
## General usage
In CMake you need to request `GlutApplication` component, add
`${MAGNUM_GLUTAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_GLUTAPPLICATION_LIBRARIES}`. If no other application is requested,
you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_APPLICATION_LIBRARIES}` aliases to simplify porting. Again, see
@ref building and @ref cmake for more information.
In CMake you need to request `GlutApplication` component of `Magnum` package
and link to `Magnum::GlutApplication` target. If no other application is
requested, you can also use generic `Magnum::Application` alias to simplify
porting. Again, see @ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw
on the screen. The subclass can be then used directly in `main()` -- see

8
src/Magnum/Platform/GlxApplication.h

@ -52,11 +52,9 @@ more information.
## General usage
In CMake you need to request `GlxApplication` component, add
`${MAGNUM_GLXAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_GLXAPPLICATION_LIBRARIES}`. If no other application is requested, you
can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_APPLICATION_LIBRARIES}` aliases to simplify porting. See
In CMake you need to request `GlxApplication` component of `Magnum` package and
link to `Magnum::GlxApplication` target. If no other application is requested,
you can also use generic `Magnum::Application` alias to simplify porting. See
@ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw

8
src/Magnum/Platform/NaClApplication.h

@ -119,11 +119,9 @@ You can then open `MyApplication` through your webserver in Chrome (e.g.
For CMake you need to copy `FindOpenGLES2.cmake` from `modules/` directory in
Magnum source to `modules/` dir in your project (so it is able to find OpenGL
ES). Request `NaClApplication` component, add
`${MAGNUM_NACLAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_NACLAPPLICATION_LIBRARIES}`. If no other application is requested,
you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_APPLICATION_LIBRARIES}` aliases to simplify porting. Again, see
ES). Request `NaClApplication` component of `Magnum` package and link to
`Magnum::NaClApplication` target. If no other application is requested, you can
also use generic `Magnum::Application` alias to simplify porting. Again, see
@ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw

7
src/Magnum/Platform/Sdl2Application.h

@ -169,10 +169,9 @@ final package along with a PowerShell script for easy local installation.
For CMake you need to copy `FindSDL2.cmake` from `modules/` directory in
Magnum source to `modules/` dir in your project (so it is able to find SDL2).
In case of Emscripten you need also `FindOpenGLES2.cmake`. Request
`Sdl2Application` component, add `${MAGNUM_SDL2APPLICATION_INCLUDE_DIRS}`
to include path and link to `${MAGNUM_SDL2APPLICATION_LIBRARIES}`. If no other
application is requested, you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}`
and `${MAGNUM_APPLICATION_LIBRARIES}` aliases to simplify porting. Again, see
`Sdl2Application` component of `Magnum` package and link to
`Magnum::Sdl2Application` target. If no other application is requested, you can
also use generic `Magnum::Application` alias to simplify porting. Again, see
@ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw on the

12
src/Magnum/Platform/WindowlessGlxApplication.h

@ -76,13 +76,11 @@ See @ref cmake for more information.
## General usage
In CMake you need to request `WindowlessGlxApplication` component, add
`${MAGNUM_WINDOWLESSGLXAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_WINDOWLESSGLXAPPLICATION_LIBRARIES}`. If no other windowless
application is requested, you can also use generic
`${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` aliases to simplify porting. Again,
see @ref building and @ref cmake for more information.
In CMake you need to request `WindowlessGlxApplication` component of `Magnum`
package and link to `Magnum::WindowlessGlxApplication` target. If no other
windowless application is requested, you can also use generic
`Magnum::WindowlessApplication` alias to simplify porting. Again, see
@ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used directly in
`main()` -- see convenience macro @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN().

12
src/Magnum/Platform/WindowlessWglApplication.h

@ -77,13 +77,11 @@ See @ref cmake for more information.
## General usage
In CMake you need to request `WindowlessWglApplication` component, add
`${MAGNUM_WINDOWLESSWGLAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_WINDOWLESSWGLAPPLICATION_LIBRARIES}`. If no other windowless
application is requested, you can also use generic
`${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` aliases to simplify porting. Again,
see @ref building and @ref cmake for more information.
In CMake you need to request `WindowlessWglApplication` component of `Magnum`
package and link to `Magnum::WindowlessWglApplication` target. If no other
windowless application is requested, you can also use generic
`Magnum::WindowlessApplication` alias to simplify porting. Again, see
@ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used in main
function using @ref MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN() macro. See

12
src/Magnum/Platform/WindowlessWindowsEglApplication.h

@ -72,13 +72,11 @@ See @ref cmake for more information.
## General usage
In CMake you need to request `WindowlessWindowsEglApplication` component, add
`${MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_INCLUDE_DIRS}` to include path and
link to `${MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_LIBRARIES}`. If no other
windowless application is requested, you can also use generic
`${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` aliases to simplify porting. Again,
see @ref building and @ref cmake for more information.
In CMake you need to request `WindowlessWindowsEglApplication` component of
`Magnum` package and link to `Magnum::WindowlessWindowsEglApplication` target.
If no other windowless application is requested, you can also use generic
`Magnum::WindowlessApplication` alias to simplify porting. Again, see
@ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used in main
function using @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() macro. See

7
src/Magnum/Platform/XEglApplication.h

@ -53,10 +53,9 @@ more information.
For CMake you need to copy `FindEGL.cmake` from `modules/` directory in Magnum
source to `modules/` dir in your project (so it is able to find EGL), request
`XEglApplication` component, add `${MAGNUM_XEGLAPPLICATION_INCLUDE_DIRS}` to
include path and link to `${MAGNUM_XEGLAPPLICATION_LIBRARIES}`. If no other
application is requested, you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}`
and `${MAGNUM_APPLICATION_LIBRARIES}` aliases to simplify porting. See
`XEglApplication` component of `Magnum` package and link to
`Magnum::XEglApplication` target. If no other application is requested, you
can also use generic `Magnum::Application` alias to simplify porting. See
@ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw

5
src/Magnum/Primitives/CMakeLists.txt

@ -66,7 +66,6 @@ set_target_properties(MagnumPrimitives PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumPrimitives PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumPrimitives Magnum)
install(TARGETS MagnumPrimitives
@ -79,5 +78,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum Primitives library for superprojects
set(MAGNUM_PRIMITIVES_LIBRARY MagnumPrimitives CACHE INTERNAL "")
# Magnum Primitives target alias for superprojects
add_library(Magnum::Primitives ALIAS MagnumPrimitives)

14
src/Magnum/SceneGraph/CMakeLists.txt

@ -79,8 +79,9 @@ endif()
add_library(MagnumSceneGraphObjects OBJECT
${MagnumSceneGraph_SRCS}
${MagnumSceneGraph_HEADERS})
target_include_directories(MagnumSceneGraphObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_STATIC)
set_target_properties(MagnumSceneGraphObjects PROPERTIES COMPILE_FLAGS "-DMagnumSceneGraphObjects_EXPORTS")
target_compile_definitions(MagnumSceneGraphObjects PRIVATE "MagnumSceneGraphObjects_EXPORTS")
endif()
if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumSceneGraphObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
@ -94,7 +95,6 @@ set_target_properties(MagnumSceneGraph PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumSceneGraph PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumSceneGraph Magnum)
install(TARGETS MagnumSceneGraph
@ -108,9 +108,9 @@ if(BUILD_TESTS)
add_library(MagnumSceneGraphTestLib ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumSceneGraphObjects>
${MagnumSceneGraph_GracefulAssert_SRCS})
set_target_properties(MagnumSceneGraphTestLib PROPERTIES
COMPILE_FLAGS "-DCORRADE_GRACEFUL_ASSERT -DMagnumSceneGraph_EXPORTS"
DEBUG_POSTFIX "-d")
set_target_properties(MagnumSceneGraphTestLib PROPERTIES DEBUG_POSTFIX "-d")
target_compile_definitions(MagnumSceneGraphTestLib PRIVATE
"CORRADE_GRACEFUL_ASSERT" "MagnumSceneGraph_EXPORTS")
target_link_libraries(MagnumSceneGraphTestLib MagnumMathTestLib)
# On Windows we need to install first and then run the tests to avoid "DLL
@ -125,5 +125,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum SceneGraph library for superprojects
set(MAGNUM_SCENEGRAPH_LIBRARY MagnumSceneGraph CACHE INTERNAL "")
# Magnum SceneGraph target alias for superprojects
add_library(Magnum::SceneGraph ALIAS MagnumSceneGraph)

5
src/Magnum/SceneGraph/Test/CMakeLists.txt

@ -35,9 +35,10 @@ corrade_add_test(SceneGraphRigidMatrixTrans___3DTest RigidMatrixTransformation3D
corrade_add_test(SceneGraphSceneTest SceneTest.cpp LIBRARIES MagnumSceneGraph)
corrade_add_test(SceneGraphTranslationTransfo___Test TranslationTransformationTest.cpp LIBRARIES MagnumSceneGraph)
set_target_properties(SceneGraphDualComplexTransfo___Test
set_property(TARGET
SceneGraphDualComplexTransfo___Test
SceneGraphDualQuaternionTran___Test
SceneGraphRigidMatrixTrans___2DTest
SceneGraphRigidMatrixTrans___3DTest
SceneGraphTranslationTransfo___Test
PROPERTIES COMPILE_FLAGS "-DCORRADE_GRACEFUL_ASSERT")
PROPERTY COMPILE_DEFINITIONS "CORRADE_GRACEFUL_ASSERT")

3
src/Magnum/Shaders/CMakeLists.txt

@ -61,7 +61,6 @@ set_target_properties(MagnumShaders PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumShaders PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumShaders Magnum)
install(TARGETS MagnumShaders
@ -75,4 +74,4 @@ if(BUILD_TESTS)
endif()
# Magnum Shaders library for superprojects
set(MAGNUM_SHADERS_LIBRARY MagnumShaders CACHE INTERNAL "")
add_library(Magnum::Shaders ALIAS MagnumShaders)

5
src/Magnum/Shapes/CMakeLists.txt

@ -73,7 +73,6 @@ set_target_properties(MagnumShapes PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumShapes PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumShapes Magnum MagnumSceneGraph)
install(TARGETS MagnumShapes
@ -86,5 +85,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum Shapes library for superprojects
set(MAGNUM_SHAPES_LIBRARY MagnumShapes CACHE INTERNAL "")
# Magnum Shapes target alias for superprojects
add_library(Magnum::Shapes ALIAS MagnumShapes)

11
src/Magnum/Test/CMakeLists.txt

@ -24,7 +24,7 @@
#
corrade_add_test(AbstractShaderProgramTest AbstractShaderProgramTest.cpp LIBRARIES Magnum)
corrade_add_test(ArrayTest ArrayTest.cpp)
corrade_add_test(ArrayTest ArrayTest.cpp LIBRARIES Magnum)
corrade_add_test(FormatTest FormatTest.cpp LIBRARIES Magnum)
corrade_add_test(ContextTest ContextTest.cpp LIBRARIES Magnum)
corrade_add_test(DebugOutputTest DebugOutputTest.cpp LIBRARIES Magnum)
@ -36,15 +36,16 @@ corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum)
corrade_add_test(PixelStorageTest PixelStorageTest.cpp LIBRARIES Magnum)
corrade_add_test(RendererTest RendererTest.cpp LIBRARIES Magnum)
corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES Magnum)
target_compile_definitions(ResourceManagerTest PRIVATE "CORRADE_GRACEFUL_ASSERT")
corrade_add_test(SamplerTest SamplerTest.cpp LIBRARIES Magnum)
corrade_add_test(ShaderTest ShaderTest.cpp LIBRARIES Magnum)
corrade_add_test(VersionTest VersionTest.cpp LIBRARIES Magnum)
corrade_add_test(TagsTest TagsTest.cpp)
corrade_add_test(TagsTest TagsTest.cpp LIBRARIES Magnum)
add_library(ResourceManagerLocalInstanceTestLib ${SHARED_OR_STATIC} ResourceManagerLocalInstanceTestLib.cpp)
target_link_libraries(ResourceManagerLocalInstanceTestLib Magnum)
if(NOT BUILD_STATIC)
set_target_properties(ResourceManagerLocalInstanceTestLib PROPERTIES COMPILE_FLAGS "-DResourceManagerLocalInstanceTestLib_EXPORTS")
target_compile_definitions(ResourceManagerLocalInstanceTestLib PRIVATE "ResourceManagerLocalInstanceTestLib_EXPORTS")
endif()
corrade_add_test(ResourceManagerLocalInstanceTest ResourceManagerLocalInstanceTest.cpp LIBRARIES Magnum ResourceManagerLocalInstanceTestLib)
@ -72,8 +73,8 @@ if(BUILD_GL_TESTS)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES})
target_include_directories(ShaderGLTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if(NOT MAGNUM_TARGET_GLES2)
corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES})
@ -89,5 +90,3 @@ if(BUILD_GL_TESTS)
corrade_add_test(RectangleTextureGLTest RectangleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES})
endif()
endif()
set_target_properties(ResourceManagerTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)

19
src/Magnum/Text/CMakeLists.txt

@ -48,7 +48,6 @@ set_target_properties(MagnumText PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumText PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumText Magnum MagnumTextureTools)
install(TARGETS MagnumText
@ -61,26 +60,28 @@ if(WITH_FONTCONVERTER)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fontconverterConfigure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/fontconverterConfigure.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(magnum-fontconverter fontconverter.cpp)
target_include_directories(magnum-fontconverter PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(magnum-fontconverter Magnum MagnumText)
if(CORRADE_TARGET_APPLE)
target_link_libraries(magnum-fontconverter MagnumText MagnumWindowlessCglApplication)
target_link_libraries(magnum-fontconverter MagnumWindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX AND NOT TARGET_GLES)
target_link_libraries(magnum-fontconverter MagnumText MagnumWindowlessGlxApplication)
target_link_libraries(magnum-fontconverter MagnumWindowlessGlxApplication)
elseif(CORRADE_TARGET_WINDOWS AND NOT TARGET_GLES)
target_link_libraries(magnum-fontconverter MagnumText MagnumWindowlessWglApplication)
target_link_libraries(magnum-fontconverter MagnumWindowlessWglApplication)
else()
message(FATAL_ERROR "magnum-fontconverter is not available on this platform. Set WITH_FONTCONVERTER to OFF to suppress this warning.")
endif()
install(TARGETS magnum-fontconverter DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})
# Magnum fontconverter target alias for superprojects
add_executable(Magnum::fontconverter ALIAS magnum-fontconverter)
endif()
if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum Text library for superprojects
set(MAGNUM_TEXT_LIBRARY MagnumText CACHE INTERNAL "")
# Magnum Text target alias for superprojects
add_library(Magnum::Text ALIAS MagnumText)

4
src/Magnum/Text/Test/CMakeLists.txt

@ -26,10 +26,10 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TextAbstractFontTest AbstractFontTest.cpp LIBRARIES Magnum MagnumText)
target_include_directories(TextAbstractFontTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TextAbstractFontConverterTest AbstractFontConverterTest.cpp LIBRARIES Magnum MagnumText)
target_include_directories(TextAbstractFontConverterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TextAbstractLayouterTest AbstractLayouterTest.cpp LIBRARIES Magnum MagnumText)
if(BUILD_GL_TESTS)

19
src/Magnum/TextureTools/CMakeLists.txt

@ -44,28 +44,29 @@ set_target_properties(MagnumTextureTools PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumTextureTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumTextureTools Magnum)
if(WITH_DISTANCEFIELDCONVERTER)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/distancefieldconverterConfigure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/distancefieldconverterConfigure.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(magnum-distancefieldconverter distancefieldconverter.cpp)
target_include_directories(magnum-distancefieldconverter PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(magnum-distancefieldconverter Magnum MagnumTextureTools)
if(CORRADE_TARGET_APPLE)
target_link_libraries(magnum-distancefieldconverter MagnumTextureTools MagnumWindowlessCglApplication)
target_link_libraries(magnum-distancefieldconverter MagnumWindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX AND NOT TARGET_GLES)
target_link_libraries(magnum-distancefieldconverter MagnumTextureTools Magnum MagnumWindowlessGlxApplication)
target_link_libraries(magnum-distancefieldconverter MagnumWindowlessGlxApplication)
elseif(CORRADE_TARGET_WINDOWS AND NOT TARGET_GLES)
target_link_libraries(magnum-distancefieldconverter MagnumTextureTools MagnumWindowlessWglApplication)
target_link_libraries(magnum-distancefieldconverter MagnumWindowlessWglApplication)
else()
message(FATAL_ERROR "magnum-distancefieldconverter is not available on this platform. Set WITH_DISTANCEFIELDCONVERTER to OFF to suppress this warning.")
endif()
install(TARGETS magnum-distancefieldconverter DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})
# Magnum distancefieldconverter target alias for superprojects
add_executable(Magnum::distancefieldconverter ALIAS magnum-distancefieldconverter)
endif()
install(TARGETS MagnumTextureTools
@ -78,5 +79,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum TextureTools library for superprojects
set(MAGNUM_TEXTURETOOLS_LIBRARY MagnumTextureTools CACHE INTERNAL "")
# Magnum TextureTools target alias for superprojects
add_library(Magnum::TextureTools ALIAS MagnumTextureTools)

4
src/Magnum/Trade/Test/CMakeLists.txt

@ -26,10 +26,10 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TradeAbstractImageConverterTest AbstractImageConverterTest.cpp LIBRARIES Magnum)
target_include_directories(TradeAbstractImageConverterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TradeAbstractImporterTest AbstractImporterTest.cpp LIBRARIES Magnum)
target_include_directories(TradeAbstractImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TradeAbstractMaterialDataTest AbstractMaterialDataTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeImageDataTest ImageDataTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeObjectData2DTest ObjectData2DTest.cpp LIBRARIES Magnum)

7
src/MagnumExternal/OpenGL/GL/CMakeLists.txt vendored

@ -25,11 +25,10 @@
# flextGLPlatform.cpp is compiled as part of Magnum*Context libraries in Platform
add_library(MagnumFlextGLObjects OBJECT flextGL.cpp)
target_include_directories(MagnumFlextGLObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -DFlextGL_EXPORTS")
else()
set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-DFlextGL_EXPORTS")
if(NOT BUILD_STATIC)
target_compile_definitions(MagnumFlextGLObjects PRIVATE "FlextGL_EXPORTS")
endif()
if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFlextGLObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)

7
src/MagnumExternal/OpenGL/GLES2/CMakeLists.txt vendored

@ -27,11 +27,10 @@
if(NOT CORRADE_TARGET_NACL AND NOT CORRADE_TARGET_EMSCRIPTEN)
# flextGLPlatform.cpp is compiled as part of Magnum*Context libraries in Platform
add_library(MagnumFlextGLObjects OBJECT flextGL.cpp)
target_include_directories(MagnumFlextGLObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -DFlextGL_EXPORTS")
else()
set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-DFlextGL_EXPORTS")
if(NOT BUILD_STATIC)
target_compile_definitions(MagnumFlextGLObjects PRIVATE "FlextGL_EXPORTS")
endif()
if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFlextGLObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)

7
src/MagnumExternal/OpenGL/GLES3/CMakeLists.txt vendored

@ -25,11 +25,10 @@
# flextGLPlatform.cpp is compiled as part of Magnum*Context libraries in Platform
add_library(MagnumFlextGLObjects OBJECT flextGL.cpp)
target_include_directories(MagnumFlextGLObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -DFlextGL_EXPORTS")
else()
set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-DFlextGL_EXPORTS")
if(NOT BUILD_STATIC)
target_compile_definitions(MagnumFlextGLObjects PRIVATE "FlextGL_EXPORTS")
endif()
if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFlextGLObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)

7
src/MagnumPlugins/MagnumFont/CMakeLists.txt

@ -33,6 +33,7 @@ set(MagnumFont_HEADERS
add_library(MagnumFontObjects OBJECT
${MagnumFont_SRCS}
${MagnumFont_HEADERS})
target_include_directories(MagnumFontObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFontObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -62,7 +63,7 @@ if(BUILD_GL_TESTS)
add_library(MagnumMagnumFontTestLib STATIC
${MagnumFont_SRCS}
${MagnumFont_HEADERS})
set_target_properties(MagnumMagnumFontTestLib PROPERTIES COMPILE_FLAGS "-DMAGNUM_TGAIMPORTER_BUILD_STATIC")
target_compile_definitions(MagnumMagnumFontTestLib PRIVATE "MAGNUM_TGAIMPORTER_BUILD_STATIC")
else()
add_library(MagnumMagnumFontTestLib STATIC $<TARGET_OBJECTS:MagnumFontObjects>)
endif()
@ -71,5 +72,5 @@ if(BUILD_GL_TESTS)
add_subdirectory(Test)
endif()
# Magnum MagnumFont library for superprojects
set(MAGNUM_MAGNUMFONT_LIBRARY MagnumFont CACHE INTERNAL "")
# Magnum MagnumFont target alias for superprojects
add_library(Magnum::MagnumFont ALIAS MagnumFont)

4
src/MagnumPlugins/MagnumFont/MagnumFont.h

@ -42,8 +42,8 @@ built if `WITH_MAGNUMFONT` is enabled when building Magnum. To use dynamic
plugin, you need to load `MagnumFont` plugin from `MAGNUM_PLUGINS_FONT_DIR`.
To use static plugin or use this as a dependency of another plugin, you need to
request `MagnumFont` component of `Magnum` package in CMake and link to
`${MAGNUM_MAGNUMFONT_LIBRARIES}`. See @ref building, @ref cmake and
@ref plugins for more information.
`Magnum::MagnumFont` target. See @ref building, @ref cmake and @ref plugins for
more information.
The font consists of two files, one text file containing character and glyph
info and one TGA file containing the glyphs in distance field format. The font

3
src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt

@ -26,6 +26,5 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(MagnumFontGLTest MagnumFontGLTest.cpp LIBRARIES MagnumMagnumFontTestLib ${GL_TEST_LIBRARIES})
target_include_directories(MagnumFontGLTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

7
src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt

@ -33,6 +33,7 @@ set(MagnumFontConverter_HEADERS
add_library(MagnumFontConverterObjects OBJECT
${MagnumFontConverter_SRCS}
${MagnumFontConverter_HEADERS})
target_include_directories(MagnumFontConverterObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFontConverterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -62,7 +63,7 @@ if(BUILD_GL_TESTS)
add_library(MagnumMagnumFontConverterTestLib STATIC
${MagnumFontConverter_SRCS}
${MagnumFontConverter_HEADERS})
set_target_properties(MagnumMagnumFontConverterTestLib PROPERTIES COMPILE_FLAGS "-DMAGNUM_TGAIMAGECONVERTER_BUILD_STATIC")
target_compile_definitions(MagnumMagnumFontConverterTestLib PRIVATE "MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC")
else()
add_library(MagnumMagnumFontConverterTestLib STATIC $<TARGET_OBJECTS:MagnumFontConverterObjects>)
endif()
@ -71,5 +72,5 @@ if(BUILD_GL_TESTS)
add_subdirectory(Test)
endif()
# Magnum MagnumFontConverter library for superprojects
set(MAGNUM_MAGNUMFONTCONVERTER_LIBRARY MagnumFontConverter CACHE INTERNAL "")
# Magnum MagnumFontConverter target alias for superprojects
add_library(Magnum::MagnumFontConverter ALIAS MagnumFontConverter)

5
src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h

@ -46,9 +46,8 @@ to read back the generated data. It depends on
plugin, you need to load `MagnumFontConverter` plugin from
`MAGNUM_PLUGINS_FONTCONVERTER_DIR`. To use static plugin or use this as a
dependency of another plugin, you need to request `MagnumFontConverter`
component of `Magnum` package in CMake and link to
`${MAGNUM_MAGNUMFONTCONVERTER_LIBRARIES}`. See @ref building, @ref cmake and
@ref plugins for more information.
component of `Magnum` package in CMake and link to `Magnum::MagnumFontConverter`
target. See @ref building, @ref cmake and @ref plugins for more information.
*/
class MagnumFontConverter: public Text::AbstractFontConverter {
public:

5
src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt

@ -26,17 +26,16 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(MagnumFontConverterGLTest MagnumFontConverterGLTest.cpp LIBRARIES
MagnumMagnumFontConverterTestLib
MagnumTgaImporterTestLib
${GL_TEST_LIBRARIES})
target_include_directories(MagnumFontConverterGLTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# On Win32 we need to avoid dllimporting TgaImporter symbols, because it would
# search for the symbols in some DLL even though they were linked statically.
# However it apparently doesn't matter that they were dllexported when building
# the static library. EH.
if(WIN32)
set_target_properties(MagnumFontConverterGLTest PROPERTIES COMPILE_FLAGS "-DMAGNUM_TGAIMPORTER_BUILD_STATIC")
target_compile_definitions(MagnumFontConverterGLTest PRIVATE "MAGNUM_TGAIMPORTER_BUILD_STATIC")
endif()

4
src/MagnumPlugins/ObjImporter/CMakeLists.txt

@ -33,6 +33,7 @@ set(ObjImporter_HEADERS
add_library(ObjImporterObjects OBJECT
${ObjImporter_SRCS}
${ObjImporter_HEADERS})
target_include_directories(ObjImporterObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(ObjImporterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -45,7 +46,6 @@ add_plugin(ObjImporter ${MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR} ${MAGNUM_PLU
if(BUILD_STATIC_PIC)
set_target_properties(ObjImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(ObjImporter Magnum MagnumMeshTools)
install(FILES ${ObjImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/ObjImporter)
@ -57,4 +57,4 @@ if(BUILD_TESTS)
endif()
# Magnum ObjImporter library for superprojects
set(MAGNUM_OBJIMPORTER_LIBRARY ObjImporter CACHE INTERNAL "")
add_library(Magnum:::ObjImporter ALIAS ObjImporter)

4
src/MagnumPlugins/ObjImporter/ObjImporter.h

@ -48,8 +48,8 @@ This plugin is built if `WITH_OBJIMPORTER` is enabled when building Magnum. To
use dynamic plugin, you need to load `ObjImporter` plugin from
`MAGNUM_PLUGINS_IMPORTER_DIR`. To use static plugin or use this as a dependency
of another plugin, you need to request `ObjImporter` component of `Magnum`
package in CMake and link to `${MAGNUM_OBJIMPORTER_LIBRARIES}`. See
@ref building, @ref cmake and @ref plugins for more information.
package in CMake and link to `Magnum::ObjImporter` target. See @ref building,
@ref cmake and @ref plugins for more information.
*/
class ObjImporter: public AbstractImporter {
public:

3
src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt

@ -26,6 +26,5 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(ObjImporterTest Test.cpp LIBRARIES MagnumObjImporterTestLib)
target_include_directories(ObjImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

8
src/MagnumPlugins/TgaImageConverter/CMakeLists.txt

@ -40,8 +40,9 @@ set(TgaImageConverter_HEADERS
add_library(TgaImageConverterObjects OBJECT
${TgaImageConverter_SRCS}
${TgaImageConverter_HEADERS})
target_include_directories(TgaImageConverterObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC)
set_target_properties(TgaImageConverterObjects PROPERTIES COMPILE_FLAGS "-DTgaImageConverterObjects_EXPORTS")
target_compile_definitions(TgaImageConverterObjects PRIVATE "TgaImageConverterObjects_EXPORTS")
endif()
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(TgaImageConverterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
@ -55,7 +56,6 @@ add_plugin(TgaImageConverter ${MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_INSTALL_DIR}
if(BUILD_STATIC_PIC)
set_target_properties(TgaImageConverter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(TgaImageConverter Magnum)
install(FILES ${TgaImageConverter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter)
@ -68,5 +68,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum TgaImageConverter library for superprojects
set(MAGNUM_TGAIMAGECONVERTER_LIBRARY TgaImageConverter CACHE INTERNAL "")
# Magnum TgaImageConverter target alias for superprojects
add_library(Magnum::TgaImageConverter ALIAS TgaImageConverter)

8
src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt

@ -26,14 +26,14 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TgaImageConverterTest TgaImageConverterTest.cpp LIBRARIES MagnumTgaImageConverterTestLib MagnumTgaImporterTestLib)
target_include_directories(TgaImageConverterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# On Win32 we need to avoid dllimporting TgaImporter and TgaImageConverterTest
# symbols, because it would search for the symbols in some DLL even though they
# were linked statically. However it apparently doesn't matter that they were
# dllexported when building the static library. EH.
if(WIN32)
set_target_properties(TgaImageConverterTest PROPERTIES COMPILE_FLAGS
"-DMAGNUM_TGAIMAGECONVERTER_BUILD_STATIC -DMAGNUM_TGAIMPORTER_BUILD_STATIC")
target_compile_definitions(TgaImageConverterTest PRIVATE
"MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC"
"MAGNUM_TGAIMPORTER_BUILD_STATIC")
endif()

5
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h

@ -60,9 +60,8 @@ This plugin is built if `WITH_TGAIMAGECONVERTER` is enabled when building
Magnum. To use dynamic plugin, you need to load `TgaImageConverter` plugin
from `MAGNUM_PLUGINS_IMAGECONVERTER_DIR`. To use static plugin or use this as a
dependency of another plugin, you need to request `TgaImageConverter`
component of `Magnum` package in CMake and link to
`${MAGNUM_TGAIMAGECONVERTER_LIBRARIES}`. See @ref building, @ref cmake and
@ref plugins for more information.
component of `Magnum` package in CMake and link to `Magnum::TgaImageConverter`
target. See @ref building, @ref cmake and @ref plugins for more information.
*/
class MAGNUM_TGAIMAGECONVERTER_EXPORT TgaImageConverter: public AbstractImageConverter {
public:

8
src/MagnumPlugins/TgaImporter/CMakeLists.txt

@ -41,8 +41,9 @@ set(TgaImporter_HEADERS
add_library(TgaImporterObjects OBJECT
${TgaImporter_SRCS}
${TgaImporter_HEADERS})
target_include_directories(TgaImporterObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC)
set_target_properties(TgaImporterObjects PROPERTIES COMPILE_FLAGS "-DTgaImporterObjects_EXPORTS")
target_compile_definitions(TgaImporterObjects PRIVATE "TgaImporterObjects_EXPORTS")
endif()
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(TgaImporterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
@ -56,7 +57,6 @@ add_plugin(TgaImporter ${MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR} ${MAGNUM_PLU
if(BUILD_STATIC_PIC)
set_target_properties(TgaImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(TgaImporter Magnum)
install(FILES ${TgaImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter)
@ -69,5 +69,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum TgaImporter library for superprojects
set(MAGNUM_TGAIMPORTER_LIBRARY TgaImporter CACHE INTERNAL "")
# Magnum TgaImporter target alias for superprojects
add_library(Magnum::TgaImporter ALIAS TgaImporter)

5
src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt

@ -26,13 +26,12 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TgaImporterTest TgaImporterTest.cpp LIBRARIES MagnumTgaImporterTestLib)
target_include_directories(TgaImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# On Win32 we need to avoid dllimporting TgaImporter symbols, because it would
# search for the symbols in some DLL even though they were linked statically.
# However it apparently doesn't matter that they were dllexported when building
# the static library. EH.
if(WIN32)
set_target_properties(TgaImporterTest PROPERTIES COMPILE_FLAGS "-DMAGNUM_TGAIMPORTER_BUILD_STATIC")
target_compile_definitions(TgaImporterTest PRIVATE "MAGNUM_TGAIMPORTER_BUILD_STATIC")
endif()

4
src/MagnumPlugins/TgaImporter/TgaImporter.h

@ -60,8 +60,8 @@ This plugin is built if `WITH_TGAIMPORTER` is enabled when building Magnum. To
use dynamic plugin, you need to load `TgaImporter` plugin from
`MAGNUM_PLUGINS_IMPORTER_DIR`. To use static plugin or use this as a dependency
of another plugin, you need to request `TgaImporter` component of `Magnum`
package in CMake and link to `${MAGNUM_TGAIMPORTER_LIBRARIES}`. See
@ref building, @ref cmake and @ref plugins for more information.
package in CMake and link to `Magnum::TgaImporter` target. See @ref building,
@ref cmake and @ref plugins for more information.
The images are imported with @ref PixelType::UnsignedByte and @ref PixelFormat::RGB,
@ref PixelFormat::RGBA or @ref PixelFormat::Red, respectively. Grayscale images

12
src/MagnumPlugins/WavAudioImporter/CMakeLists.txt

@ -23,10 +23,6 @@
# DEALINGS IN THE SOFTWARE.
#
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
set(WavAudioImporter_SRCS
WavImporter.cpp)
@ -38,6 +34,9 @@ set(WavAudioImporter_HEADERS
add_library(WavAudioImporterObjects OBJECT
${WavAudioImporter_SRCS}
${WavAudioImporter_HEADERS})
target_include_directories(WavAudioImporterObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:MagnumAudio,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(WavAudioImporterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -50,7 +49,6 @@ add_plugin(WavAudioImporter ${MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR} ${
if(BUILD_STATIC_PIC)
set_target_properties(WavAudioImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(WavAudioImporter Magnum MagnumAudio)
install(FILES ${WavAudioImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter)
@ -61,5 +59,5 @@ if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum WavAudioImporter library for superprojects
set(MAGNUM_WAVAUDIOIMPORTER_LIBRARY WavAudioImporter CACHE INTERNAL "")
# Magnum WavAudioImporter target alias for superprojects
add_library(Magnum::WavAudioImporter ALIAS WavAudioImporter)

3
src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt

@ -26,6 +26,5 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(WavAudioImporterTest WavImporterTest.cpp LIBRARIES MagnumWavAudioImporterTestLib)
target_include_directories(WavAudioImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

4
src/MagnumPlugins/WavAudioImporter/WavImporter.h

@ -46,8 +46,8 @@ This plugin is built if `WITH_WAVAUDIOIMPORTER` is enabled when building
Magnum. To use dynamic plugin, you need to load `WavAudioImporter` plugin
from `MAGNUM_PLUGINS_AUDIOIMPORTER_DIR`. To use static plugin or use this as a
dependency of another plugin, you need to request `WavAudioImporter` component
of `Magnum` package in CMake and link to `${MAGNUM_WAVAUDIOIMPORTER_LIBRARIES}`.
See @ref building, @ref cmake and @ref plugins for more information.
of `Magnum` package in CMake and link to `Magnum::WavAudioImporter` target. See
@ref building, @ref cmake and @ref plugins for more information.
*/
class WavImporter: public AbstractImporter {
public:

Loading…
Cancel
Save