From Mathieu Marache,

first post:

"I had the problem that debug and release version of the plugins had the same name under linux. These minors modification to Registry and the CMake support files enable to have both Release and Debug version of the plugins to coexist and be found by there respective runtimes."

follow up post:

"I've gone ahead and added a preprocessor directive with the editable CMAKE_DEBUG_POSTFIX. I modified Registry.cpp to take this new preprocessor directive called OSG_DEBUG_POSTFIX while looking for libraries in Debug mode for the windows (msvc) and the linux platforms.

MinGW, cygwin and Apple are still left out this proposal."


Notes from Robert Osfield, completed the work in change d entries to use OSG_DEBUG_POSTFIX
This commit is contained in:
Robert Osfield 2008-05-28 12:49:47 +00:00
parent e68e474c90
commit 712b6cb2d9
3 changed files with 26 additions and 5 deletions

View File

@ -344,6 +344,13 @@ ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
# Installation stuff
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
ADD_DEFINITIONS("-DOSG_DEBUG_POSTFIX='\"${CMAKE_DEBUG_POSTFIX}\"'")
IF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS("-D_DEBUG")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CMAKE_SIZEOF_VOID_P MATCHES "8")

View File

@ -145,7 +145,9 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
#not sure if needed, but for plugins only Msvc need the d suffix
IF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
IF(NOT UNIX)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
ENDIF(NOT UNIX)
ELSE(NOT MSVC)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(NOT MSVC_IDE)

View File

@ -39,6 +39,9 @@
using std::tolower;
#endif
#ifndef OSG_DEBUG_POSTFIX
#define OSG_DEBUG_POSTFIX "d"
#endif
using namespace osg;
using namespace osgDB;
@ -603,7 +606,7 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext)
return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll";
#elif defined(WIN32)
#ifdef _DEBUG
return prepend+"osgdb_"+lowercase_ext+"d.dll";
return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX +".dll";
#else
return prepend+"osgdb_"+lowercase_ext+".dll";
#endif
@ -613,7 +616,12 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext)
// why don't we use PLUGIN_EXT from the makefiles here?
return prepend+"osgdb_"+lowercase_ext+".sl";
#else
return prepend+"osgdb_"+lowercase_ext+".so";
#ifdef _DEBUG
#pragma message(OSG_DEBUG_POSTFIX)
return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX + ".so";
#else
return prepend+"osgdb_"+lowercase_ext+".so";
#endif
#endif
}
@ -626,7 +634,7 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name)
return "lib"+name+".dll";
#elif defined(WIN32)
#ifdef _DEBUG
return name+"d.dll";
return name+OSG_DEBUG_POSTFIX +".dll";
#else
return name+".dll";
#endif
@ -636,7 +644,11 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name)
// why don't we use PLUGIN_EXT from the makefiles here?
return "lib"+name+".sl";
#else
return "lib"+name+".so";
#ifdef _DEBUG
return "lib"+name+OSG_DEBUG_POSTFIX +".so";
#else
return "lib"+name+".so";
#endif
#endif
}