Browse Source

Bootstrap Vulkan support.

pull/194/merge
Vladimír Vondruš 8 years ago
parent
commit
fec1a07b9b
  1. 6
      CMakeLists.txt
  2. 1
      doc/00-page-order.dox
  3. 5
      doc/building.dox
  4. 3
      doc/cmake.dox
  5. 22
      doc/namespaces.dox
  6. 34
      doc/vulkan.dox
  7. 14
      modules/FindMagnum.cmake
  8. 4
      src/Magnum/CMakeLists.txt
  9. 11
      src/Magnum/Magnum.h
  10. 26
      src/Magnum/Vk/CMakeLists.txt
  11. 1
      src/Magnum/configure.h.cmake

6
CMakeLists.txt

@ -72,6 +72,7 @@ endif()
cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2 / WebGL 1.0" ON "TARGET_GLES" OFF)
cmake_dependent_option(TARGET_DESKTOP_GLES "Build for OpenGL ES on desktop" OFF "TARGET_GLES" OFF)
cmake_dependent_option(TARGET_HEADLESS "Build command-line utilities for use on a headless machines" OFF "WITH_GL" OFF)
cmake_dependent_option(TARGET_VK "Build libraries with Vulkan interoperability" ON "WITH_VK" OFF)
# Magnum GL Info (currently only using GLX/CGL/EGL on *nix, WGL/EGL on Windows
# and EGL on Emscripten)
@ -115,8 +116,10 @@ cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WI
cmake_dependent_option(WITH_TRADE "Build Trade library" ON "NOT WITH_MESHTOOLS;NOT WITH_PRIMITIVES;NOT WITH_IMAGECONVERTER;NOT WITH_ANYIMAGEIMPORTER;NOT WITH_ANYIMAGECONVERTER;NOT WITH_ANYSCENEIMPORTER;NOT WITH_OBJIMPORTER;NOT WITH_TGAIMAGECONVERTER;NOT WITH_TGAIMPORTER" ON)
cmake_dependent_option(WITH_GL "Build GL library" ON "NOT WITH_SHADERS;NOT WITH_TEXT;NOT WITH_GL_INFO;NOT WITH_ANDROIDAPPLICATION;NOT WITH_WINDOWLESSIOSAPPLICATION;NOT WITH_CGLCONTEXT;NOT WITH_GLXAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_WGLCONTEXT;NOT WITH_WINDOWLESSWINDOWSEGLAPPLICATION;NOT WITH_GLUTAPPLICATION;NOT WITH_DISTANCEFIELDCONVERTER;NOT WITH_FONTCONVERTER;NOT WITH_IMAGECONVERTER" ON)
option(WITH_PRIMITIVES "Builf Primitives library" ON)
option(WITH_VK "Build Vk library" OFF)
cmake_dependent_option(TARGET_GL "Build libraries with OpenGL interoperability" ON "WITH_GL" OFF)
cmake_dependent_option(TARGET_VK "Build libraries with Vulkan interoperability" ON "WITH_VK" OFF)
# Magnum AL Info
cmake_dependent_option(WITH_AL_INFO "Build magnum-al-info utility" OFF "WITH_AUDIO" OFF)
@ -240,6 +243,9 @@ endif()
if(TARGET_HEADLESS)
set(MAGNUM_TARGET_HEADLESS 1)
endif()
if(TARGET_VK)
set(MAGNUM_TARGET_VK 1)
endif()
if(CORRADE_TARGET_EMSCRIPTEN)
include(UseEmscripten)

1
doc/00-page-order.dox

@ -33,6 +33,7 @@
@page example-index Examples
@page tips Tips and tricks
@page utilities Utilities
@page vulkan Vulkan
@page opengl OpenGL
@page openal OpenAL

5
doc/building.dox

