|
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
|
|
|
|
|
|
|
|
|
|
# Files shared between main library and unit test library
|
|
|
|
|
set(Magnum_SRCS
|
|
|
|
|
Resource.cpp
|
|
|
|
|
Timeline.cpp)
|
|
|
|
|
|
|
|
|
|
set(Magnum_HEADERS
|
|
|
|
|
AbstractResourceLoader.h
|
|
|
|
|
Array.h
|
|
|
|
|
DimensionTraits.h
|
|
|
|
|
Image.h
|
|
|
|
|
ImageView.h
|
|
|
|
|
Magnum.h
|
|
|
|
|
PixelStorage.h
|
|
|
|
|
Resource.h
|
|
|
|
|
ResourceManager.h
|
|
|
|
|
ResourceManager.hpp
|
|
|
|
|
Tags.h
|
|
|
|
|
Timeline.h
|
|
|
|
|
Types.h
|
|
|
|
|
visibility.h)
|
|
|
|
|
|
|
|
|
|
# Files shared between main library and math unit test library
|
|
|
|
|
set(MagnumMath_SRCS
|
|
|
|
|
Math/Color.cpp
|
|
|
|
|
Math/Functions.cpp
|
|
|
|
|
Math/Packing.cpp
|
|
|
|
|
Math/instantiation.cpp)
|
|
|
|
|
|
|
|
|
|
# Objects shared between main and test library
|
|
|
|
|
add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS})
|
|
|
|
|
target_include_directories(MagnumMathObjects PUBLIC
|
|
|
|
|
${PROJECT_SOURCE_DIR}/src
|
|
|
|
|
${PROJECT_BINARY_DIR}/src
|
|
|
|
|
$<TARGET_PROPERTY:Corrade::Utility,INTERFACE_INCLUDE_DIRECTORIES>)
|
|
|
|
|
if(NOT BUILD_STATIC)
|
|
|
|
|
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)
|
|
|
|
|
endif()
|
|
|
|
|
set_target_properties(MagnumMathObjects PROPERTIES FOLDER "Magnum/Math")
|
|
|
|
|
|
|
|
|
|
# Main library
|
|
|
|
|
add_library(Magnum ${SHARED_OR_STATIC}
|
|
|
|
|
${Magnum_SRCS}
|
|
|
|
|
${Magnum_HEADERS}
|
|
|
|
|
$<TARGET_OBJECTS:MagnumMathObjects>)
|
|
|
|
|
set_target_properties(Magnum PROPERTIES
|
|
|
|
|
DEBUG_POSTFIX "-d"
|
|
|
|
|
FOLDER "Magnum")
|
|
|
|
|
if(NOT BUILD_STATIC)
|
|
|
|
|
set_target_properties(Magnum PROPERTIES VERSION ${MAGNUM_LIBRARY_VERSION} SOVERSION ${MAGNUM_LIBRARY_SOVERSION})
|
|
|
|
|
elseif(BUILD_STATIC_PIC)
|
|
|
|
|
set_target_properties(Magnum PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
|
|
|
endif()
|
|
|
|
|
target_include_directories(Magnum PUBLIC
|
|
|
|
|
${PROJECT_SOURCE_DIR}/src
|
|
|
|
|
${PROJECT_BINARY_DIR}/src)
|
|
|
|
|
target_link_libraries(Magnum PUBLIC
|
|
|
|
|
Corrade::Utility)
|
|
|
|
|
|
|
|
|
|
install(TARGETS Magnum
|
|
|
|
|
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
|
|
|
|
|
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
|
|
|
|
|
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
|
|
|
|
|
install(FILES ${Magnum_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR})
|
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR})
|
|
|
|
|
|
|
|
|
|
add_subdirectory(Math)
|
|
|
|
|
add_subdirectory(Platform)
|
|
|
|
|
|
|
|
|
|
if(WITH_AUDIO)
|
|
|
|
|
add_subdirectory(Audio)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_DEBUGTOOLS)
|
|
|
|
|
add_subdirectory(DebugTools)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_GL)
|
|
|
|
|
add_subdirectory(GL)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_MESHTOOLS)
|
|
|
|
|
add_subdirectory(MeshTools)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_PRIMITIVES)
|
|
|
|
|
add_subdirectory(Primitives)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_SCENEGRAPH)
|
|
|
|
|
add_subdirectory(SceneGraph)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_SHADERS)
|
|
|
|
|
add_subdirectory(Shaders)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_SHAPES)
|
|
|
|
|
add_subdirectory(Shapes)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_TEXT)
|
|
|
|
|
add_subdirectory(Text)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_TEXTURETOOLS)
|
|
|
|
|
add_subdirectory(TextureTools)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_TRADE)
|
|
|
|
|
add_subdirectory(Trade)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(BUILD_TESTS)
|
|
|
|
|
# Library with graceful assert for testing
|
|
|
|
|
add_library(MagnumMathTestLib ${SHARED_OR_STATIC}
|
|
|
|
|
$<TARGET_OBJECTS:MagnumMathObjects>
|
|
|
|
|
${PROJECT_SOURCE_DIR}/src/dummy.cpp) # XCode workaround, see file comment for details
|
|
|
|
|
target_include_directories(MagnumMathTestLib PUBLIC
|
|
|
|
|
${PROJECT_SOURCE_DIR}/src
|
|
|
|
|
${PROJECT_BINARY_DIR}/src)
|
|
|
|
|
target_compile_definitions(MagnumMathTestLib PRIVATE "CORRADE_GRACEFUL_ASSERT")
|
|
|
|
|
set_target_properties(MagnumMathTestLib PROPERTIES
|
|
|
|
|
DEBUG_POSTFIX "-d"
|
|
|
|
|
FOLDER "Magnum/Math")
|
|
|
|
|
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
|
|
|
|
|
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
|
|
|
|
|
install(TARGETS MagnumMathTestLib
|
|
|
|
|
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
|
|
|
|
|
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
|
|
|
|
|
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_subdirectory(Test)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# Magnum library target alias and configure file for superprojects
|
|
|
|
|
add_library(Magnum::Magnum ALIAS Magnum)
|
|
|
|
|
set(_MAGNUM_CONFIGURE_FILE ${CMAKE_CURRENT_BINARY_DIR}/configure.h CACHE INTERNAL "")
|