[Orxonox-commit 5888] r10547 - in code/branches/core7: . cmake cmake/tools src src/libraries/core

landauf at orxonox.net landauf at orxonox.net
Sun Aug 23 11:57:54 CEST 2015


Author: landauf
Date: 2015-08-23 11:57:53 +0200 (Sun, 23 Aug 2015)
New Revision: 10547

Modified:
   code/branches/core7/CMakeLists.txt
   code/branches/core7/cmake/InstallConfig.cmake
   code/branches/core7/cmake/tools/TargetUtilities.cmake
   code/branches/core7/src/CMakeLists.txt
   code/branches/core7/src/SpecialConfig.h.in
   code/branches/core7/src/libraries/core/ApplicationPaths.cc
   code/branches/core7/src/libraries/core/ApplicationPaths.h
   code/branches/core7/src/libraries/core/Core.cc
Log:
added support for plugins in the buildsystem. plugins are like modules, but can be loaded/unloaded at runtime

Modified: code/branches/core7/CMakeLists.txt
===================================================================
--- code/branches/core7/CMakeLists.txt	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/CMakeLists.txt	2015-08-23 09:57:53 UTC (rev 10547)
@@ -64,6 +64,7 @@
 SET(DEFAULT_LIBRARY_PATH lib)
 SET(DEFAULT_ARCHIVE_PATH lib/static)
 SET(DEFAULT_MODULE_PATH  lib/modules)
+SET(DEFAULT_PLUGIN_PATH  lib/plugins)
 SET(DEFAULT_DOC_PATH     doc)
 SET(DEFAULT_DATA_PATH    data)
 SET(DEFAULT_CONFIG_PATH  config)
@@ -75,6 +76,7 @@
 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
 SET(CMAKE_MODULE_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})
+SET(CMAKE_PLUGIN_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_PLUGIN_PATH})
 SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
 # Data directories are only inputs, no delclaration here
 SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
@@ -82,6 +84,7 @@
 
 # Set the extension of the dynamic modules
 SET(ORXONOX_MODULE_EXTENSION ".module")
+SET(ORXONOX_PLUGIN_EXTENSION ".plugin")
 
 # Sets where to find the external libraries like OgreMain.dll at runtime
 # On Unix you should not have to change this at all.

Modified: code/branches/core7/cmake/InstallConfig.cmake
===================================================================
--- code/branches/core7/cmake/InstallConfig.cmake	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/cmake/InstallConfig.cmake	2015-08-23 09:57:53 UTC (rev 10547)
@@ -48,6 +48,7 @@
 SET(LIBRARY_INSTALL_DIRECTORY ${DEFAULT_LIBRARY_PATH})
 SET(ARCHIVE_INSTALL_DIRECTORY ${DEFAULT_ARCHIVE_PATH})
 SET(MODULE_INSTALL_DIRECTORY  ${DEFAULT_MODULE_PATH})
+SET(PLUGIN_INSTALL_DIRECTORY  ${DEFAULT_PLUGIN_PATH})
 SET(DOC_INSTALL_DIRECTORY     ${DEFAULT_DOC_PATH})
 SET(DATA_INSTALL_DIRECTORY    ${DEFAULT_DATA_PATH})
 SET(CONFIG_INSTALL_DIRECTORY  ${DEFAULT_CONFIG_PATH})
@@ -60,6 +61,7 @@
     SET(LIBRARY_INSTALL_DIRECTORY lib/games/orxonox)
     SET(ARCHIVE_INSTALL_DIRECTORY lib/games/orxonox/static)
     SET(MODULE_INSTALL_DIRECTORY  lib/games/orxonox/modules)
+    SET(PLUGIN_INSTALL_DIRECTORY  lib/games/orxonox/plugins)
     SET(DOC_INSTALL_DIRECTORY     share/doc/orxonox)
     SET(DATA_INSTALL_DIRECTORY    share/games/orxonox)
   ELSEIF(WIN32)
@@ -84,18 +86,21 @@
 
 # The RPATH to be used when installing
 IF(INSTALL_COPYABLE)
