From b5dd496a72207499a417a34b434cd35db2ad7a3f Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 12 May 2011 12:49:17 +0200 Subject: [PATCH] Fixed: #1177 VS 2010 does not work under CMake --- code/CMakeLists.txt | 9 +++---- code/CMakeModules/nel.cmake | 27 ++++++++++--------- .../src/interface_v3/ctrl_text_button.cpp | 4 +-- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 151dd5e4d..3f477d9c4 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -41,10 +41,6 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) # Force out of source builds. CHECK_OUT_OF_SOURCE() -# Variables which must be set before PROJECT -NL_SETUP_BUILD() -NL_SETUP_BUILD_FLAGS() - CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) SET(NL_VERSION_MAJOR 0) @@ -52,6 +48,9 @@ SET(NL_VERSION_MINOR 8) SET(NL_VERSION_PATCH 0) SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") +NL_SETUP_BUILD() +NL_SETUP_BUILD_FLAGS() + #----------------------------------------------------------------------------- # Redirect output files SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -109,7 +108,7 @@ IF(WIN32) GET_FILENAME_COMPONENT(VC_ROOT_PATH "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) # convert IDE fullpath to VC++ path STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_PATH}) - ENDIF(${CMAKE_CXX_COMPILER} MATCHES "VC") + ENDIF(${CMAKE_CXX_COMPILER} MATCHES "VC") ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") IF(WITH_MFC) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index cf6154648..dbe0991a4 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -37,16 +37,15 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### 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) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} - INSTALL_NAME_DIR ${NL_LIB_PREFIX} - PROJECT_LABEL ${label}) - ELSE(${type} STREQUAL SHARED_LIBRARY) - SET_TARGET_PROPERTIES(${name} PROPERTIES - PROJECT_LABEL ${label}) + INSTALL_NAME_DIR ${NL_LIB_PREFIX}) ENDIF(${type} STREQUAL SHARED_LIBRARY) IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") @@ -288,10 +287,17 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(WIN32) - # don't use a /O[012x] flag if you want custom optimizations - SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") - # without inlining it's unusable, use custom optimizations again - SET(MIN_OPTIMIZATIONS "/Ob1") + 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 + SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") + # without inlining it's unusable, use custom optimizations again + SET(MIN_OPTIMIZATIONS "/Ob1") + ENDIF(MSVC10) 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) 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_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE) diff --git a/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp b/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp index d2191a4eb..55cae37e3 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp @@ -113,8 +113,8 @@ bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) _TextureIdOver[2].setTexture((TxName+"_r.tga").c_str()); } - // Compute Bmp Sizes - nlctassert(NumTexture==3); + // Compute Bmp Sizes (crash with VC++ 2010) +// nlctassert(NumTexture==3); rVR.getTextureSizeFromId(_TextureIdNormal[0], _BmpLeftW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[1], _BmpMiddleW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[2], _BmpRightW, _BmpH);