Changeset 11197

Show
Ignore:
Timestamp:
03/10/10 18:19:35 (5 years ago)
Author:
robert
Message:

From David Fries,"We are needing to compile Debug, Release, and MinSizeWithDebInfo?, but
currently only Debug appends "d" so the Release and MinSizeWithDebInfo?
(and MinSizeRel?) all produce the same filenames. This set of changes
lets each build type have a cmake defined string appended, defaulting
to Release none, Debug d, RelWithDebInfo? rd, MinSizeRel? s. But a user
still can have Release, RelWithDebInfo?, and MinSizeRel? to produce the
same filenames. It does so by setting the preprocessor define
OSG_LIBRARY_POSTFIX in src/osgDB/CMakeLists.txt to one of the
previously defined cmake variables CMAKE_DEBUG_POSTFIX
CMAKE_RELEASE_POSTFIX CMAKE_RELWITHDEBINFO_POSTFIX
CMAKE_MINSIZEREL_POSTFIX. This method cuts down on the #ifdef _DEBUG
#else preprocessor directives in Registry.cpp as the extension is
always passed in OSG_LIBRARY_POSTFIX. That and MINGW32 didn't
have the _DEBUG check which looks like a bug."

Location:
OpenSceneGraph/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeLists.txt

    r11192 r11197  
    509509 
    510510SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") 
    511 ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX}) 
     511SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") 
     512SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows") 
     513SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows") 
    512514 
    513515IF(UNIX AND NOT WIN32) 
  • OpenSceneGraph/trunk/CMakeModules/FindOSG.cmake

    r10802 r11197  
    6262     
    6363    FIND_LIBRARY(${MYLIBRARY} 
    64         NAMES ${MYLIBRARYNAME} 
     64        NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}" 
    6565        PATHS 
    6666        ${OSG_DIR}/lib/Release 
     
    8282 
    8383    FIND_LIBRARY(${MYLIBRARY} 
    84         NAMES ${MYLIBRARYNAME} 
     84        NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}" 
    8585        PATHS 
    8686        ~/Library/Frameworks 
  • OpenSceneGraph/trunk/CMakeModules/OsgMacroUtils.cmake

    r11162 r11197  
    55#  NAME of the variables, so the macro gets as arguments the target name and the following list of parameters 
    66#  is intended as a list of variable names each one containing  the path of the libraries to link to 
    7 #  The existance of a varibale name with _DEBUG appended is tested and, in case it' s value is used 
     7#  The existance of a variable name with _DEBUG appended is tested and, in case it' s value is used 
    88#  for linking to when in debug mode  
    99#  the content of this library for linking when in debugging 
     
    3131                # so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies 
    3232                #to library targets used 
    33                 TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib") 
     33                TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_RELEASE_POSTFIX}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib") 
    3434                ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB}) 
    3535            ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL) 
    36                 TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}") 
     36                TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}${CMAKE_RELEASE_POSTFIX}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}") 
    3737            ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL) 
    3838        ENDFOREACH(LINKLIB) 
     
    268268 
    269269    SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}") 
    270     SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") 
    271270    SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME}) 
     271    SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_OUTPUT_NAME "${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}") 
     272    SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELEASE_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELEASE_POSTFIX}") 
     273    SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELWITHDEBINFO_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}") 
     274    SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES MINSIZEREL_OUTPUT_NAME "${TARGET_NAME}${CMAKE_MINSIZEREL_POSTFIX}") 
    272275 
    273276    IF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL) 
  • OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt

    r11055 r11197  
    1111    ENDIF() 
    1212 
     13    # Set the library extension according to what configuration is being built. 
     14    # If the string is empty, don't set the define. 
     15    IF(CMAKE_DEBUG_POSTFIX) 
     16        SET(CMAKE_CXX_FLAGS_DEBUG 
     17            "${CMAKE_CXX_FLAGS_DEBUG} -DOSG_LIBRARY_POSTFIX=${CMAKE_DEBUG_POSTFIX}") 
     18    ENDIF() 
     19    IF(CMAKE_RELEASE_POSTFIX) 
     20        SET(CMAKE_CXX_FLAGS_RELEASE 
     21            "${CMAKE_CXX_FLAGS_RELEASE} -DOSG_LIBRARY_POSTFIX=${CMAKE_RELEASE_POSTFIX}") 
     22    ENDIF() 
     23    IF(CMAKE_RELWITHDEBINFO_POSTFIX) 
     24        SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO 
     25            "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DOSG_LIBRARY_POSTFIX=${CMAKE_RELWITHDEBINFO_POSTFIX}") 
     26    ENDIF() 
     27    IF(CMAKE_MINSIZEREL_POSTFIX) 
     28        SET(CMAKE_CXX_FLAGS_MINSIZEREL 
     29            "${CMAKE_CXX_FLAGS_MINSIZEREL} -DOSG_LIBRARY_POSTFIX=${CMAKE_MINSIZEREL_POSTFIX}") 
     30    ENDIF() 
    1331ELSE () 
    1432    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) 
  • OpenSceneGraph/trunk/src/osgDB/Registry.cpp

    r11046 r11197  
    4444#endif 
    4545 
    46 #ifdef OSG_DEBUG_POSTFIX 
    47     #define OSG_DEBUG_POSTFIX_WITH_QUOTES ADDQUOTES(OSG_DEBUG_POSTFIX) 
     46#ifdef OSG_LIBRARY_POSTFIX 
     47    #define OSG_LIBRARY_POSTFIX_WITH_QUOTES ADDQUOTES(OSG_LIBRARY_POSTFIX) 
    4848#else 
    49     #define OSG_DEBUG_POSTFIX_WITH_QUOTES "d" 
     49    #define OSG_LIBRARY_POSTFIX_WITH_QUOTES "" 
    5050#endif 
    5151 
     
    609609 
    610610#if defined(__CYGWIN__) 
    611     #ifdef _DEBUG 
    612         return prepend+"cygwin_"+"osgdb_"+lowercase_ext+OSG_DEBUG_POSTFIX_WITH_QUOTES+".dll"; 
    613     #else 
    614         return prepend+"cygwin_"+"osgdb_"+lowercase_ext+".dll"; 
    615     #endif 
     611    return prepend+"cygwin_"+"osgdb_"+lowercase_ext+OSG_LIBRARY_POSTFIX_WITH_QUOTES+".dll"; 
    616612#elif defined(__MINGW32__) 
    617     return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll"; 
     613    return prepend+"mingw_"+"osgdb_"+lowercase_ext+OSG_LIBRARY_POSTFIX_WITH_QUOTES+".dll"; 
    618614#elif defined(WIN32) 
    619     #ifdef _DEBUG 
    620         return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES +".dll"; 
    621     #else 
    622         return prepend+"osgdb_"+lowercase_ext+".dll"; 
    623     #endif 
     615    return prepend+"osgdb_"+lowercase_ext+OSG_LIBRARY_POSTFIX_WITH_QUOTES+".dll"; 
    624616#elif macintosh 
    625     #ifdef _DEBUG 
    626         return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES; 
    627     #else 
    628         return prepend+"osgdb_"+lowercase_ext; 
    629     #endif 
     617    return prepend+"osgdb_"+lowercase_ext+OSG_LIBRARY_POSTFIX_WITH_QUOTES; 
    630618#else 
    631     #ifdef _DEBUG 
    632          return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES + ADDQUOTES(OSG_PLUGIN_EXTENSION); 
    633     #else 
    634          return prepend+"osgdb_"+lowercase_ext+ADDQUOTES(OSG_PLUGIN_EXTENSION); 
    635     #endif 
     619    return prepend+"osgdb_"+lowercase_ext+OSG_LIBRARY_POSTFIX_WITH_QUOTES+ADDQUOTES(OSG_PLUGIN_EXTENSION); 
    636620#endif 
    637621 
     
    641625{ 
    642626#if defined(__CYGWIN__) 
    643     return "cyg"+name+".dll"; 
     627    return "cyg"+name+OSG_LIBRARY_POSTFIX_WITH_QUOTES+".dll"; 
    644628#elif defined(__MINGW32__) 
    645     return "lib"+name+".dll"; 
     629    return "lib"+name+OSG_LIBRARY_POSTFIX_WITH_QUOTES+".dll"; 
    646630#elif defined(WIN32) 
    647     #ifdef _DEBUG 
    648         return name+OSG_DEBUG_POSTFIX_WITH_QUOTES +".dll"; 
    649     #else 
    650         return name+".dll"; 
    651     #endif 
     631    return name+OSG_LIBRARY_POSTFIX_WITH_QUOTES+".dll"; 
    652632#elif macintosh 
    653     #ifdef _DEBUG 
    654         return name+OSGDEBUG_POSTFIX_WITH_QUOTES; 
    655     #else 
    656         return name; 
    657     #endif 
     633    return name+OSG_LIBRARY_POSTFIX_WITH_QUOTES; 
    658634#else 
    659     #ifdef _DEBUG 
    660         return "lib"+name+OSG_DEBUG_POSTFIX_WITH_QUOTES + ADDQUOTES(OSG_PLUGIN_EXTENSION); 
    661     #else 
    662         return "lib"+name+ADDQUOTES(OSG_PLUGIN_EXTENSION); 
    663     #endif 
     635    return "lib"+name+OSG_LIBRARY_POSTFIX_WITH_QUOTES + ADDQUOTES(OSG_PLUGIN_EXTENSION); 
    664636#endif 
    665637}