From 3752dda53f1fba19c78a00200cd8ea7f2450fcc9 Mon Sep 17 00:00:00 2001 From: David Williams Date: Thu, 2 Dec 2010 20:18:19 +0000 Subject: [PATCH] Patch for improved Boost support for VS2008 and below. --- CMakeLists.txt | 7 ++++++ .../PolyVoxCore/include/PolyVoxImpl/TypeDef.h | 24 ++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d50b527..b81907e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,13 @@ IF(WIN32) #SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 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" ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode ENDIF() diff --git a/library/PolyVoxCore/include/PolyVoxImpl/TypeDef.h b/library/PolyVoxCore/include/PolyVoxImpl/TypeDef.h index 9c22a42d..cf7786b3 100644 --- a/library/PolyVoxCore/include/PolyVoxImpl/TypeDef.h +++ b/library/PolyVoxCore/include/PolyVoxImpl/TypeDef.h @@ -39,19 +39,21 @@ freely, subject to the following restrictions: //Check which compiler we are using and work around unsupported features as necessary. #if defined(_MSC_VER) && (_MSC_VER < 1600) - //To support old Microsoft compilers we use boost to replace the std::shared_ptr - //and potentially other C++0x features. To use this capability you will need to - //make sure you have boost installed on your system. - #include "boost/smart_ptr.hpp" + //To support old (pre-vc2010) Microsoft compilers we use boost to replace the + //std::shared_ptr and potentially other C++0x features. To use this capability you + //will need to make sure you have boost installed on your system. + #include #define polyvox_shared_ptr boost::shared_ptr - //We also need to define these types as cstdint isn't available - typedef char int8_t; - typedef short int16_t; - typedef long int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned long uint32_t; + //As long as we're requiring boost, we'll use it to compensate + //for the missing cstdint header too. + #include + using boost::int8_t; + using boost::int16_t; + using boost::int32_t; + using boost::uint8_t; + using boost::uint16_t; + using boost::uint32_t; #else //We have a decent compiler - use real C++0x features #include