-  # Get relative paths from run to lib and from module to lib directory.
+  # Get relative paths from run to lib and from module/plugin to lib directory.
   FILE(RELATIVE_PATH _runtime_rpath "/${RUNTIME_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
   FILE(RELATIVE_PATH _module_rpath  "/${MODULE_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
+  FILE(RELATIVE_PATH _plugin_rpath  "/${PLUGIN_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
   # $ORIGIN (with $ escaped) refers to the actual location of the library
   # The UNIX loader recognises this special variable
   SET(RUNTIME_RPATH "\$ORIGIN/${_runtime_rpath}")
   SET(LIBRARY_RPATH "\$ORIGIN")
   SET(MODULE_RPATH  "\$ORIGIN:\$ORIGIN/${_module_rpath}")
+  SET(PLUGIN_RPATH  "\$ORIGIN:\$ORIGIN/${_plugin_rpath}")
 ELSE()
   SET(RUNTIME_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}")
   SET(LIBRARY_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}")
   SET(MODULE_RPATH  "${LIBRARY_RPATH}:${CMAKE_INSTALL_PREFIX}/${MODULE_INSTALL_DIRECTORY}")
+  SET(PLUGIN_RPATH  "${LIBRARY_RPATH}:${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_DIRECTORY}")
 ENDIF()
 
 # Add the automatically determined parts of the RPATH

Modified: code/branches/core7/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/branches/core7/cmake/tools/TargetUtilities.cmake	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/cmake/tools/TargetUtilities.cmake	2015-08-23 09:57:53 UTC (rev 10547)
@@ -34,6 +34,9 @@
  #      NO_DLL_INTERFACE:  Link statically with MSVC
  #      NO_SOURCE_GROUPS:  Don't create msvc source groups
  #      MODULE:            For dynamic module libraries (libraries only)
+ #      PLUGIN:            For dynamic plugin libraries (libraries only)
+ #                         Plugins are a special kind of modules that can be
+ #                         loaded and unloaded during runtime on demand
  #      WIN32:             Inherited from ADD_EXECUTABLE (executables only)
  #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
  #                         specified with PCH_FILE
@@ -76,11 +79,13 @@
 ENDIF()
 
 MACRO(ORXONOX_ADD_LIBRARY _target_name)
-  TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
+  SET(_additional_switches MODULE PLUGIN)
+  TU_ADD_TARGET(${_target_name} LIBRARY "${_additional_switches}" ${ARGN})
 ENDMACRO(ORXONOX_ADD_LIBRARY)
 
 MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
-  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
+  SET(_additional_switches WIN32)
+  TU_ADD_TARGET(${_target_name} EXECUTABLE "${_additional_switches}" ${ARGN})
   
   # When using Visual Studio we want to use the output directory as working
   # directory and we also want to specify where the external dlls
@@ -328,11 +333,20 @@
       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
       LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
     )
-    ADD_MODULE(${_target_name})
+    ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_MODULE_OUTPUT_DIRECTORY} ${MODULE_INSTALL_DIRECTORY} ${ORXONOX_MODULE_EXTENSION})
     # Ensure that the main program depends on the module
     SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE INTERNAL "")
   ENDIF()
 
+  # Configure plugins
+  IF (_arg_PLUGIN)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} # Windows
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} # Unix
+    )
+    ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} ${PLUGIN_INSTALL_DIRECTORY} ${ORXONOX_PLUGIN_EXTENSION})
+  ENDIF()
+
   # Static library flags are not globally available
   IF(ORXONOX_STATIC_LINKER_FLAGS)
     SET_TARGET_PROPERTIES(${_target_name} PROPERTIES STATIC_LIBRARY_FLAGS ${ORXONOX_STATIC_LINKER_FLAGS})
@@ -371,6 +385,8 @@
   IF("${_target_type}" STREQUAL "LIBRARY")
     IF(_arg_MODULE)
       SET(_rpath "${MODULE_RPATH}")
+    ELSEIF(_arg_PLUGIN)
+      SET(_rpath "${PLUGIN_RPATH}")
     ELSE()
       SET(_rpath "${LIBRARY_RPATH}")
     ENDIF()
@@ -411,6 +427,11 @@
         RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
         LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
       )
+    ELSEIF(_arg_PLUGIN)
+      INSTALL(TARGETS ${_target_name}
+        RUNTIME DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
+        LIBRARY DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
+      )
     ELSE()
       INSTALL(TARGETS ${_target_name}
         RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
@@ -427,6 +448,11 @@
             DESTINATION ${MODULE_INSTALL_DIRECTORY}
             CONFIGURATIONS ${_config}
           )
