Browse Source

Initial work for GCC 4.5 compatibility.

GCC 4.5 doesn't know constexpr keyword and nullptr. As all constexpr
functions are here inline, it can be done with a simple macro.
Vladimír Vondruš 14 years ago
parent
commit
ee62d39e6f
  1. 1
      CMakeLists.txt
  2. 4
      src/CMakeLists.txt
  3. 1
      src/Math/Math.h
  4. 2
      src/Math/MathTypeTraits.h
  5. 25
      src/magnumCompatibility.h
  6. 1
      src/magnumConfigure.h.cmake

1
CMakeLists.txt

@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 2.8.8)
project(Magnum)
option(TARGET_GLES "Build for OpenGL ES 2 instead of desktop OpenGL" OFF)
option(GCC45_COMPATIBILITY "Enable compatibility mode for GCC 4.5 (might disable some features)" OFF)
option(BUILD_TESTS "Build unit tests (requires Qt4)." OFF)

4
src/CMakeLists.txt

@ -4,6 +4,10 @@ if(TARGET_GLES)
set(MAGNUM_TARGET_GLES 1)
endif()
if(GCC45_COMPATIBILITY)
set(MAGNUM_GCC45_COMPATIBILITY 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/magnumConfigure.h)

1
src/Math/Math.h

@ -17,6 +17,7 @@
#include <cstddef>
#include "magnumCompatibility.h"
#include "magnumVisibility.h"
/** @file

2
src/Math/MathTypeTraits.h

@ -21,6 +21,8 @@
#include <cmath>
#include "magnumCompatibility.h"
/** @brief Precision when testing floats for equality */
#ifndef FLOAT_EQUALITY_PRECISION
#define FLOAT_EQUALITY_PRECISION 1.0e-6

25
src/magnumCompatibility.h

@ -0,0 +1,25 @@
#ifndef magnumCompatibility_h
#define magnumCompatibility_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "magnumConfigure.h"
#ifdef MAGNUM_GCC45_COMPATIBILITY
#define constexpr
#define nullptr 0
#endif
#endif

1
src/magnumConfigure.h.cmake

@ -1 +1,2 @@
#cmakedefine MAGNUM_TARGET_GLES
#cmakedefine MAGNUM_GCC45_COMPATIBILITY

Loading…
Cancel
Save