Fixed: #1177 VS 2010 does not work under CMake

This commit is contained in:
kervala 2011-05-12 12:49:17 +02:00
parent 15ef109f58
commit 2e4b7777bd
3 changed files with 21 additions and 19 deletions

View file

@ -41,10 +41,6 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds. # Force out of source builds.
CHECK_OUT_OF_SOURCE() CHECK_OUT_OF_SOURCE()
# Variables which must be set before PROJECT
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C) PROJECT(RyzomCore CXX C)
SET(NL_VERSION_MAJOR 0) SET(NL_VERSION_MAJOR 0)
@ -52,6 +48,9 @@ SET(NL_VERSION_MINOR 8)
SET(NL_VERSION_PATCH 0) SET(NL_VERSION_PATCH 0)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Redirect output files # Redirect output files
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

View file

@ -37,16 +37,15 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument: # Argument:
### ###
MACRO(NL_DEFAULT_PROPS name label) MACRO(NL_DEFAULT_PROPS name label)
IF(NOT MSVC10)
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
ENDIF(NOT MSVC10)
GET_TARGET_PROPERTY(type ${name} TYPE) GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL SHARED_LIBRARY) IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library # Set versions only if target is a shared library
SET_TARGET_PROPERTIES(${name} PROPERTIES SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}
INSTALL_NAME_DIR ${NL_LIB_PREFIX} INSTALL_NAME_DIR ${NL_LIB_PREFIX})
PROJECT_LABEL ${label})
ELSE(${type} STREQUAL SHARED_LIBRARY)
SET_TARGET_PROPERTIES(${name} PROPERTIES
PROJECT_LABEL ${label})
ENDIF(${type} STREQUAL SHARED_LIBRARY) ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(WITH_STLPORT AND WIN32) IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
@ -288,10 +287,17 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
IF(WIN32) IF(WIN32)
IF(MSVC10)
# /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10)
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1") SET(MIN_OPTIMIZATIONS "/Ob1")
ENDIF(MSVC10)
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000") SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000")
@ -347,9 +353,6 @@ MACRO(NL_SETUP_BUILD)
ENDMACRO(NL_SETUP_BUILD) ENDMACRO(NL_SETUP_BUILD)
MACRO(NL_SETUP_BUILD_FLAGS) MACRO(NL_SETUP_BUILD_FLAGS)
#SET(CMAKE_DEBUG_POSTFIX "_d")
#SET(CMAKE_RELEASE_POSTFIX "_r")
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE) SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)

View file

@ -113,8 +113,8 @@ bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
_TextureIdOver[2].setTexture((TxName+"_r.tga").c_str()); _TextureIdOver[2].setTexture((TxName+"_r.tga").c_str());
} }
// Compute Bmp Sizes // Compute Bmp Sizes (crash with VC++ 2010)
nlctassert(NumTexture==3); // nlctassert(NumTexture==3);
rVR.getTextureSizeFromId(_TextureIdNormal[0], _BmpLeftW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[0], _BmpLeftW, _BmpH);
rVR.getTextureSizeFromId(_TextureIdNormal[1], _BmpMiddleW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[1], _BmpMiddleW, _BmpH);
rVR.getTextureSizeFromId(_TextureIdNormal[2], _BmpRightW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[2], _BmpRightW, _BmpH);