[Orxonox-commit 826] r3345 - in branches/resource: cmake src src/core

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Jul 24 21:31:31 CEST 2009


Author: rgrieder
Date: 2009-07-24 21:31:31 +0200 (Fri, 24 Jul 2009)
New Revision: 3345

Modified:
   branches/resource/cmake/Media.cmake
   branches/resource/cmake/PackageConfig.cmake
   branches/resource/src/SpecialConfig.h.in
   branches/resource/src/core/Core.cc
   branches/resource/src/core/Core.h
   branches/resource/src/core/TclBind.cc
Log:
Fixed installation: The Tcl script library should now be found in the installed version as well.

Modified: branches/resource/cmake/Media.cmake
===================================================================
--- branches/resource/cmake/Media.cmake	2009-07-24 16:00:36 UTC (rev 3344)
+++ branches/resource/cmake/Media.cmake	2009-07-24 19:31:31 UTC (rev 3345)
@@ -44,15 +44,8 @@
 
 ################ Installation #################
 
-# Try no to copy both tcl script file libraries
-IF(TCL_LIBRARY MATCHES "85|8\\.5")
-  SET(TCL_EXCLUDE_PATTERN "tcl8\\.4")
-ELSEIF(TCL_LIBRARY MATCHES "84|8\\.4")
-  SET(TCL_EXCLUDE_PATTERN "tcl8\\.5")
-ENDIF()
-
 INSTALL(
   DIRECTORY ${CMAKE_MEDIA_OUTPUT_DIRECTORY}/
   DESTINATION ${ORXONOX_MEDIA_INSTALL_PATH}
-  REGEX "\\.svn$|_svn$|backToPNG|${TCL_EXCLUDE_PATTERN}" EXCLUDE
+  REGEX "\\.svn$|_svn$|backToPNG" EXCLUDE
 )

Modified: branches/resource/cmake/PackageConfig.cmake
===================================================================
--- branches/resource/cmake/PackageConfig.cmake	2009-07-24 16:00:36 UTC (rev 3344)
+++ branches/resource/cmake/PackageConfig.cmake	2009-07-24 19:31:31 UTC (rev 3345)
@@ -44,9 +44,14 @@
 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl-8.5.7/include)
 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib-1.2.3/include)
 
-SET(TCL_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/tcl)
+### INSTALL ###
 
-### INSTALL ###
+# Tcl script library
+INSTALL(
+  DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
+  DESTINATION lib/tcl
+)
+
 # On Windows, DLLs have to be in the executable folder, install them
 IF(WIN32 AND DEP_BINARY_DIR)
   ## DEBUG

Modified: branches/resource/src/SpecialConfig.h.in
===================================================================
--- branches/resource/src/SpecialConfig.h.in	2009-07-24 16:00:36 UTC (rev 3344)
+++ branches/resource/src/SpecialConfig.h.in	2009-07-24 19:31:31 UTC (rev 3345)
@@ -87,8 +87,11 @@
     const char ORXONOX_CONFIG_DEV_PATH[]      = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";
     const char ORXONOX_LOG_DEV_PATH[]         = "@CMAKE_LOG_OUTPUT_DIRECTORY@";
 #endif
+#ifdef DEPENDENCY_PACKAGE_ENABLE
+    const char ORXONOX_DEP_LIB_PATH[]         = "@DEP_LIBRARY_DIR@";
+#endif
 
-    /* OGRE Plugins */
+    // OGRE PLUGINS
 #ifdef NDEBUG
     const char ORXONOX_OGRE_PLUGINS[] = "@OGRE_PLUGINS_RELEASE@";
 #  ifdef DEPENDENCY_PACKAGE_ENABLE
