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. 928
      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()

928
modules/FindMagnum.cmake

File diff suppressed because it is too large Load Diff

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