changes to compile on gcc 4.7

This commit is contained in:
Eduardo Bart 2011-12-19 15:26:19 -02:00
parent 56a392f681
commit 2b25ffd86b
3 changed files with 19 additions and 4 deletions

View File

@ -6,6 +6,7 @@ MESSAGE(STATUS ${CMAKE_MODULE_PATH})
OPTION(NO_CONSOLE "Disables console window on Windows platform" OFF) OPTION(NO_CONSOLE "Disables console window on Windows platform" OFF)
OPTION(HANDLE_EXCEPTIONS "Generate crash reports" OFF) OPTION(HANDLE_EXCEPTIONS "Generate crash reports" OFF)
OPTION(USE_OPENGL_ES2 "Use OpenGL ES 2.0 (for mobiles devices)" OFF) OPTION(USE_OPENGL_ES2 "Use OpenGL ES 2.0 (for mobiles devices)" OFF)
OPTION(USE_GCC47 "Use experimental gcc 4.7" OFF)
# set debug as default build type # set debug as default build type
IF(NOT CMAKE_BUILD_TYPE) IF(NOT CMAKE_BUILD_TYPE)
@ -14,7 +15,6 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
# find needed libraries # find needed libraries
SET(Boost_USE_STATIC_LIBS ON) SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_MULTITHREADED OFF)
FIND_PACKAGE(Boost COMPONENTS system REQUIRED) FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
IF(USE_OPENGL_ES2) IF(USE_OPENGL_ES2)
@ -60,6 +60,10 @@ ELSE(HANDLE_EXCEPTIONS)
MESSAGE(STATUS "Generate crash reports: OFF") MESSAGE(STATUS "Generate crash reports: OFF")
ENDIF(HANDLE_EXCEPTIONS) ENDIF(HANDLE_EXCEPTIONS)
IF(USE_GCC47)
SET(CMAKE_C_COMPILER gcc-4.7)
SET(CMAKE_CXX_COMPILER g++-4.7)
ENDIF(USE_GCC47)
IF(WIN32) IF(WIN32)
SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp) SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp)
@ -71,6 +75,7 @@ IF(WIN32)
IF(NO_CONSOLE) IF(NO_CONSOLE)
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthread")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows") SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
ENDIF(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_COMPILER_IS_GNUCXX)
MESSAGE(STATUS "Disable windows console: ON") MESSAGE(STATUS "Disable windows console: ON")
@ -78,8 +83,12 @@ IF(WIN32)
MESSAGE(STATUS "Disable windows console: OFF") MESSAGE(STATUS "Disable windows console: OFF")
ENDIF(NO_CONSOLE) ENDIF(NO_CONSOLE)
ELSE(WIN32) ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic") SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
SET(ADDITIONAL_LIBRARIES pthread X11 dl) IF(USE_GCC47)
ADD_DEFINITIONS(-D_GLIBCXX__PTHREADS)
ENDIF(USE_GCC47)
SET(ADDITIONAL_LIBRARIES X11 dl)
SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp) SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp)
ENDIF(WIN32) ENDIF(WIN32)

View File

@ -105,7 +105,7 @@ void PainterShaderProgram::draw(const CoordsBuffer& coordsBuffer, DrawMode drawM
} }
bool mustDisableTexCoordsArray = false; bool mustDisableTexCoordsArray = false;
if(coordsBuffer.getTextureCoords() > 0) { if(coordsBuffer.getTextureCoordsCount() > 0) {
enableAttributeArray(PainterShaderProgram::TEXTURE_COORDS_ATTR); enableAttributeArray(PainterShaderProgram::TEXTURE_COORDS_ATTR);
setAttributeArray(PainterShaderProgram::TEXTURE_COORDS_ATTR, coordsBuffer.getTextureCoords(), 2); setAttributeArray(PainterShaderProgram::TEXTURE_COORDS_ATTR, coordsBuffer.getTextureCoords(), 2);
mustDisableTexCoordsArray = true; mustDisableTexCoordsArray = true;

View File

@ -296,7 +296,7 @@ public:
/// Pushes any type onto the stack /// Pushes any type onto the stack
template<typename T, typename... Args> template<typename T, typename... Args>
void polymorphicPush(T v, Args... args) { push_luavalue(v); polymorphicPush(args...); } void polymorphicPush(T v, Args... args);
void polymorphicPush() { } void polymorphicPush() { }
/// Casts a value from stack to any type /// Casts a value from stack to any type
@ -320,6 +320,12 @@ extern LuaInterface g_lua;
#include "luabinder.h" #include "luabinder.h"
#include "luavaluecasts.h" #include "luavaluecasts.h"
template<typename T, typename... Args>
void LuaInterface::polymorphicPush(T v, Args... args) {
push_luavalue(v);
polymorphicPush(args...);
}
// next templates must be defined after above includes // next templates must be defined after above includes
template<class C, typename F> template<class C, typename F>
void LuaInterface::bindClassStaticFunction(const std::string& functionName, const F& function) { void LuaInterface::bindClassStaticFunction(const std::string& functionName, const F& function) {