From 377a5532958d5d4c434c1b268b0bc312e7ad0816 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Sep 2008 18:56:59 +0000 Subject: [PATCH] From Alberto Luaces, "Cygwin's cmake build adds a "d" postfix to the plugins installed in debug mode. Nevertheless, the code doesn't acknowledge that, so I had problems with debug versions of the library not being able to open their plugins whereas the release versions worked fine. I have made the same changes in Registry.cpp that are available for the rest of platforms appending that "d" to their plugins. I have also updated the CMakeLists.txt file to get "_DEBUG" defined at compilation time. I have copied the already existent conditional block because of cmake's bizarre operator precedence. Since Cygwin defines both CYGWIN and WIN32, the following would suffice: IF(CYGWIN OR UNIX AND NOT WIN32 AND NOT APPLE) Sadly, it actually doesn't work, so I wrote a new conditional block just for Cygwin. I could join the two blocks when the parentheses support is added in newer versions of cmake." --- CMakeLists.txt | 5 +++++ src/osgDB/Registry.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb65fea65..a7a0219d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -435,6 +435,11 @@ IF(UNIX AND NOT WIN32 AND NOT APPLE) ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") ENDIF(UNIX AND NOT WIN32 AND NOT APPLE) +IF(CYGWIN) + IF(CMAKE_BUILD_TYPE STREQUAL "Debug") + ADD_DEFINITIONS("-D_DEBUG") + ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") +ENDIF(CYGWIN) IF(UNIX AND NOT WIN32 AND NOT APPLE) IF(CMAKE_SIZEOF_VOID_P MATCHES "8") diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 56a6dc23b..62d3ac393 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -622,7 +622,11 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext) #endif #if defined(__CYGWIN__) - return prepend+"cygwin_"+"osgdb_"+lowercase_ext+".dll"; + #ifdef _DEBUG + return prepend+"cygwin_"+"osgdb_"+lowercase_ext+OSG_DEBUG_POSTFIX+".dll"; + #else + return prepend+"cygwin_"+"osgdb_"+lowercase_ext+".dll"; + #endif #elif defined(__MINGW32__) return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll"; #elif defined(WIN32)