From 9497d75cc9e5c2d409dff4d44f01d46e888cc8e0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 20 May 2007 12:29:11 +0000 Subject: [PATCH] Added support for version of the osgPlugins directory, which now gets versioned according to the OpenSceneGraph/CMakeLists.txt and the include/osg/Version settings. These changes mean that the 1.9.5 release will have a libs/osgPlugins-1.9.5 directory. --- CMakeLists.txt | 7 ++++--- CMakeModules/OsgMacroUtils.cmake | 4 ++-- src/osgDB/FileUtils.cpp | 6 +++++- src/osgPlugins/CMakeLists.txt | 2 +- src/osgWrappers/CMakeLists.txt | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 497b8802f..b11264d04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ SET(OPENSCENEGRAPH_MAJOR_VERSION 1) SET(OPENSCENEGRAPH_MINOR_VERSION 9) SET(OPENSCENEGRAPH_PATCH_VERSION 4) +SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}) + SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR}) # We have some custom .cmake scripts not in the official distribution. @@ -176,12 +178,11 @@ ELSE(NOT APPLE) FIND_PACKAGE(QuickTime) ENDIF(NOT APPLE) - ################################################################################ # Create bin and lib directories if required IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/osgPlugins) + FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/${OSG_PLUGINS}) ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") @@ -208,7 +209,7 @@ SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR}) #SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}) SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib) MAKE_DIRECTORY(${OUTPUT_LIBDIR}) -MAKE_DIRECTORY(${OUTPUT_LIBDIR}/osgPlugins) +MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS}) SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR}) diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake index 86759d8c2..e380a4934 100644 --- a/CMakeModules/OsgMacroUtils.cmake +++ b/CMakeModules/OsgMacroUtils.cmake @@ -121,11 +121,11 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) SETUP_LINK_LIBRARIES() -#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/osgPlugins +#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS} IF(WIN32) INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION bin ) ELSE(WIN32) - INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/osgPlugins LIBRARY DESTINATION lib${LIB_POSTFIX}/osgPlugins ) + INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} ) ENDIF(WIN32) ENDMACRO(SETUP_PLUGIN) diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp index b78f35b24..173ebe273 100644 --- a/src/osgDB/FileUtils.cpp +++ b/src/osgDB/FileUtils.cpp @@ -65,6 +65,7 @@ #endif #include +#include #include #include @@ -73,6 +74,9 @@ #include #include + +const std::string OSG_PLUGINS(std::string("osgPlugins-")+std::string(osgGetVersion())+std::string("/")); + bool osgDB::makeDirectory( const std::string &path ) { if (path.empty()) @@ -315,7 +319,7 @@ std::string osgDB::findLibraryFile(const std::string& filename,CaseSensitivity c // failed with direct paths, // now try prepending the filename with "osgPlugins/" - return findFileInPath("osgPlugins/"+simpleFileName,filepath,caseSensitivity); + return findFileInPath(OSG_PLUGINS+simpleFileName,filepath,caseSensitivity); } std::string osgDB::findFileInDirectory(const std::string& fileName,const std::string& dirName,CaseSensitivity caseSensitivity) diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt index 69086eafa..ffbda2154 100644 --- a/src/osgPlugins/CMakeLists.txt +++ b/src/osgPlugins/CMakeLists.txt @@ -7,7 +7,7 @@ PROJECT(OSG_PLUGINS_MASTER) -SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/osgPlugins") +SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/${OSG_PLUGINS}") OPTION(BUILD_OSG_COMMON_PLUGINS "Build with Common Plugins" TRUE) diff --git a/src/osgWrappers/CMakeLists.txt b/src/osgWrappers/CMakeLists.txt index 4ea6e4208..52791b0de 100644 --- a/src/osgWrappers/CMakeLists.txt +++ b/src/osgWrappers/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(OSG_WRAPPERS) -SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/osgPlugins") +SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/${OSG_PLUGINS}") IF(NOT MINGW) SET(CMAKE_SHARED_MODULE_PREFIX "") @@ -78,7 +78,7 @@ MACRO(ADD_WRAPPER_LIB SUBDIR EXPORTDEF) IF(WIN32) INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION bin ) ELSE(WIN32) - INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/osgPlugins LIBRARY DESTINATION lib${LIB_POSTFIX}/osgPlugins ) + INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} ) ENDIF(WIN32) ENDMACRO(ADD_WRAPPER_LIB)