diff --git a/CMakeLists.txt b/CMakeLists.txt index 328bbb1e8..9b9fc43d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2" ON "TARGET_GLES" OFF cmake_dependent_option(TARGET_DESKTOP_GLES "Build for OpenGL ES on desktop" OFF "TARGET_GLES" OFF) # Parts of the library +option(WITH_AUDIO "Build Audio library" ON) option(WITH_DEBUGTOOLS "Build DebugTools library" ON) cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_DEBUGTOOLS" ON) cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" ON "NOT WITH_DEBUGTOOLS" ON) diff --git a/doc/building.dox b/doc/building.dox index def7912d6..bebcbd912 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -96,6 +96,7 @@ By default the engine is built with everything except application libraries (see below). Using `WITH_*` CMake parameters you can specify which parts will be built and which not: + - `WITH_AUDIO` - Audio library. Requires **OpenAL** library. - `WITH_DEBUGTOOLS` - DebugTools library. Enables also building of MeshTools, Primitives, SceneGraph, Shaders and Shapes libraries. - `WITH_MESHTOOLS` - MeshTools library. Enabled automatically if `WITH_DEBUGTOOLS` diff --git a/doc/cmake.dox b/doc/cmake.dox index b23a19c51..eee0944bc 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -51,6 +51,7 @@ components. The base library depends on %Corrade, OpenGL and GLEW libraries (or OpenGL ES libraries). Additional dependencies are specified by the components. The optional components are: +- `%Audio` -- Audio library (depends on OpenAL library) - `%DebugTools` -- DebugTools library (depends on `%MeshTools`, `%Primitives`, `%SceneGraph`, `%Shaders` and `%Shapes` components) - `%MeshTools` -- MeshTools library diff --git a/doc/namespaces.dox b/doc/namespaces.dox index 8a4e1b3b7..f984f03b5 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -88,6 +88,18 @@ This library is built by default and found by default in CMake. See @ref building and @ref cmake for more information. */ +/** @dir Audio + * @brief Namespace Magnum::Audio + */ +/** @namespace Magnum::Audio +@brief %Audio playback + +Audio import, playback and integration with @ref SceneGraph. + +This library is built when `WITH_AUDIO` is enabled and found as `%Audio` +component in CMake. See @ref building and @ref cmake for more information. +*/ + /** @dir DebugTools * @brief Namespace Magnum::DebugTools */ diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 58c5cf901..0be6ab1b0 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -19,6 +19,7 @@ # components. The base library depends on Corrade, OpenGL and GLEW # libraries. Additional dependencies are specified by the components. The # optional components are: +# Audio - Audio library (depends on OpenAL library) # DebugTools - DebugTools library (depends on MeshTools, Primitives, # SceneGraph, Shaders and Shapes components) # MeshTools - MeshTools library @@ -219,6 +220,19 @@ foreach(component ${Magnum_FIND_COMPONENTS}) endif() endif() + # Audio library + if(${component} STREQUAL Audio) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Audio.h) + + find_package(OpenAL) + if(OPENAL_FOUND) + set(_MAGNUM_${_COMPONENT}_LIBRARIES ${OPENAL_LIBRARY}) + set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR}) + else() + unset(MAGNUM_${_COMPONENT}_LIBRARY) + endif() + endif() + # DebugTools library if(${component} STREQUAL DebugTools) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES DebugTools.h) diff --git a/src/Audio/Audio.h b/src/Audio/Audio.h new file mode 100644 index 000000000..63960eeca --- /dev/null +++ b/src/Audio/Audio.h @@ -0,0 +1,35 @@ +#ifndef Magnum_Audio_Audio_h +#define Magnum_Audio_Audio_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Forward declarations for Magnum::Audio namespace + */ + +namespace Magnum { namespace Audio { + +}} + +#endif diff --git a/src/Audio/CMakeLists.txt b/src/Audio/CMakeLists.txt new file mode 100644 index 000000000..e404e1246 --- /dev/null +++ b/src/Audio/CMakeLists.txt @@ -0,0 +1,34 @@ +# +# This file is part of Magnum. +# +# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# + +find_package(OpenAL REQUIRED) + +include_directories(${OPENAL_INCLUDE_DIR}) + +set(MagnumAudio_SOURCES + ) +set(MagnumAudio_HEADERS + Audio.h) + +install(FILES ${MagnumAudio_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Audio) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ae045b56e..2e92d2ea5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -191,6 +191,10 @@ add_subdirectory(Math) add_subdirectory(Platform) add_subdirectory(Trade) +if(WITH_AUDIO) + add_subdirectory(Audio) +endif() + if(WITH_DEBUGTOOLS) add_subdirectory(DebugTools) endif()