Patch for improved Boost support for VS2008 and below.

This commit is contained in:
David Williams 2010-12-02 20:18:19 +00:00
parent 87a526bb46
commit 3752dda53f
2 changed files with 20 additions and 11 deletions

View File

@ -24,6 +24,13 @@ IF(WIN32)
#SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) #SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(WIN32) ENDIF(WIN32)
if(MSVC AND (MSVC_VERSION LESS 1600))
# Require boost for older (pre-vc2010) Visual Studio compilers
# See library/include/polyvoximpl/TypeDef.h
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
endif()
IF(CMAKE_COMPILER_IS_GNUCXX) #Maybe "OR MINGW" IF(CMAKE_COMPILER_IS_GNUCXX) #Maybe "OR MINGW"
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
ENDIF() ENDIF()

View File

@ -39,19 +39,21 @@ freely, subject to the following restrictions:
//Check which compiler we are using and work around unsupported features as necessary. //Check which compiler we are using and work around unsupported features as necessary.
#if defined(_MSC_VER) && (_MSC_VER < 1600) #if defined(_MSC_VER) && (_MSC_VER < 1600)
//To support old Microsoft compilers we use boost to replace the std::shared_ptr //To support old (pre-vc2010) Microsoft compilers we use boost to replace the
//and potentially other C++0x features. To use this capability you will need to //std::shared_ptr and potentially other C++0x features. To use this capability you
//make sure you have boost installed on your system. //will need to make sure you have boost installed on your system.
#include "boost/smart_ptr.hpp" #include <boost/smart_ptr.hpp>
#define polyvox_shared_ptr boost::shared_ptr #define polyvox_shared_ptr boost::shared_ptr
//We also need to define these types as cstdint isn't available //As long as we're requiring boost, we'll use it to compensate
typedef char int8_t; //for the missing cstdint header too.
typedef short int16_t; #include <boost/cstdint.hpp>
typedef long int32_t; using boost::int8_t;
typedef unsigned char uint8_t; using boost::int16_t;
typedef unsigned short uint16_t; using boost::int32_t;
typedef unsigned long uint32_t; using boost::uint8_t;
using boost::uint16_t;
using boost::uint32_t;
#else #else
//We have a decent compiler - use real C++0x features //We have a decent compiler - use real C++0x features
#include <cstdint> #include <cstdint>