Browse Source

Merge branch 'master' into compatibility

Vladimír Vondruš 13 years ago
parent
commit
070ed49158
  1. 4
      CMakeLists.txt
  2. 7
      doc/building.dox
  3. 2
      doc/cmake.dox
  4. 9
      modules/FindCorrade.cmake
  5. 32
      modules/FindMagnum.cmake
  6. 9
      src/Magnum.h
  7. 6
      src/Platform/magnum-info.cpp
  8. 4
      src/Shaders/CMakeLists.txt
  9. 37
      src/Shaders/magnumShadersResourceImport.hpp
  10. 4
      src/TextureTools/CMakeLists.txt
  11. 37
      src/TextureTools/magnumTextureToolsResourceImport.hpp
  12. 1
      src/magnumConfigure.h.cmake
  13. 2
      toolchains

4
CMakeLists.txt

@ -73,6 +73,10 @@ endif()
find_package(Corrade REQUIRED)
if(BUILD_STATIC)
set(MAGNUM_BUILD_STATIC 1)
endif()
# If targeting NaCl, set explicit OpenGL ES 2.0 support
if(CORRADE_TARGET_NACL)
set(TARGET_GLES 1)

7
doc/building.dox

@ -74,8 +74,11 @@ optional features.
make
make install
If you want to build with another compiler (e.g. Clang), pass
`-DCMAKE_CXX_COMPILER=clang++` to CMake.
The libraries are build as shared by default, pass `-DBUILD_STATIC=ON` to build
them as static. If you plan them to use with shared libraries later, enable
also position-independent code with `-DBUILD_STATIC_PIC=ON`. If you want to
build with another compiler (e.g. Clang), pass `-DCMAKE_CXX_COMPILER=clang++`
to CMake.
@subsection building-optional Enabling or disabling features

2
doc/cmake.dox

@ -95,6 +95,8 @@ convenience aliases `MAGNUM_APPLICATION_LIBRARIES` /
Features of found %Magnum library are exposed in these CMake variables, they
are also available as preprocessor variables if including Magnum.h:
- `MAGNUM_BUILD_STATIC` -- Defined if built as static libraries. Default are
shared libraries.
- `MAGNUM_TARGET_GLES` -- Defined if compiled for OpenGL ES
- `MAGNUM_TARGET_GLES2` -- Defined if compiled for OpenGL ES 2.0
- `MAGNUM_TARGET_GLES3` -- Defined if compiled for OpenGL ES 3.0

9
modules/FindCorrade.cmake

