From 94ce95c679d111a69d6cc5e6f4126c8b64feabb8 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 25 Jul 2012 00:13:33 +0400 Subject: [PATCH 01/14] bug #348: works again on OS X --- CMakeLists.txt | 59 +++++++++++++++---------------- apps/launcher/graphicspage.cpp | 8 +++-- libs/openengine/ogre/renderer.cpp | 12 +++++-- 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f124f1383..05c53e6d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,13 +227,41 @@ if (APPLE) ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} ${OGRE_Plugin_CgProgramManager_LIBRARY_REL} ${OGRE_Plugin_ParticleFX_LIBRARY_REL}) + + if (${OGRE_PLUGIN_DIR_REL}}) + set(OGRE_PLUGINS_REL_FOUND TRUE) + endif () + + if (${OGRE_PLUGIN_DIR_DBG}) + set(OGRE_PLUGINS_DBG_FOUND TRUE) + endif () + + if (${OGRE_PLUGINS_REL_FOUND}) + set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL}) + else () + set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG}) + endif () + + set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/") + +# set(OGRE_PLUGIN_DIR_2 ${OGRE_PLUGIN_DIR}) +# set(OGRE_PLUGIN_DIR "") +# set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_2}) + + configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist + "${APP_BUNDLE_DIR}/Contents/Info.plist") + + configure_file(${OpenMW_SOURCE_DIR}/files/mac/openmw.icns + "${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY) endif (APPLE) # Set up Ogre plugin folder & debug suffix set(DEBUG_SUFFIX "") +add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="") if (DEFINED CMAKE_BUILD_TYPE) - if (CMAKE_BUILD_TYPE STREQUAL "Debug") + # Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT APPLE) set(DEBUG_SUFFIX "_d") add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d") else() @@ -275,35 +303,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") "${OpenMW_BINARY_DIR}/openmw.desktop") endif() -if (APPLE) - if (${OGRE_PLUGIN_DIR_REL}}) - set(OGRE_PLUGINS_REL_FOUND TRUE) - endif () - - if (${OGRE_PLUGIN_DIR_DBG}) - set(OGRE_PLUGINS_DBG_FOUND TRUE) - endif () - - if (${OGRE_PLUGINS_REL_FOUND}) - set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL}) - else () - set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG}) - endif () - - set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/") - - set(OGRE_PLUGIN_DIR_2 ${OGRE_PLUGIN_DIR}) - set(OGRE_PLUGIN_DIR "") - set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_2}) - - configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist - "${APP_BUNDLE_DIR}/Contents/Info.plist") - - configure_file(${OpenMW_SOURCE_DIR}/files/mac/openmw.icns - "${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY) -endif (APPLE) - - # Compiler settings if (CMAKE_COMPILER_IS_GNUCC) add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-reorder) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 3c1d76f3d..296ef2c3e 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -116,11 +116,15 @@ bool GraphicsPage::setupOgre() } std::string glPlugin = std::string(pluginDir) + "/RenderSystem_GL" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(glPlugin + ".so") || boost::filesystem::exists(glPlugin + ".dll")) + if (boost::filesystem::exists(glPlugin + ".so") || + boost::filesystem::exists(glPlugin + ".dll") || + boost::filesystem::exists(glPlugin + ".dylib")) mOgre->loadPlugin (glPlugin); std::string dxPlugin = std::string(pluginDir) + "/RenderSystem_Direct3D9" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(dxPlugin + ".so") || boost::filesystem::exists(dxPlugin + ".dll")) + if (boost::filesystem::exists(dxPlugin + ".so") || + boost::filesystem::exists(dxPlugin + ".dll") || + boost::filesystem::exists(dxPlugin + ".dylib")) mOgre->loadPlugin (dxPlugin); #ifdef ENABLE_PLUGIN_GL diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index e40bdf708..58b363f7f 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -112,15 +112,21 @@ void OgreRenderer::configure(const std::string &logPath, } std::string glPlugin = std::string(pluginDir) + "/RenderSystem_GL" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(glPlugin + ".so") || boost::filesystem::exists(glPlugin + ".dll")) + if (boost::filesystem::exists(glPlugin + ".so") || + boost::filesystem::exists(glPlugin + ".dll") || + boost::filesystem::exists(glPlugin + ".dylib")) mRoot->loadPlugin (glPlugin); std::string dxPlugin = std::string(pluginDir) + "/RenderSystem_Direct3D9" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(dxPlugin + ".so") || boost::filesystem::exists(dxPlugin + ".dll")) + if (boost::filesystem::exists(dxPlugin + ".so") || + boost::filesystem::exists(dxPlugin + ".dll") || + boost::filesystem::exists(dxPlugin + ".dylib")) mRoot->loadPlugin (dxPlugin); std::string cgPlugin = std::string(pluginDir) + "/Plugin_CgProgramManager" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(cgPlugin + ".so") || boost::filesystem::exists(cgPlugin + ".dll")) + if (boost::filesystem::exists(cgPlugin + ".so") || + boost::filesystem::exists(cgPlugin + ".dll") || + boost::filesystem::exists(cgPlugin + ".dylib")) mRoot->loadPlugin (cgPlugin); RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem); From fbe9a94568d60b9742ab9216d803de18f2912625 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 01:53:50 +0400 Subject: [PATCH 02/14] bug #348: fixed OS X deployment just enable CMake option "OPENMW_OSX_DEPLOYMENT" and it will search plugins inside application bundle instead of Ogre prefix --- CMakeLists.txt | 17 +++++++------ apps/launcher/graphicspage.cpp | 17 ++++++------- components/CMakeLists.txt | 4 +++ components/ogreplugin/ogreplugin.cpp | 37 ++++++++++++++++++++++++++++ components/ogreplugin/ogreplugin.h | 12 +++++++++ libs/openengine/ogre/renderer.cpp | 23 ++++++----------- 6 files changed, 78 insertions(+), 32 deletions(-) create mode 100644 components/ogreplugin/ogreplugin.cpp create mode 100644 components/ogreplugin/ogreplugin.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 05c53e6d6..0bc6344c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,9 @@ option(USE_FFMPEG "use ffmpeg for sound" OFF) option(USE_AUDIERE "use audiere for sound" OFF) option(USE_MPG123 "use mpg123 + libsndfile for sound" ON) +# OS X deployment +option(OPENMW_OSX_DEPLOYMENT OFF) + find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems") # Location of morrowind data files @@ -241,12 +244,8 @@ if (APPLE) else () set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG}) endif () - - set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/") - -# set(OGRE_PLUGIN_DIR_2 ${OGRE_PLUGIN_DIR}) -# set(OGRE_PLUGIN_DIR "") -# set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_2}) + + #set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/") configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist "${APP_BUNDLE_DIR}/Contents/Info.plist") @@ -270,7 +269,11 @@ if (DEFINED CMAKE_BUILD_TYPE) endif() add_definitions(-DOGRE_PLUGIN_DIR_REL="${OGRE_PLUGIN_DIR_REL}") add_definitions(-DOGRE_PLUGIN_DIR_DBG="${OGRE_PLUGIN_DIR_DBG}") -add_definitions(-DOGRE_PLUGIN_DIR="${OGRE_PLUGIN_DIR}") +if (APPLE AND OPENMW_OSX_DEPLOYMENT) + add_definitions(-DOGRE_PLUGIN_DIR="${APP_BUNDLE_NAME}/Contents/Plugins") +else() + add_definitions(-DOGRE_PLUGIN_DIR="${OGRE_PLUGIN_DIR}") +endif() add_subdirectory(files/) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 296ef2c3e..f9f5c6dda 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -7,6 +7,7 @@ #include #include +#include #include "graphicspage.hpp" #include "naturalsort.hpp" @@ -115,17 +116,13 @@ bool GraphicsPage::setupOgre() #endif } - std::string glPlugin = std::string(pluginDir) + "/RenderSystem_GL" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(glPlugin + ".so") || - boost::filesystem::exists(glPlugin + ".dll") || - boost::filesystem::exists(glPlugin + ".dylib")) - mOgre->loadPlugin (glPlugin); + boost::filesystem::path absPluginPath = boost::filesystem::absolute(boost::filesystem::path(pluginDir)); - std::string dxPlugin = std::string(pluginDir) + "/RenderSystem_Direct3D9" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(dxPlugin + ".so") || - boost::filesystem::exists(dxPlugin + ".dll") || - boost::filesystem::exists(dxPlugin + ".dylib")) - mOgre->loadPlugin (dxPlugin); + pluginDir = absPluginPath.string(); + + loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre); + loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mOgre); + loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre); #ifdef ENABLE_PLUGIN_GL mGLPlugin = new Ogre::GLPlugin(); diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index efeb69cae..e16a860c4 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -66,6 +66,10 @@ add_component_dir (interpreter miscopcodes opcodes runtime scriptopcodes spatialopcodes types ) +add_component_dir (ogreplugin + ogreplugin +) + include_directories(${BULLET_INCLUDE_DIRS}) add_library(components STATIC ${COMPONENT_FILES}) diff --git a/components/ogreplugin/ogreplugin.cpp b/components/ogreplugin/ogreplugin.cpp new file mode 100644 index 000000000..5516482aa --- /dev/null +++ b/components/ogreplugin/ogreplugin.cpp @@ -0,0 +1,37 @@ +#include "ogreplugin.h" + +#include +#include + +#include + +bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot) { +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE + std::ostringstream verStream; + verStream << "." << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "." << OGRE_VERSION_PATCH; + pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX + verStream.str(); +#endif + + std::string pluginExt; +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 + pluginExt = ".dll"; +#endif +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE + pluginExt = ".dylib"; +#endif +#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX + pluginExt = ".so"; +#endif + + std::string pluginPath = pluginDir + "/" + pluginName + pluginExt; + + std::cout << "loading plugin: " << pluginPath << std::endl; + + if (boost::filesystem::exists(pluginPath)) { + ogreRoot.loadPlugin(pluginPath); + return true; + } + else { + return false; + } +} \ No newline at end of file diff --git a/components/ogreplugin/ogreplugin.h b/components/ogreplugin/ogreplugin.h new file mode 100644 index 000000000..bb1ea04e1 --- /dev/null +++ b/components/ogreplugin/ogreplugin.h @@ -0,0 +1,12 @@ +#ifndef OGREPLUGIN_H +#define OGREPLUGIN_H + +#include + +namespace Ogre { + class Root; +} + +extern bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot); + +#endif \ No newline at end of file diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index 58b363f7f..20bb1f40f 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -11,6 +11,8 @@ #include +#include + #include #include #include @@ -94,6 +96,7 @@ void OgreRenderer::configure(const std::string &logPath, loadPlugins(); #endif + std::cout << "current path is: " << boost::filesystem::current_path() << std::endl; std::string pluginDir; const char* pluginEnv = getenv("OPENMW_OGRE_PLUGIN_DIR"); if (pluginEnv) @@ -111,23 +114,13 @@ void OgreRenderer::configure(const std::string &logPath, #endif } - std::string glPlugin = std::string(pluginDir) + "/RenderSystem_GL" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(glPlugin + ".so") || - boost::filesystem::exists(glPlugin + ".dll") || - boost::filesystem::exists(glPlugin + ".dylib")) - mRoot->loadPlugin (glPlugin); + boost::filesystem::path absPluginPath = boost::filesystem::absolute(boost::filesystem::path(pluginDir)); - std::string dxPlugin = std::string(pluginDir) + "/RenderSystem_Direct3D9" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(dxPlugin + ".so") || - boost::filesystem::exists(dxPlugin + ".dll") || - boost::filesystem::exists(dxPlugin + ".dylib")) - mRoot->loadPlugin (dxPlugin); + pluginDir = absPluginPath.string(); - std::string cgPlugin = std::string(pluginDir) + "/Plugin_CgProgramManager" + OGRE_PLUGIN_DEBUG_SUFFIX; - if (boost::filesystem::exists(cgPlugin + ".so") || - boost::filesystem::exists(cgPlugin + ".dll") || - boost::filesystem::exists(cgPlugin + ".dylib")) - mRoot->loadPlugin (cgPlugin); + loadOgrePlugin(pluginDir, "RenderSystem_GL", *mRoot); + loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mRoot); + loadOgrePlugin(pluginDir, "Plugin_CgProgramManager", *mRoot); RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem); if (rs == 0) From e9d4195500287266ee9a6e78006dae4141e3d7ea Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:03:34 +0400 Subject: [PATCH 03/14] removed cout spam --- libs/openengine/ogre/renderer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index 20bb1f40f..f8fed3899 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -96,7 +96,6 @@ void OgreRenderer::configure(const std::string &logPath, loadPlugins(); #endif - std::cout << "current path is: " << boost::filesystem::current_path() << std::endl; std::string pluginDir; const char* pluginEnv = getenv("OPENMW_OGRE_PLUGIN_DIR"); if (pluginEnv) From 0cdb651c5ece1bf5aebf55b9cd8d14ec1fbaf0b4 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:05:06 +0400 Subject: [PATCH 04/14] removed excess invocation --- apps/launcher/graphicspage.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index f9f5c6dda..7d25f2df1 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -122,7 +122,6 @@ bool GraphicsPage::setupOgre() loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre); loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mOgre); - loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre); #ifdef ENABLE_PLUGIN_GL mGLPlugin = new Ogre::GLPlugin(); From a0a086f69d7ea7feb35452b3475d96435126a8e7 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:11:14 +0400 Subject: [PATCH 05/14] fixed redefining macro --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bc6344c4..cbb895760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,8 +263,6 @@ if (DEFINED CMAKE_BUILD_TYPE) if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT APPLE) set(DEBUG_SUFFIX "_d") add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d") - else() - add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="") endif() endif() add_definitions(-DOGRE_PLUGIN_DIR_REL="${OGRE_PLUGIN_DIR_REL}") From 23e44a86c6c7be2b6373df3a0f0afefef8ec7ca7 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:13:57 +0400 Subject: [PATCH 06/14] another attempt to fix --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbb895760..b51ea68ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,12 +257,13 @@ endif (APPLE) # Set up Ogre plugin folder & debug suffix set(DEBUG_SUFFIX "") -add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="") if (DEFINED CMAKE_BUILD_TYPE) # Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt) if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT APPLE) set(DEBUG_SUFFIX "_d") add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d") + else() + add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="") endif() endif() add_definitions(-DOGRE_PLUGIN_DIR_REL="${OGRE_PLUGIN_DIR_REL}") From b0b206423285180f0e84a0a2214ccb84d339de43 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:31:30 +0400 Subject: [PATCH 07/14] always add debug suffix in plugin loader also removed cout spam --- components/ogreplugin/ogreplugin.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/ogreplugin/ogreplugin.cpp b/components/ogreplugin/ogreplugin.cpp index 5516482aa..ce61f344d 100644 --- a/components/ogreplugin/ogreplugin.cpp +++ b/components/ogreplugin/ogreplugin.cpp @@ -6,10 +6,11 @@ #include bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot) { + pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX; #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE std::ostringstream verStream; verStream << "." << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "." << OGRE_VERSION_PATCH; - pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX + verStream.str(); + pluginName = pluginName + verStream.str(); #endif std::string pluginExt; @@ -24,9 +25,6 @@ bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &o #endif std::string pluginPath = pluginDir + "/" + pluginName + pluginExt; - - std::cout << "loading plugin: " << pluginPath << std::endl; - if (boost::filesystem::exists(pluginPath)) { ogreRoot.loadPlugin(pluginPath); return true; From 7161361b520fdb895ba42270613e00c3c4457e68 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:38:37 +0400 Subject: [PATCH 08/14] cleanup --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b51ea68ea..f2decb8f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,11 +256,9 @@ endif (APPLE) # Set up Ogre plugin folder & debug suffix -set(DEBUG_SUFFIX "") if (DEFINED CMAKE_BUILD_TYPE) # Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt) if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT APPLE) - set(DEBUG_SUFFIX "_d") add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d") else() add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="") From a84d8e83cd04e7bfaa25ec7b0e566ef9b0026bd2 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 28 Jul 2012 02:39:49 +0400 Subject: [PATCH 09/14] add const specifier to first argument, also made it reference --- components/ogreplugin/ogreplugin.cpp | 2 +- components/ogreplugin/ogreplugin.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ogreplugin/ogreplugin.cpp b/components/ogreplugin/ogreplugin.cpp index ce61f344d..329cd1ea9 100644 --- a/components/ogreplugin/ogreplugin.cpp +++ b/components/ogreplugin/ogreplugin.cpp @@ -5,7 +5,7 @@ #include -bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot) { +bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot) { pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX; #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE std::ostringstream verStream; diff --git a/components/ogreplugin/ogreplugin.h b/components/ogreplugin/ogreplugin.h index bb1ea04e1..d9b00e576 100644 --- a/components/ogreplugin/ogreplugin.h +++ b/components/ogreplugin/ogreplugin.h @@ -7,6 +7,6 @@ namespace Ogre { class Root; } -extern bool loadOgrePlugin(std::string pluginDir, std::string pluginName, Ogre::Root &ogreRoot); +extern bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot); #endif \ No newline at end of file From b05dfeae70302bd4b44d30a16c8beecd81aebc26 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 31 Jul 2012 01:00:53 +0400 Subject: [PATCH 10/14] bug #348: cleanup moved files to appropriate component, moved function to namespace, added docs --- apps/launcher/graphicspage.cpp | 6 +-- components/CMakeLists.txt | 6 +-- .../{ogreplugin => files}/ogreplugin.cpp | 6 ++- components/files/ogreplugin.hpp | 50 +++++++++++++++++++ components/ogreplugin/ogreplugin.h | 12 ----- libs/openengine/ogre/renderer.cpp | 8 +-- 6 files changed, 63 insertions(+), 25 deletions(-) rename components/{ogreplugin => files}/ogreplugin.cpp (95%) create mode 100644 components/files/ogreplugin.hpp delete mode 100644 components/ogreplugin/ogreplugin.h diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 7d25f2df1..c3c39cffc 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -6,8 +6,8 @@ #include #include +#include #include -#include #include "graphicspage.hpp" #include "naturalsort.hpp" @@ -120,8 +120,8 @@ bool GraphicsPage::setupOgre() pluginDir = absPluginPath.string(); - loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre); - loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mOgre); + Files::loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre); + Files::loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mOgre); #ifdef ENABLE_PLUGIN_GL mGLPlugin = new Ogre::GLPlugin(); diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index e16a860c4..c0585d5ee 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -52,7 +52,7 @@ add_component_dir (misc add_component_dir (files linuxpath windowspath macospath fixedpath multidircollection collections fileops configurationmanager - filelibrary + filelibrary ogreplugin ) add_component_dir (compiler @@ -66,10 +66,6 @@ add_component_dir (interpreter miscopcodes opcodes runtime scriptopcodes spatialopcodes types ) -add_component_dir (ogreplugin - ogreplugin -) - include_directories(${BULLET_INCLUDE_DIRS}) add_library(components STATIC ${COMPONENT_FILES}) diff --git a/components/ogreplugin/ogreplugin.cpp b/components/files/ogreplugin.cpp similarity index 95% rename from components/ogreplugin/ogreplugin.cpp rename to components/files/ogreplugin.cpp index 329cd1ea9..d0e80f68d 100644 --- a/components/ogreplugin/ogreplugin.cpp +++ b/components/files/ogreplugin.cpp @@ -1,10 +1,12 @@ -#include "ogreplugin.h" +#include "ogreplugin.hpp" #include #include #include +namespace Files { + bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot) { pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX; #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE @@ -32,4 +34,6 @@ bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre:: else { return false; } +} + } \ No newline at end of file diff --git a/components/files/ogreplugin.hpp b/components/files/ogreplugin.hpp new file mode 100644 index 000000000..a6d2a35c9 --- /dev/null +++ b/components/files/ogreplugin.hpp @@ -0,0 +1,50 @@ +/** + * Open Morrowind - an opensource Elder Scrolls III: Morrowind + * engine implementation. + * + * Copyright (C) 2011 Open Morrowind Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** \file components/files/ogreplugin.hpp */ + +#ifndef COMPONENTS_FILES_OGREPLUGIN_H +#define COMPONENTS_FILES_OGREPLUGIN_H + +#include + +namespace Ogre { + class Root; +} + +/** + * \namespace Files + */ +namespace Files { + +/** + * \brief Loads Ogre plugin with given name. + * + * \param pluginDir absolute path to plugins + * \param pluginName plugin name, for example "RenderSystem_GL" + * \param ogreRoot Ogre::Root instance + * + * \return whether plugin was located or not + */ +bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot); + +} + +#endif /* COMPONENTS_FILES_OGREPLUGIN_H */ \ No newline at end of file diff --git a/components/ogreplugin/ogreplugin.h b/components/ogreplugin/ogreplugin.h deleted file mode 100644 index d9b00e576..000000000 --- a/components/ogreplugin/ogreplugin.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OGREPLUGIN_H -#define OGREPLUGIN_H - -#include - -namespace Ogre { - class Root; -} - -extern bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot); - -#endif \ No newline at end of file diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index f8fed3899..7fff2a8b4 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -11,7 +11,7 @@ #include -#include +#include #include #include @@ -117,9 +117,9 @@ void OgreRenderer::configure(const std::string &logPath, pluginDir = absPluginPath.string(); - loadOgrePlugin(pluginDir, "RenderSystem_GL", *mRoot); - loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mRoot); - loadOgrePlugin(pluginDir, "Plugin_CgProgramManager", *mRoot); + Files::loadOgrePlugin(pluginDir, "RenderSystem_GL", *mRoot); + Files::loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mRoot); + Files::loadOgrePlugin(pluginDir, "Plugin_CgProgramManager", *mRoot); RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem); if (rs == 0) From 03cccee0e4eb7f57a039559308cfe8f25ce5b0f1 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 31 Jul 2012 10:51:34 +0400 Subject: [PATCH 11/14] bug #348: workaround for boost older than 1.44 --- components/files/ogreplugin.cpp | 2 -- components/files/ogreplugin.hpp | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/files/ogreplugin.cpp b/components/files/ogreplugin.cpp index d0e80f68d..c434114b3 100644 --- a/components/files/ogreplugin.cpp +++ b/components/files/ogreplugin.cpp @@ -3,8 +3,6 @@ #include #include -#include - namespace Files { bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot) { diff --git a/components/files/ogreplugin.hpp b/components/files/ogreplugin.hpp index a6d2a35c9..d8469aa4b 100644 --- a/components/files/ogreplugin.hpp +++ b/components/files/ogreplugin.hpp @@ -25,10 +25,25 @@ #include +#include +#include + namespace Ogre { class Root; } +#if (BOOST_VERSION <= 104300) +#error BOOST_VERSION +namespace boost { +namespace filesystem { +path absolute(const path& p, const path& base=current_path()) { + // call obsolete version of this function on older boost + return complete(p, base); +} +} +} +#endif /* (BOOST_VERSION <= 104300) */ + /** * \namespace Files */ From 32d2326b4dddc0420cc5df23a89de17cf76677fa Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 31 Jul 2012 18:15:09 +0400 Subject: [PATCH 12/14] Update components/files/ogreplugin.hpp removed #error directive --- components/files/ogreplugin.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/components/files/ogreplugin.hpp b/components/files/ogreplugin.hpp index d8469aa4b..7a0b5841e 100644 --- a/components/files/ogreplugin.hpp +++ b/components/files/ogreplugin.hpp @@ -33,7 +33,6 @@ namespace Ogre { } #if (BOOST_VERSION <= 104300) -#error BOOST_VERSION namespace boost { namespace filesystem { path absolute(const path& p, const path& base=current_path()) { From 3b776cb3ca5ef6417cb965daf60a95be96c09555 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 1 Aug 2012 00:01:32 +0400 Subject: [PATCH 13/14] fixed submodule version --- extern/shiny | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/shiny b/extern/shiny index 5546a5bd8..164bc8d3b 160000 --- a/extern/shiny +++ b/extern/shiny @@ -1 +1 @@ -Subproject commit 5546a5bd8474ef328dfedae2df42126cdaf9515f +Subproject commit 164bc8d3bfe860bd16ad89c0bd1b59f465c9bb24 From f8e54b401bc0b65a8bda04f0e332775c1f9a81f9 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 1 Aug 2012 09:09:00 +0200 Subject: [PATCH 14/14] fixed linkage problem --- components/files/ogreplugin.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/files/ogreplugin.hpp b/components/files/ogreplugin.hpp index 7a0b5841e..c5292b3a2 100644 --- a/components/files/ogreplugin.hpp +++ b/components/files/ogreplugin.hpp @@ -35,7 +35,7 @@ namespace Ogre { #if (BOOST_VERSION <= 104300) namespace boost { namespace filesystem { -path absolute(const path& p, const path& base=current_path()) { +inline path absolute(const path& p, const path& base=current_path()) { // call obsolete version of this function on older boost return complete(p, base); } @@ -50,7 +50,7 @@ namespace Files { /** * \brief Loads Ogre plugin with given name. - * + * * \param pluginDir absolute path to plugins * \param pluginName plugin name, for example "RenderSystem_GL" * \param ogreRoot Ogre::Root instance @@ -61,4 +61,4 @@ bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre:: } -#endif /* COMPONENTS_FILES_OGREPLUGIN_H */ \ No newline at end of file +#endif /* COMPONENTS_FILES_OGREPLUGIN_H */