Changeset 5625 for code/branches
- Timestamp:
- Aug 11, 2009, 5:57:18 PM (15 years ago)
- Location:
- code/branches/libraries
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/libraries/cmake/BuildConfig.cmake
r3330 r5625 31 31 SET(DEFAULT_LIBRARY_PATH lib) 32 32 SET(DEFAULT_ARCHIVE_PATH lib/static) 33 SET(DEFAULT_PLUGIN_PATH lib/plugins) 33 34 SET(DEFAULT_DOC_PATH doc) 34 35 SET(DEFAULT_MEDIA_PATH media) … … 40 41 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH}) 41 42 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH}) 43 SET(CMAKE_PLUGIN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_PLUGIN_PATH}) 42 44 # Do not set doc and media, rather check in the two subdirectories 43 45 # whether they concur with the DEFAULT_..._PATH … … 132 134 SET(ORXONOX_LIBRARY_INSTALL_PATH ${DEFAULT_LIBRARY_PATH}) 133 135 SET(ORXONOX_ARCHIVE_INSTALL_PATH ${DEFAULT_ARCHIVE_PATH}) 136 SET(ORXONOX_PLUGIN_INSTALL_PATH ${DEFAULT_PLUGIN_PATH}) 134 137 SET(ORXONOX_DOC_INSTALL_PATH ${DEFAULT_DOC_PATH}) 135 138 SET(ORXONOX_MEDIA_INSTALL_PATH ${DEFAULT_MEDIA_PATH}) … … 142 145 SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox) 143 146 SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static) 147 SET(ORXONOX_PLUGIN_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox/plugins) 144 148 SET(ORXONOX_DOC_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox) 145 149 SET(ORXONOX_MEDIA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/share/orxonox) … … 152 156 SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH}) 153 157 SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH}) 158 SET(ORXONOX_PLUGIN_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_PLUGIN_PATH}) 154 159 SET(ORXONOX_DOC_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH}) 155 160 SET(ORXONOX_MEDIA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MEDIA_PATH}) -
code/branches/libraries/src/SpecialConfig.h.in
r3370 r5625 74 74 // INSTALLATION PATHS 75 75 const char ORXONOX_RUNTIME_INSTALL_PATH[] = "@ORXONOX_RUNTIME_INSTALL_PATH@"; 76 const char ORXONOX_PLUGIN_INSTALL_PATH[] = "@ORXONOX_PLUGIN_INSTALL_PATH@"; 76 77 const char ORXONOX_MEDIA_INSTALL_PATH[] = "@ORXONOX_MEDIA_INSTALL_PATH@"; 77 78 /* Config and Log path might be relative because they could be user and therefore runtime dependent */ … … 82 83 const char ORXONOX_MEDIA_DEV_PATH[] = "@CMAKE_MEDIA_OUTPUT_DIRECTORY@"; 83 84 #ifdef CMAKE_CONFIGURATION_TYPES 85 const char ORXONOX_PLUGIN_DEV_PATH[] = "@CMAKE_PLUGIN_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE); 84 86 const char ORXONOX_CONFIG_DEV_PATH[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE); 85 87 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 241 241 boost::filesystem::path rootPath_; 242 242 boost::filesystem::path executablePath_; //!< Path to the executable 243 boost::filesystem::path pluginPath_; //!< Path to the plugins 243 244 boost::filesystem::path mediaPath_; //!< Path to the media file folder 244 245 boost::filesystem::path configPath_; //!< Path to the config file folder … … 256 257 , bGraphicsLoaded_(false) 257 258 { 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!) 259 265 CommandLine::parseCommandLine(cmdLine); 260 266 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(); 270 269 271 270 // create a signal handler (only active for linux) … … 507 506 /** 508 507 @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 513 521 #ifdef ORXONOX_PLATFORM_WINDOWS 514 522 // get executable module … … 553 561 configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name 554 562 #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 567 568 if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me")) 568 569 { 569 570 COUT(1) << "Running from the build tree." << std::endl; 570 571 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; 574 573 } 575 574 else 576 575 { 576 577 577 #ifdef INSTALL_COPYABLE // --> relative paths 578 578 579 // Also set the root path 579 580 boost::filesystem::path relativeExecutablePath(ORXONOX_RUNTIME_INSTALL_PATH); … … 585 586 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?"); 586 587 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 587 620 // Using paths relative to the install prefix, complete them 588 621 configuration_->mediaPath_ = configuration_->rootPath_ / ORXONOX_MEDIA_INSTALL_PATH; 589 622 configuration_->configPath_ = configuration_->rootPath_ / ORXONOX_CONFIG_INSTALL_PATH; 590 623 configuration_->logPath_ = configuration_->rootPath_ / ORXONOX_LOG_INSTALL_PATH; 624 591 625 #else 592 // There is no root path, so don't set it at all593 626 594 627 configuration_->mediaPath_ = ORXONOX_MEDIA_INSTALL_PATH; … … 607 640 configuration_->configPath_ = userDataPath / ORXONOX_CONFIG_INSTALL_PATH; 608 641 configuration_->logPath_ = userDataPath / ORXONOX_LOG_INSTALL_PATH; 609 #endif 642 643 #endif 644 610 645 } 611 646 … … 617 652 configuration_->logPath_ = configuration_->logPath_ / directory; 618 653 } 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. 630 656 std::vector<std::pair<boost::filesystem::path, std::string> > directories; 631 657 directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config")); -
code/branches/libraries/src/core/Core.h
r3370 r5625 114 114 Core(const Core&); //!< Don't use (undefined symbol) 115 115 116 void checkDevBuild(); 117 void setExecutablePath(); 118 void createDirectories(); 116 void setFixedPaths(); 117 void setConfigurablePaths(); 119 118 void setThreadAffinity(int limitToCPU); 120 119
Note: See TracChangeset
for help on using the changeset viewer.