#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013 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.
#
set ( MagnumPlatform_HEADERS
A b s t r a c t C o n t e x t H a n d l e r . h
E x t e n s i o n W r a n g l e r . h )
# Extension wrangler
add_library ( MagnumPlatformExtensionWrangler OBJECT ExtensionWrangler.cpp )
install ( FILES ${ MagnumPlatform_HEADERS } DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
# GLUT application
if ( WITH_GLUTAPPLICATION )
find_package ( GLUT )
if ( GLUT_FOUND )
add_library ( MagnumGlutApplication STATIC
G l u t A p p l i c a t i o n . c p p
$ < T A R G E T _ O B J E C T S : M a g n u m P l a t f o r m E x t e n s i o n W r a n g l e r > )
install ( FILES GlutApplication.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
install ( TARGETS MagnumGlutApplication DESTINATION ${ MAGNUM_LIBRARY_INSTALL_DIR } )
else ( )
message ( FATAL_ERROR "GLUT library, required by GlutApplication, was not found. Set WITH_GLUTAPPLICATION to OFF to skip building it." )
endif ( )
endif ( )
# SDL2 application
if ( WITH_SDL2APPLICATION )
find_package ( SDL2 )
if ( SDL2_FOUND )
include_directories ( ${ SDL2_INCLUDE_DIR } )
add_library ( MagnumSdl2Application STATIC
S d l 2 A p p l i c a t i o n . c p p
$ < T A R G E T _ O B J E C T S : M a g n u m P l a t f o r m E x t e n s i o n W r a n g l e r > )
install ( FILES Sdl2Application.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
install ( TARGETS MagnumSdl2Application DESTINATION ${ MAGNUM_LIBRARY_INSTALL_DIR } )
else ( )
message ( FATAL_ERROR "SDL2 library, required by Sdl2Application, was not found. Set WITH_SDL2APPLICATION to OFF to skip building it." )
endif ( )
endif ( )
# NaCl application
if ( WITH_NACLAPPLICATION )
if ( NOT ${ CMAKE_SYSTEM_NAME } STREQUAL NaCl )
message ( FATAL_ERROR "NaClApplication is available only when targeting Google Chrome Native Client. Set WITH_NACLAPPLICATION to OFF to skip building it." )
endif ( )
add_library ( MagnumNaClApplication STATIC
N a C l A p p l i c a t i o n . c p p )
install ( FILES NaClApplication.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
install ( TARGETS MagnumNaClApplication DESTINATION ${ MAGNUM_LIBRARY_INSTALL_DIR } )
endif ( )
# GLX application
if ( WITH_GLXAPPLICATION )
set ( NEED_ABSTRACTXAPPLICATION 1 )
set ( NEED_GLXCONTEXT 1 )
add_library ( MagnumGlxApplication STATIC
$ < T A R G E T _ O B J E C T S : M a g n u m A b s t r a c t X A p p l i c a t i o n >
$ < T A R G E T _ O B J E C T S : M a g n u m G l x C o n t e x t H a n d l e r >
$ < T A R G E T _ O B J E C T S : M a g n u m P l a t f o r m E x t e n s i o n W r a n g l e r > )
install ( FILES GlxApplication.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
install ( TARGETS MagnumGlxApplication DESTINATION ${ MAGNUM_LIBRARY_INSTALL_DIR } )
endif ( )
# X/EGL application
if ( WITH_XEGLAPPLICATION )
set ( NEED_ABSTRACTXAPPLICATION 1 )
set ( NEED_EGLCONTEXT 1 )
add_library ( MagnumXEglApplication STATIC
$ < T A R G E T _ O B J E C T S : M a g n u m A b s t r a c t X A p p l i c a t i o n >
$ < T A R G E T _ O B J E C T S : M a g n u m E g l C o n t e x t H a n d l e r >
$ < T A R G E T _ O B J E C T S : M a g n u m P l a t f o r m E x t e n s i o n W r a n g l e r > )
install ( FILES XEglApplication.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
install ( TARGETS MagnumXEglApplication DESTINATION ${ MAGNUM_LIBRARY_INSTALL_DIR } )
endif ( )
if ( WITH_WINDOWLESSGLXAPPLICATION OR NEED_ABSTRACTXAPPLICATION )
find_package ( X11 )
if ( NOT X11_FOUND )
message ( FATAL_ERROR "X11 library, required by some contexts, was not found. Set WITH_*X*APPLICATION to OFF to skip building them." )
endif ( )
endif ( )
# Windowless GLX application
if ( WITH_WINDOWLESSGLXAPPLICATION )
add_library ( MagnumWindowlessGlxApplication STATIC
W i n d o w l e s s G l x A p p l i c a t i o n . c p p
$ < T A R G E T _ O B J E C T S : M a g n u m P l a t f o r m E x t e n s i o n W r a n g l e r > )
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties ( MagnumWindowlessGlxApplication PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast" )
install ( FILES WindowlessGlxApplication.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
install ( TARGETS MagnumWindowlessGlxApplication DESTINATION ${ MAGNUM_LIBRARY_INSTALL_DIR } )
endif ( )
# Abstract X application
if ( NEED_ABSTRACTXAPPLICATION )
add_library ( MagnumAbstractXApplication OBJECT AbstractXApplication.cpp )
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties ( MagnumAbstractXApplication PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast" )
install ( FILES AbstractXApplication.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
endif ( )
# GLX context
if ( NEED_GLXCONTEXT )
add_library ( MagnumGlxContextHandler OBJECT GlxContextHandler.cpp )
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties ( MagnumGlxContextHandler PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast" )
install ( FILES GlxContextHandler.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
endif ( )
# EGL context
if ( NEED_EGLCONTEXT )
find_package ( EGL )
if ( NOT EGL_FOUND )
message ( FATAL_ERROR "EGL library, required by some window contexts, was not found. Set WITH_*EGL*APPLICATION to OFF to skip building them." )
endif ( )
add_library ( MagnumEglContextHandler OBJECT EglContextHandler.cpp )
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties ( MagnumEglContextHandler PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast" )
install ( FILES EglContextHandler.h DESTINATION ${ MAGNUM_INCLUDE_INSTALL_DIR } /Platform )
endif ( )
# Magnum Info
if ( WITH_MAGNUMINFO )
if ( UNIX )
add_executable ( magnum-info magnum-info.cpp )
target_link_libraries ( magnum-info Magnum MagnumWindowlessGlxApplication ${ X11_LIBRARIES } )
install ( TARGETS magnum-info DESTINATION ${ MAGNUM_BINARY_INSTALL_DIR } )
else ( )
message ( WARNING "magnum-info is currently available only on Unix. Set WITH_MAGNUMINFO to OFF to suppress this warning." )
endif ( )
endif ( )