+        ELSEIF(_arg_PLUGIN)
+          INSTALL(FILES ${_location_we}.pdb
+            DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
+            CONFIGURATIONS ${_config}
+          )
         ELSE()
           INSTALL(FILES ${_location_we}.pdb
             DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
@@ -440,10 +466,10 @@
 ENDMACRO(TU_ADD_TARGET)
 
 
-# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
-# This helps finding dynamically loadable modules at runtime
+# Creates a helper file with name <name_of_the_library>.<extension>
+# This helps finding dynamically loadable modules or plugins at runtime
 
-FUNCTION(ADD_MODULE _target)
+FUNCTION(ADD_MODULE_OR_PLUGIN _target _output_dir _install_dir _extension)
   # We use the properties to get the name because the librarys name may differ from
   # the target name (for example orxonox <-> liborxonox)
   IF (POLICY CMP0026)
@@ -458,24 +484,24 @@
 
   IF(CMAKE_CONFIGURATION_TYPES)
     FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
-      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
+      SET(_helper_filename ${_output_dir}/${_config}/${_target_name}${_extension})
 
-      FILE(WRITE ${_module_filename})
+      FILE(WRITE ${_helper_filename})
 
       INSTALL(
-        FILES ${_module_filename}
-        DESTINATION ${MODULE_INSTALL_DIRECTORY}
+        FILES ${_helper_filename}
+        DESTINATION ${_install_dir}
         CONFIGURATIONS ${_config}
       )
     ENDFOREACH()
   ELSE()
-    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
+    SET(_helper_filename ${_output_dir}/${_target_name}${_extension})
 
-    FILE(WRITE ${_module_filename})
+    FILE(WRITE ${_helper_filename})
 
     INSTALL(
-      FILES ${_module_filename}
-      DESTINATION ${MODULE_INSTALL_DIRECTORY}
+      FILES ${_helper_filename}
+      DESTINATION ${_install_dir}
     )
   ENDIF()
-ENDFUNCTION(ADD_MODULE)
+ENDFUNCTION(ADD_MODULE_OR_PLUGIN)

Modified: code/branches/core7/src/CMakeLists.txt
===================================================================
--- code/branches/core7/src/CMakeLists.txt	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/src/CMakeLists.txt	2015-08-23 09:57:53 UTC (rev 10547)
@@ -38,6 +38,7 @@
 ADD_SUBDIRECTORY(libraries)
 ADD_SUBDIRECTORY(orxonox)
 SET(ORXONOX_MODULES CACHE INTERNAL "")
+SET(ORXONOX_PLUGINS CACHE INTERNAL "")
 ADD_SUBDIRECTORY(modules)
 
 ################## Executable ###################
@@ -71,7 +72,7 @@
     ${ORXONOX_MAIN_FILES}
   OUTPUT_NAME orxonox
 )
-# Main executable should depend on all modules
+# Main executable should depend on all modules (but not on plugins)
 ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES})
 
 # Get name to configure the run scripts

Modified: code/branches/core7/src/SpecialConfig.h.in
===================================================================
--- code/branches/core7/src/SpecialConfig.h.in	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/src/SpecialConfig.h.in	2015-08-23 09:57:53 UTC (rev 10547)
@@ -59,6 +59,7 @@
     const char defaultLibraryPath[] = "@DEFAULT_LIBRARY_PATH@";
     const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@";
     const char defaultModulePath[]  = "@DEFAULT_MODULE_PATH@";
+    const char defaultPluginPath[]  = "@DEFAULT_PLUGIN_PATH@";
     const char defaultDocPath[]     = "@DEFAULT_DOC_PATH@";
     const char defaultDataPath[]    = "@DEFAULT_DATA_PATH@";
     const char defaultConfigPath[]  = "@DEFAULT_CONFIG_PATH@";
@@ -68,6 +69,7 @@
     // INSTALLATION PATHS
     const char dataInstallDirectory[]       = "@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIRECTORY@";
     const char moduleInstallDirectory[]     = "@CMAKE_INSTALL_PREFIX@/@MODULE_INSTALL_DIRECTORY@";
+    const char pluginInstallDirectory[]     = "@CMAKE_INSTALL_PREFIX@/@PLUGIN_INSTALL_DIRECTORY@";
 #endif
 
     // DEVELOPMENT RUN PATHS
@@ -75,10 +77,12 @@
     const char externalDataDevDirectory[]   = "@EXTERNAL_DATA_DIRECTORY@";
 #ifdef CMAKE_CONFIGURATION_TYPES
     const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;
