Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5625


Ignore:
Timestamp:
Aug 11, 2009, 5:57:18 PM (15 years ago)
Author:
rgrieder
Message:

Added plugin path that gets configured in BuildConfig.cmake and correctly set in Core.

Location:
code/branches/libraries
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/libraries/cmake/BuildConfig.cmake

    r3330 r5625  
    3131SET(DEFAULT_LIBRARY_PATH lib)
    3232SET(DEFAULT_ARCHIVE_PATH lib/static)
     33SET(DEFAULT_PLUGIN_PATH  lib/plugins)
    3334SET(DEFAULT_DOC_PATH     doc)
    3435SET(DEFAULT_MEDIA_PATH   media)
     
    4041SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
    4142SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
     43SET(CMAKE_PLUGIN_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_PLUGIN_PATH})
    4244# Do not set doc and media, rather check in the two subdirectories
    4345# whether they concur with the DEFAULT_..._PATH
     
    132134  SET(ORXONOX_LIBRARY_INSTALL_PATH ${DEFAULT_LIBRARY_PATH})
    133135  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${DEFAULT_ARCHIVE_PATH})
     136  SET(ORXONOX_PLUGIN_INSTALL_PATH  ${DEFAULT_PLUGIN_PATH})
    134137  SET(ORXONOX_DOC_INSTALL_PATH     ${DEFAULT_DOC_PATH})
    135138  SET(ORXONOX_MEDIA_INSTALL_PATH   ${DEFAULT_MEDIA_PATH})
     
    142145  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
    143146  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
     147  SET(ORXONOX_PLUGIN_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX}/lib/orxonox/plugins)
    144148  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
    145149  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/share/orxonox)
     
    152156  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH})
    153157  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH})
     158  SET(ORXONOX_PLUGIN_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX}/${DEFAULT_PLUGIN_PATH})
    154159  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH})
    155160  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MEDIA_PATH})
  • code/branches/libraries/src/SpecialConfig.h.in

    r3370 r5625  
    7474    // INSTALLATION PATHS
    7575    const char ORXONOX_RUNTIME_INSTALL_PATH[] = "@ORXONOX_RUNTIME_INSTALL_PATH@";
     76    const char ORXONOX_PLUGIN_INSTALL_PATH[]  = "@ORXONOX_PLUGIN_INSTALL_PATH@";
    7677    const char ORXONOX_MEDIA_INSTALL_PATH[]   = "@ORXONOX_MEDIA_INSTALL_PATH@";
    7778    /* Config and Log path might be relative because they could be user and therefore runtime dependent */
     
    8283    const char ORXONOX_MEDIA_DEV_PATH[]       = "@CMAKE_MEDIA_OUTPUT_DIRECTORY@";
    8384#ifdef CMAKE_CONFIGURATION_TYPES
     85    const char ORXONOX_PLUGIN_DEV_PATH[]      = "@CMAKE_PLUGIN_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
    8486    const char ORXONOX_CONFIG_DEV_PATH[]      = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
    8587    const char ORXONOX_LOG_DEV_PATH[]         = "@CMAKE_LOG_OUTPUT_DIRECTORY@/"    BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
  • code/branches/libraries/src/core/Core.cc

    r3370 r5625  
    241241        boost::filesystem::path rootPath_;
    242242        boost::filesystem::path executablePath_;        //!< Path to the executable
     243        boost::filesystem::path pluginPath_;            //!< Path to the plugins
    243244        boost::filesystem::path mediaPath_;             //!< Path to the media file folder
    244245        boost::filesystem::path configPath_;            //!< Path to the config file folder
     
    256257        , bGraphicsLoaded_(false)
    257258    {
    258         // Parse command line arguments first
     259        // Set the hard coded fixed paths
     260        this->setFixedPaths();
     261
     262        // TODO: Load plugins
     263
     264        // Parse command line arguments AFTER the plugins have been loaded (static code!)
    259265        CommandLine::parseCommandLine(cmdLine);
    260266
    261         // Determine and set the location of the executable
    262         setExecutablePath();
    263 
    264         // Determine whether we have an installed or a binary dir run
    265         // The latter occurs when simply running from the build directory
    266         checkDevBuild();
    267 
    268         // Make sure the directories we write in exist or else make them
    269         createDirectories();
     267        // Set configurable paths like log, config and media
     268        this->setConfigurablePaths();
    270269
    271270        // create a signal handler (only active for linux)
     
    507506    /**
    508507    @brief
    509         Compares the executable path with the working directory
    510     */
    511     void Core::setExecutablePath()
    512     {
     508        Retrievs the executable path and sets all hard coded fixed path (currently only plugin path)
     509        Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
     510        If found it means that this is not an installed run, hence we
     511        don't write the logs and config files to ~/.orxonox
     512    @throw
     513        GeneralException
     514    */
     515    void Core::setFixedPaths()
     516    {
     517        //////////////////////////
     518        // FIND EXECUTABLE PATH //
     519        //////////////////////////
     520
    513521#ifdef ORXONOX_PLATFORM_WINDOWS
    514522        // get executable module
     
    553561        configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name
    554562#endif
    555     }
    556 
    557     /**
    558     @brief
    559         Checks for "orxonox_dev_build.keep_me" in the executable diretory.
    560         If found it means that this is not an installed run, hence we
    561         don't write the logs and config files to ~/.orxonox
    562     @throws
    563         GeneralException
    564     */
    565     void Core::checkDevBuild()
    566     {
     563
     564        /////////////////////
     565        // SET PLUGIN PATH //
     566        /////////////////////
     567
    567568        if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))
    568569        {
    569570            COUT(1) << "Running from the build tree." << std::endl;
    570571            Core::bDevRun_ = true;
    571             configuration_->mediaPath_  = ORXONOX_MEDIA_DEV_PATH;
    572             configuration_->configPath_ = ORXONOX_CONFIG_DEV_PATH;
    573             configuration_->logPath_    = ORXONOX_LOG_DEV_PATH;
     572            configuration_->pluginPath_ = ORXONOX_PLUGIN_DEV_PATH;
    574573        }
    575574        else
    576575        {
     576
    577577#ifdef INSTALL_COPYABLE // --> relative paths
     578
    578579            // Also set the root path
    579580            boost::filesystem::path relativeExecutablePath(ORXONOX_RUNTIME_INSTALL_PATH);
     
    585586                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
    586587
     588            // Plugin path is fixed as well
     589            configuration_->pluginPath_ = configuration_->rootPath_ / ORXONOX_PLUGIN_INSTALL_PATH;
     590
     591#else
     592
     593            // There is no root path, so don't set it at all
     594            // Plugin path is fixed as well
     595            configuration_->pluginPath_ = ORXONOX_PLUGIN_INSTALL_PATH;
     596
     597#endif
     598        }
     599    }
     600
     601    /**
     602    @brief
     603        Sets config, log and media path and creates folders if necessary.
     604    @throws
     605        GeneralException
     606    */
     607    void Core::setConfigurablePaths()
     608    {
     609        if (Core::isDevelopmentRun())
     610        {
     611            configuration_->mediaPath_  = ORXONOX_MEDIA_DEV_PATH;
     612            configuration_->configPath_ = ORXONOX_CONFIG_DEV_PATH;
     613            configuration_->logPath_    = ORXONOX_LOG_DEV_PATH;
     614        }
     615        else
     616        {
     617
     618#ifdef INSTALL_COPYABLE // --> relative paths
     619
    587620            // Using paths relative to the install prefix, complete them
    588621            configuration_->mediaPath_  = configuration_->rootPath_ / ORXONOX_MEDIA_INSTALL_PATH;
    589622            configuration_->configPath_ = configuration_->rootPath_ / ORXONOX_CONFIG_INSTALL_PATH;
    590623            configuration_->logPath_    = configuration_->rootPath_ / ORXONOX_LOG_INSTALL_PATH;
     624
    591625#else
    592             // There is no root path, so don't set it at all
    593626
    594627            configuration_->mediaPath_  = ORXONOX_MEDIA_INSTALL_PATH;
     
    607640            configuration_->configPath_ = userDataPath / ORXONOX_CONFIG_INSTALL_PATH;
    608641            configuration_->logPath_    = userDataPath / ORXONOX_LOG_INSTALL_PATH;
    609 #endif
     642
     643#endif
     644
    610645        }
    611646
     
    617652            configuration_->logPath_    = configuration_->logPath_    / directory;
    618653        }
    619     }
    620 
    621     /*
    622     @brief
    623         Checks for the log and the config directory and creates them
    624         if necessary. Otherwise me might have problems opening those files.
    625     @throws
    626         orxonox::GeneralException if the directory to be created is a file.
    627     */
    628     void Core::createDirectories()
    629     {
     654
     655        // Create directories to avoid problems when opening files in non existent folders.
    630656        std::vector<std::pair<boost::filesystem::path, std::string> > directories;
    631657        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config"));
  • code/branches/libraries/src/core/Core.h

    r3370 r5625  
    114114            Core(const Core&); //!< Don't use (undefined symbol)
    115115
    116             void checkDevBuild();
    117             void setExecutablePath();
    118             void createDirectories();
     116            void setFixedPaths();
     117            void setConfigurablePaths();
    119118            void setThreadAffinity(int limitToCPU);
    120119
Note: See TracChangeset for help on using the changeset viewer.