@ -21,6 +21,11 @@
# Features of found Corrade library are exposed in these variables:
# CORRADE_GCC46_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.6
# CORRADE_GCC45_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.5
# CORRADE_GCC44_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.4
# CORRADE_BUILD_STATIC - Defined if compiled as static libraries
# CORRADE_TARGET_NACL - Defined if compiled for Google Chrome
# Native Client
# CORRADE_TARGET_NACL_NEWLIB - Defined if compiled for Google Chrome
@ -163,6 +168,10 @@ string(FIND "${_corradeConfigure}" "#define CORRADE_GCC46_COMPATIBILITY" _GCC46_
if(NOT _GCC46_COMPATIBILITY EQUAL -1)
set(CORRADE_GCC46_COMPATIBILITY 1)
endif()
string(FIND "${_corradeConfigure}" "#define CORRADE_BUILD_STATIC" _BUILD_STATIC)
if(NOT _BUILD_STATIC EQUAL -1)
set(CORRADE_BUILD_STATIC 1)
endif()
string(FIND "${_corradeConfigure}" "#define CORRADE_TARGET_NACL" _TARGET_NACL)
if(NOT _TARGET_NACL EQUAL -1)
set(CORRADE_TARGET_NACL 1)

32
modules/FindMagnum.cmake

@ -45,6 +45,7 @@
# / MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS to simplify porting.
#
# Features of found Magnum library are exposed in these variables:
# MAGNUM_BUILD_STATIC - Defined if compiled as static libraries
# MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES
# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0
# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0
@ -111,7 +112,10 @@ find_path(MAGNUM_INCLUDE_DIR
# Configuration
file(READ ${MAGNUM_INCLUDE_DIR}/magnumConfigure.h _magnumConfigure)
# Built for specific target?
string(FIND "${_magnumConfigure}" "#define MAGNUM_BUILD_STATIC" _BUILD_STATIC)
if(NOT _BUILD_STATIC EQUAL -1)
set(MAGNUM_BUILD_STATIC 1)
endif()
string(FIND "${_magnumConfigure}" "#define MAGNUM_TARGET_GLES" _TARGET_GLES)
if(NOT _TARGET_GLES EQUAL -1)
set(MAGNUM_TARGET_GLES 1)
@ -138,11 +142,12 @@ if(NOT MAGNUM_TARGET_GLES)
find_package(GLEW REQUIRED)
endif()
# On Windows, *Application libraries need to have ${MAGNUM_LIBRARY} listed
# in dependencies also after *Application.lib static library name to avoid
# linker errors
if(WIN32)
set(_WINDOWCONTEXT_MAGNUM_LIBRARY_DEPENDENCY ${MAGNUM_LIBRARY})
# On Windows and in static builds, *Application libraries need to have
# ${MAGNUM_LIBRARIES} listed in dependencies also after all other library names
# to avoid linker errors. Applicaiton libraries are often last thus it is
# +- sufficient to add it there only.
if(WIN32 OR MAGNUM_BUILD_STATIC)
set(_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY ${MAGNUM_LIBRARIES})
endif()
# Additional components
@ -163,7 +168,7 @@ foreach(component ${Magnum_FIND_COMPONENTS})
if(${component} STREQUAL GlutApplication)
find_package(GLUT)
if(GLUT_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${GLUT_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARY_DEPENDENCY})
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${GLUT_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
@ -173,20 +178,23 @@ foreach(component ${Magnum_FIND_COMPONENTS})
if(${component} STREQUAL Sdl2Application)
find_package(SDL2)
if(SDL2_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${SDL2_LIBRARY} ${_WINDOWCONTEXT_MAGNUM_LIBRARY_DEPENDENCY})
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${SDL2_LIBRARY} ${_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY})
set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
endif()
# NaCl application has no additional dependencies
# NaCl application dependencies
if(${component} STREQUAL NaClApplication)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ppapi_cpp ppapi ${_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY})
endif()
# GLX application dependencies
if(${component} STREQUAL GlxApplication)
find_package(X11)
if(X11_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARY_DEPENDENCY})
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
@ -197,7 +205,7 @@ foreach(component ${Magnum_FIND_COMPONENTS})
find_package(EGL)
find_package(X11)
if(EGL_FOUND AND X11_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARY} ${X11_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARY_DEPENDENCY})
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARY} ${X11_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()
@ -207,7 +215,7 @@ foreach(component ${Magnum_FIND_COMPONENTS})
if(${component} STREQUAL WindowlessGlxApplication)
find_package(X11)
if(X11_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARY_DEPENDENCY})
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES} ${_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()

9
src/Magnum.h

@ -69,6 +69,15 @@ using Corrade::Utility::Error;
/** @todoc remove trailing underscores when Doxygen can handle `undef` */
/**
@brief Static library build
`MAGNUM_BUILD_STATIC` is defined if build as static libraries. Default are
shared libraries.
@see @ref building-corrade
*/
#define MAGNUM_BUILD_STATIC_
/**
@brief OpenGL ES target

6
src/Platform/magnum-info.cpp

@ -59,6 +59,12 @@ MagnumInfo::MagnumInfo(int& argc, char** argv): WindowlessGlxApplication(argc, a
#ifdef CORRADE_GCC46_COMPATIBILITY
d << "CORRADE_GCC46_COMPATIBILITY";
#endif
#ifdef CORRADE_BUILD_STATIC
d << "CORRADE_BUILD_STATIC";
#endif
#ifdef MAGNUM_BUILD_STATIC
d << "MAGNUM_BUILD_STATIC";
#endif
#ifdef CORRADE_TARGET_NACL
d << "CORRADE_TARGET_NACL";
#endif

4
src/Shaders/CMakeLists.txt

@ -49,6 +49,10 @@ set(MagnumShaders_HEADERS
magnumShadersVisibility.h)
if(BUILD_STATIC)
set(MagnumShaders_HEADERS ${MagnumShaders_HEADERS} magnumShadersResourceImport.hpp)
endif()
add_library(MagnumShaders ${SHARED_OR_STATIC} ${MagnumShaders_SRCS})
if(BUILD_STATIC_PIC)
# TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property

37
src/Shaders/magnumShadersResourceImport.hpp

@ -0,0 +1,37 @@
#ifndef Magnum_Shaders_magnumShadersResourceImport_hpp
#define Magnum_Shaders_magnumShadersResourceImport_hpp
/*
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.
*/
#include "magnumConfigure.h"
#ifdef MAGNUM_BUILD_STATIC
#include <Utility/Resource.h>
static int magnumShadersResourceImport() {
RESOURCE_INITIALIZE(MagnumShaders_RCS)
return 0;
} AUTOMATIC_INITIALIZER(magnumShadersResourceImport)
#endif
#endif

4
src/TextureTools/CMakeLists.txt

@ -37,6 +37,10 @@ set(MagnumTextureTools_HEADERS
magnumTextureToolsVisibility.h)
if(BUILD_STATIC)
set(MagnumTextureTools_HEADERS ${MagnumTextureTools_HEADERS} magnumTextureToolsResourceImport.hpp)
endif()
add_library(MagnumTextureTools ${SHARED_OR_STATIC} ${MagnumTextureTools_SRCS})
if(BUILD_STATIC_PIC)
# TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property

37
src/TextureTools/magnumTextureToolsResourceImport.hpp

@ -0,0 +1,37 @@
#ifndef Magnum_TextureTools_magnumTextureToolsResourceImport_hpp
#define Magnum_TextureTools_magnumTextureToolsResourceImport_hpp
/*
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.
*/
#include "magnumConfigure.h"
#ifdef MAGNUM_BUILD_STATIC
#include <Utility/Resource.h>
static int magnumTextureToolsResourceImport() {
RESOURCE_INITIALIZE(MagnumTextureTools_RCS)
return 0;
} AUTOMATIC_INITIALIZER(magnumTextureToolsResourceImport)
#endif
#endif

1
src/magnumConfigure.h.cmake

@ -22,6 +22,7 @@
DEALINGS IN THE SOFTWARE.
*/
#cmakedefine MAGNUM_BUILD_STATIC
#cmakedefine MAGNUM_TARGET_GLES
#cmakedefine MAGNUM_TARGET_GLES2
#cmakedefine MAGNUM_TARGET_GLES3

2
toolchains

@ -1 +1 @@
Subproject commit b15d3551c7bec3cff7d7a8825400a214254ae0c1
Subproject commit 4f69504e4df9b3a1a328ba344ff1857199046e9c
Loading…
Cancel
Save