+    const char pluginDevDirectory[]         = "@CMAKE_PLUGIN_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;
     const char configDevDirectory[]         = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;
     const char logDevDirectory[]            = "@CMAKE_LOG_OUTPUT_DIRECTORY@/"    CMAKE_INTDIR;
 #else
     const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@";
+    const char pluginDevDirectory[]         = "@CMAKE_PLUGIN_OUTPUT_DIRECTORY@";
     const char configDevDirectory[]         = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";
     const char logDevDirectory[]            = "@CMAKE_LOG_OUTPUT_DIRECTORY@";
 #endif
@@ -87,8 +91,9 @@
     const char dependencyLibraryDirectory[] = "@DEP_LIBRARY_DIR@";
 #endif
 
-    // Module extension
+    // Module and plugin extension
     const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@";
+    const char pluginExtension[] = "@ORXONOX_PLUGIN_EXTENSION@";
 
     // OGRE PLUGINS
 #ifdef NDEBUG

Modified: code/branches/core7/src/libraries/core/ApplicationPaths.cc
===================================================================
--- code/branches/core7/src/libraries/core/ApplicationPaths.cc	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/src/libraries/core/ApplicationPaths.cc	2015-08-23 09:57:53 UTC (rev 10547)
@@ -73,6 +73,7 @@
         : rootPath_(*(new bf::path()))
         , executablePath_(*(new bf::path()))
         , modulePath_(*(new bf::path()))
+        , pluginPath_(*(new bf::path()))
         , bBuildDirectoryRun_(false)
     {
         //////////////////////////
@@ -120,15 +121,16 @@
         // Remove executable filename
         executablePath_ = bf::path(buffer).branch_path();
 
-        /////////////////////
-        // SET MODULE PATH //
-        /////////////////////
+        /////////////////////////////////
+        // SET MODULE AND PLUGIN PATHS //
+        /////////////////////////////////
 
         if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me"))
         {
             orxout(internal_info) << "Running from the build tree." << endl;
             ApplicationPaths::bBuildDirectoryRun_ = true;
             modulePath_ = specialConfig::moduleDevDirectory;
+            pluginPath_ = specialConfig::pluginDevDirectory;
         }
         else
         {
@@ -143,14 +145,16 @@
             if (rootPath_.empty())
                 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
 
-            // Module path is fixed as well
+            // Module and plugin paths are fixed as well
             modulePath_ = rootPath_ / specialConfig::defaultModulePath;
+            pluginPath_ = rootPath_ / specialConfig::defaultPluginPath;
 
 #else
 
             // There is no root path, so don't set it at all
-            // Module path is fixed as well
+            // Module and plugin paths are fixed as well
             modulePath_ = specialConfig::moduleInstallDirectory;
+            pluginPath_ = specialConfig::pluginInstallDirectory;
 
 #endif
         }
@@ -161,21 +165,31 @@
         delete &rootPath_;
         delete &executablePath_;
         delete &modulePath_;
+        delete &pluginPath_;
     }
 
     std::vector<std::string> ApplicationPaths::getModulePaths()
     {
-        std::vector<std::string> modulePaths;
+        return this->getModuleOrPluginPaths(modulePath_, specialConfig::moduleExtension);
+    }
 
+    std::vector<std::string> ApplicationPaths::getPluginPaths()
+    {
+        return this->getModuleOrPluginPaths(pluginPath_, specialConfig::pluginExtension);
+    }
+
+    std::vector<std::string> ApplicationPaths::getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension)
+    {
+        std::vector<std::string> paths;
+
         // We search for helper files with the following extension
-        const std::string& moduleextension = specialConfig::moduleExtension;
-        size_t moduleextensionlength = moduleextension.size();
+        size_t extensionlength = extension.size();
 
-        // Make sure the path exists, otherwise don't load modules
-        if (!boost::filesystem::exists(modulePath_))
-            return modulePaths;
+        // Make sure the path exists, otherwise don't load modules/plugins
+        if (!boost::filesystem::exists(directory))
+            return paths;
 
-        boost::filesystem::directory_iterator file(modulePath_);
+        boost::filesystem::directory_iterator file(directory);
         boost::filesystem::directory_iterator end;
 
         // Iterate through all files
@@ -184,19 +198,19 @@
             std::string filename = file->BF_LEAF();
 
             // Check if the file ends with the extension in question
-            if (filename.size() > moduleextensionlength)
+            if (filename.size() > extensionlength)
             {
-                if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
+                if (filename.substr(filename.size() - extensionlength) == extension)
                 {
                     // We've found a helper file
-                    const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
-                    modulePaths.push_back(getModulePathString() + library);
+                    const std::string& library = filename.substr(0, filename.size() - extensionlength);
+                    paths.push_back(directory.BF_GENERIC_STRING() + '/' + library);
                 }
             }
             ++file;
         }
 
