Browse Source

Expose MAGNUM_BUILD_STATIC in magnumConfigure.h.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
8c75f6e8c2
  1. 4
      CMakeLists.txt
  2. 7
      doc/building.dox
  3. 2
      doc/cmake.dox
  4. 6
      modules/FindMagnum.cmake
  5. 9
      src/Magnum.h
  6. 6
      src/Platform/magnum-info.cpp
  7. 1
      src/magnumConfigure.h.cmake

4
CMakeLists.txt

@ -65,6 +65,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules/")
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

6
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)

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

@ -53,6 +53,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

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

Loading…
Cancel
Save