Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8231


Ignore:
Timestamp:
Apr 11, 2011, 6:39:04 AM (13 years ago)
Author:
rgrieder
Message:

Attempt to fix Ogre plugins for Orxonox installations on Windows.

Location:
code/branches/kicklib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/SpecialConfig.h.in

    r8071 r8231  
    9292
    9393    // OGRE PLUGINS
    94     // Apple has trouble finding OGRE plugins because of its install-name convention
    95     // Adopting the executable_path structure for later use in app bundles
    9694#ifdef NDEBUG
    9795    const char ogrePlugins[] = "@OGRE_PLUGINS_RELEASE@";
    98 #  ifdef DEPENDENCY_PACKAGE_ENABLE
    99 #    ifdef ORXONOX_PLATFORM_APPLE
    100        const char ogrePluginsDirectory[] = "@executable_path/../Plugins";
    101 #    else
    102        const char ogrePluginsDirectory[] = ".";
    103 #    endif
    104 #  else
    10596    const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";
    106 #  endif
    10797#else
    10898    const char ogrePlugins[] = "@OGRE_PLUGINS_DEBUG@";
    109 #  ifdef DEPENDENCY_PACKAGE_ENABLE
    110 #    ifdef ORXONOX_PLATFORM_APPLE
    111        const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
    112 #    else
    113        const char ogrePluginsDirectory[] = ".";
    114 #    endif
    115 #  else
    11699    const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
    117 #  endif
    118100#endif
    119101} }
  • code/branches/kicklib/src/libraries/core/GraphicsManager.cc

    r8225 r8231  
    3030#include "GraphicsManager.h"
    3131
     32#include <cstdlib>
    3233#include <fstream>
    3334#include <sstream>
     
    6162#include "command/ConsoleCommand.h"
    6263
    63 // Differentiate Boost Filesystem v2 and v3
    64 #if (BOOST_FILESYSTEM_VERSION < 3)
    65 #  define BF_NATIVE_STRING file_string
    66 #else
    67 #  define BF_NATIVE_STRING string
    68 #endif
    69 
    7064namespace orxonox
    7165{
     
    148142        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
    149143            .description("Location of the Ogre config file");
    150         SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)
    151             .description("Folder where the Ogre plugins are located.");
    152144        SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins)
    153145            .description("Comma separated list of all plugins to load.");
     
    241233    void GraphicsManager::loadOgrePlugins()
    242234    {
    243         // just to make sure the next statement doesn't segfault
    244         if (ogrePluginsDirectory_.empty())
    245             ogrePluginsDirectory_ = '.';
    246 
    247         boost::filesystem::path folder(ogrePluginsDirectory_);
     235        // Plugin path can have many different locations...
     236        std::string pluginPath = specialConfig::ogrePluginsDirectory;
     237#ifdef DEPENDENCY_PACKAGE_ENABLE
     238        if (!PathConfig::isDevelopmentRun())
     239        {
     240#  if defined(ORXONOX_PLATFORM_WINDOWS)
     241            pluginPath = PathConfig::getExecutablePathString();
     242#  elif defined(ORXONOX_PLATFORM_APPLE)
     243            // TODO: Where are the plugins being installed to?
     244            pluginPath = PathConfig::getExecutablePathString();
     245#  endif
     246        }
     247#endif
     248
     249        // Add OGRE plugin path to the environment. That way one plugin could
     250        // also depend on another without problems on Windows
     251        std::string pathVariable(getenv("PATH"));
     252        putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + pluginPath).c_str()));
     253
    248254        // Do some SubString magic to get the comma separated list of plugins
    249255        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0');
    250         // Use backslash paths on Windows! file_string() already does that though.
    251256        for (unsigned int i = 0; i < plugins.size(); ++i)
    252             ogreRoot_->loadPlugin((folder / plugins[i]).BF_NATIVE_STRING());
     257            ogreRoot_->loadPlugin(plugins[i]);
    253258    }
    254259
  • code/branches/kicklib/src/libraries/core/GraphicsManager.h

    r7948 r8231  
    110110        // config values
    111111        std::string         ogreConfigFile_;           //!< ogre config filename
    112         std::string         ogrePluginsDirectory_;     //!< Directory where the Ogre plugins are located
    113112        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
    114113        std::string         ogreLogFile_;              //!< log filename for Ogre log messages
Note: See TracChangeset for help on using the changeset viewer.