-        return modulePaths;
+        return paths;
     }
 
     /*static*/ std::string ApplicationPaths::getRootPathString()
@@ -213,4 +227,9 @@
     {
         return getInstance().modulePath_.BF_GENERIC_STRING() + '/';
     }
+
+    /*static*/ std::string ApplicationPaths::getPluginPathString()
+    {
+        return getInstance().pluginPath_.BF_GENERIC_STRING() + '/';
+    }
 }

Modified: code/branches/core7/src/libraries/core/ApplicationPaths.h
===================================================================
--- code/branches/core7/src/libraries/core/ApplicationPaths.h	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/src/libraries/core/ApplicationPaths.h	2015-08-23 09:57:53 UTC (rev 10547)
@@ -48,7 +48,7 @@
     @brief
         The ApplicationPaths class is a singleton which provides static paths of the application.
     @details
-        The class provides information about the executable, root and module path.
+        The class provides information about the executable, root and module/plugin path.
         It determines those by the use of platform specific functions.
     @remarks
         Not all paths are always available:
@@ -62,7 +62,7 @@
         public:
             /**
             @brief
-                Retrieves the executable path and sets all hard coded fixed paths (currently only the module path)
+                Retrieves the executable path and sets all hard coded fixed paths (currently only the module and the plugin paths)
                 Also checks for "orxonox_dev_build.keep_me" in the executable directory.
                 If found it means that this is not an installed run, hence we
                 don't write the logs and config files to ~/.orxonox
@@ -81,6 +81,9 @@
             //! Returns the path to the modules as boost::filesystem::path
             static const boost::filesystem::path& getModulePath()
                 { return getInstance().modulePath_; }
+            //! Returns the path to the plugins as boost::filesystem::path
+            static const boost::filesystem::path& getPluginPath()
+                { return getInstance().pluginPath_; }
 
             //! Returns the path to the root folder as std::string
             static std::string getRootPathString();
@@ -88,20 +91,27 @@
             static std::string getExecutablePathString();
             //! Returns the path to the modules as std::string
             static std::string getModulePathString();
+            //! Returns the path to the plugins as std::string
+            static std::string getPluginPathString();
 
             //! Return true for runs in the build directory (not installed)
             static bool buildDirectoryRun() { return getInstance().bBuildDirectoryRun_; }
 
             //! Returns a list with all modules declared by a *.module file in the module folder.
             std::vector<std::string> getModulePaths();
+            //! Returns a list with all plugins declared by a *.plugin file in the plugin folder.
+            std::vector<std::string> getPluginPaths();
 
         private:
             ApplicationPaths(const ApplicationPaths&); //!< Don't use (undefined symbol)
 
+            std::vector<std::string> getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension);
+
             //! Path to the parent directory of the ones above if program was installed with relative paths
             boost::filesystem::path& rootPath_;
             boost::filesystem::path& executablePath_;        //!< Path to the executable
             boost::filesystem::path& modulePath_;            //!< Path to the modules
+            boost::filesystem::path& pluginPath_;            //!< Path to the plugins
 
             bool                     bBuildDirectoryRun_;    //!< True for runs in the build directory (not installed)
             static ApplicationPaths* singletonPtr_s;

Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc	2015-07-30 12:13:21 UTC (rev 10546)
+++ code/branches/core7/src/libraries/core/Core.cc	2015-08-23 09:57:53 UTC (rev 10547)
@@ -141,6 +141,7 @@
         orxout(internal_info) << "Root path:       " << ApplicationPaths::getRootPathString() << endl;
         orxout(internal_info) << "Executable path: " << ApplicationPaths::getExecutablePathString() << endl;
         orxout(internal_info) << "Modules path:    " << ApplicationPaths::getModulePathString() << endl;
+        orxout(internal_info) << "Plugins path:    " << ApplicationPaths::getPluginPathString() << endl;
 
         orxout(internal_info) << "Data path:       " << ConfigurablePaths::getDataPathString() << endl;
         orxout(internal_info) << "Ext. data path:  " << ConfigurablePaths::getExternalDataPathString() << endl;




More information about the Orxonox-commit mailing list