@ -408,6 +408,10 @@ available for desktop OpenGL only, see @ref requires-gl.
used everywhere instead of platform-specific toolkits like CGL, GLX or WGL.
Supported mainly on OpenGL ES drivers. Available only when `WITH_GL` is
enabled.
- `TARGET_VK` --- Build libraries with Vulkan interoperability enabled.
Enabled by default when `WITH_VK` is enabled. Disabling this will cause
libraries to not depend on the @ref Vk library, but doesn't affect the
@ref Vk library itself.
By default the engine is built in a way that allows having multiple independent
thread-local Magnum contents. This might cause some performance penalties ---
@ -444,6 +448,7 @@ be built and which not:
- `WITH_TEXTURETOOLS` --- Build the @ref TextureTools library. Enabled
automatically if `WITH_TEXT` or `WITH_DISTANCEFIELDCONVERTER` is enabled.
- `WITH_TRADE` --- Build the @ref Trade library.
- `WITH_VK` --- Build the @ref Vk library
There are more involved component dependencies that are not described here (for
example the @ref DebugTools has some functionality that gets built only when

3
doc/cmake.dox

@ -104,6 +104,7 @@ the components. The optional components are:
- `Text` --- @ref Text library
- `TextureTools` --- @ref TextureTools library
- `Trade` --- @ref Trade library
- `Vk` --- @ref Vk library
Platform namespace is split into more components:
@ -219,6 +220,8 @@ are also available as preprocessor variables if including
- `MAGNUM_TARGET_WEBGL` --- Defined if compiled for WebGL
- `MAGNUM_TARGET_HEADLESS` --- Defined if compiled for headless machines. See
@ref MAGNUM_TARGET_HEADLESS documentation for more information.
- `MAGNUM_TARGET_VK` --- Defined if compiled with Vulkan interoperability
enabled
Workflows without imported targets are deprecated and the following variables
are included just for backwards compatibility and only if

22
doc/namespaces.dox

@ -456,6 +456,28 @@ Additional plugins are built separately, see particular `Trade::*Importer` and
information.
*/
/** @dir Magnum/Vk
* @brief Namespace @ref Magnum::Vk
*/
/** @namespace Magnum::Vk
@brief Vulkan wrapping layer
C++14 wrappers and helpers for Vulkan development.
This library is built if `WITH_VK` is enabled when building Magnum. To use this
library with CMake, you need to request the `Vk` component of the `Magnum`
package and link to the `Magnum::Vk` target:
@code{.cmake}
find_package(Magnum REQUIRED Vk)
# ...
target_link_libraries(your-app Magnum::Vk)
@endcode
See @ref building, @ref cmake and @ref vulkan for more information.
*/
/** @dir magnum/src/MagnumPlugins
* @brief Magnum plugins (part of @ref building "Magnum library")
*/

34
doc/vulkan.dox

@ -0,0 +1,34 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
namespace Magnum {
/** @page vulkan Vuulkan
@brief State of Vulkan support, version and extension requirements.
<em>Nothing to see here yet, sorry.</em>
*/
}

14
modules/FindMagnum.cmake

@ -59,6 +59,7 @@
# Text - Text library
# TextureTools - TextureTools library
# Trade - Trade library
# Vk - Vk library
# GlfwApplication - GLFW application
# GlutApplication - GLUT application
# GlxApplication - GLX application
@ -128,6 +129,7 @@
# emulation on desktop OpenGL
# MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL
# MAGNUM_TARGET_HEADLESS - Defined if compiled for headless machines
# MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop
#
# Additionally these variables are defined for internal usage:
#
@ -255,7 +257,8 @@ set(_magnumFlags
TARGET_GLES3
TARGET_DESKTOP_GLES
TARGET_WEBGL
TARGET_HEADLESS)
TARGET_HEADLESS
TARGET_VK)
foreach(_magnumFlag ${_magnumFlags})
string(FIND "${_magnumConfigure}" "#define MAGNUM_${_magnumFlag}" _magnum_${_magnumFlag})
if(NOT _magnum_${_magnumFlag} EQUAL -1)
@ -332,7 +335,7 @@ endif()
# components from other repositories)
set(_MAGNUM_LIBRARY_COMPONENT_LIST
Audio DebugTools GL MeshTools Primitives SceneGraph Shaders Shapes Text
TextureTools Trade
TextureTools Trade Vk
AndroidApplication GlfwApplication GlutApplication GlxApplication
Sdl2Application XEglApplication WindowlessCglApplication
WindowlessEglApplication WindowlessGlxApplication WindowlessIosApplication WindowlessWglApplication WindowlessWindowsEglApplication
@ -734,6 +737,13 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
elseif(_component STREQUAL Trade)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::PluginManager)
# Vk library
elseif(_component STREQUAL Vk)
set(Vulkan_INCLUDE_DIR ${MAGNUM_INCLUDE_DIR}/MagnumExternal/Vulkan)
find_package(Vulkan REQUIRED)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Vulkan::Vulkan)
endif()
# No special setup for AnyAudioImporter plugin

4
src/Magnum/CMakeLists.txt

@ -246,6 +246,10 @@ if(WITH_TRADE)
add_subdirectory(Trade)
endif()
if(WITH_VK)
add_subdirectory(Vk)
endif()
if(BUILD_TESTS)
# Math library with graceful assert for testing
add_library(MagnumMathTestLib ${SHARED_OR_STATIC}

11
src/Magnum/Magnum.h

@ -183,6 +183,17 @@ for more information.
#undef MAGNUM_TARGET_HEADLESS
#endif
/**
@brief Vulkan interoperability
Defined if the engine is built with Vulkan interoperability enabled --- extra
APIs in various libraries interacting with the @ref Magnum::Vk "Vk" library.
Enabled by default in case the @ref Magnum::Vk "Vk" library is built.
@see @ref building, @ref cmake
*/
#define MAGNUM_TARGET_VK
#undef MAGNUM_TARGET_VK
/** @{ @name Basic type definitions
See @ref types for more information.

26
src/Magnum/Vk/CMakeLists.txt

@ -0,0 +1,26 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2016 Jonathan Hale <squareys@googlemail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#

1
src/Magnum/configure.h.cmake

@ -35,5 +35,6 @@
#cmakedefine MAGNUM_TARGET_DESKTOP_GLES
#cmakedefine MAGNUM_TARGET_WEBGL
#cmakedefine MAGNUM_TARGET_HEADLESS
#cmakedefine MAGNUM_TARGET_VK
#endif

Loading…
Cancel
Save