@@ -104,11 +107,6 @@
     const char ORXONOX_OGRE_PLUGINS_FOLDER[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
 #  endif
 #endif
-
-    /* Tcl */
-#ifdef DEPENDENCY_PACKAGE_ENABLE
-    const char ORXONOX_TCL_LIBRARY_PATH[] = "@TCL_LIBRARY_DIR@";
-#endif
 }
 
 /**

Modified: branches/resource/src/core/Core.cc
===================================================================
--- branches/resource/src/core/Core.cc	2009-07-24 16:00:36 UTC (rev 3344)
+++ branches/resource/src/core/Core.cc	2009-07-24 19:31:31 UTC (rev 3345)
@@ -230,7 +230,8 @@
 
 
     Core::Core(const std::string& cmdLine)
-        : bGraphicsLoaded_(false)
+        : bDevRun_(false)
+        , bGraphicsLoaded_(false)
     {
         if (singletonRef_s != 0)
         {
@@ -434,6 +435,15 @@
         return getInstance().configuration_->logPath_.string() + '/';
     }
 
+    /*static*/ const boost::filesystem::path& Core::getRootPath()
+    {
+        return getInstance().configuration_->rootPath_;
+    }
+    /*static*/ std::string Core::getRootPathString()
+    {
+        return getInstance().configuration_->rootPath_.string() + '/';
+    }
+
     /**
     @note
         The code of this function has been copied and adjusted from OGRE, an open source graphics engine.
@@ -543,7 +553,7 @@
         if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))
         {
             COUT(1) << "Running from the build tree." << std::endl;
-            Core::isDevBuild_ = true;
+            Core::bDevRun_ = true;
             configuration_->mediaPath_  = ORXONOX_MEDIA_DEV_PATH;
             configuration_->configPath_ = ORXONOX_CONFIG_DEV_PATH;
             configuration_->logPath_    = ORXONOX_LOG_DEV_PATH;

Modified: branches/resource/src/core/Core.h
===================================================================
--- branches/resource/src/core/Core.h	2009-07-24 16:00:36 UTC (rev 3344)
+++ branches/resource/src/core/Core.h	2009-07-24 19:31:31 UTC (rev 3345)
@@ -89,13 +89,19 @@
             static const boost::filesystem::path& getConfigPath();
             //! Returns the path to the log files as boost::filesystem::path
             static const boost::filesystem::path& getLogPath();
+            //! Returns the path to the root folder as boost::filesystem::path
+            static const boost::filesystem::path& getRootPath();
             //! Returns the path to the data files as std::string
             static std::string getMediaPathString();
             //! Returns the path to the config files as std::string
             static std::string getConfigPathString();
             //! Returns the path to the log files as std::string
             static std::string getLogPathString();
+            //! Returns the path to the root folder as std::string
+            static std::string getRootPathString();
 
+            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
+
         private:
             Core(const Core&); //!< Don't use (undefined symbol)
 
@@ -113,7 +119,7 @@
             TclBind*              tclBind_;
             TclThreadManager*     tclThreadManager_;
 
-            bool                  isDevBuild_;          //!< True for builds in the build directory (not installed)
+            bool                  bDevRun_;             //!< True for runs in the build directory (not installed)
             bool                  bGraphicsLoaded_;
             CoreConfiguration*    configuration_;
 

Modified: branches/resource/src/core/TclBind.cc
===================================================================
--- branches/resource/src/core/TclBind.cc	2009-07-24 16:00:36 UTC (rev 3344)
+++ branches/resource/src/core/TclBind.cc	2009-07-24 19:31:31 UTC (rev 3345)
@@ -32,12 +32,13 @@
 #include <string>
 #include <cpptcl/cpptcl.h>
 
+#include "SpecialConfig.h"
 #include "util/Debug.h"
 #include "util/StringUtils.h"
 #include "CommandExecutor.h"
 #include "ConsoleCommand.h"
+#include "Core.h"
 #include "TclThreadManager.h"
-#include "SpecialConfig.h"
 
 namespace orxonox
 {
@@ -101,14 +102,18 @@
 
     Tcl::interpreter* TclBind::createTclInterpreter()
     {
+        Tcl::interpreter* interpreter;
 #ifdef DEPENDENCY_PACKAGE_ENABLE
-        Tcl::interpreter* interpreter = new Tcl::interpreter(ORXONOX_TCL_LIBRARY_PATH);
+        if (true)//Core::isDevelopmentRun())
+            interpreter = new Tcl::interpreter(std::string(ORXONOX_DEP_LIB_PATH) + "/tcl");
+        else
+            interpreter = new Tcl::interpreter(Core::getRootPathString() + "lib/tcl");
 #else
-        Tcl::interpreter* interpreter = new Tcl::interpreter();
+        interpreter = new Tcl::interpreter();
 #endif
         try
         {
-            interpreter->eval("source " + TclBind::getInstance().tclDataPath_ + "/init.tcl");
+            interpreter->eval("source \"" + TclBind::getInstance().tclDataPath_ + "/init.tcl\"");
         }
         catch (Tcl::tcl_error const &e)
         {   COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl;   }




More information about the Orxonox-commit mailing list