Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2710 for code/trunk/src/util


Ignore:
Timestamp:
Feb 28, 2009, 7:46:37 PM (16 years ago)
Author:
rgrieder
Message:

Merged buildsystem3 containing buildsystem2 containing Adi's buildsystem branch back to the trunk.
Please update the media directory if you were not using buildsystem3 before.

Location:
code/trunk
Files:
2 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util

  • code/trunk/src/util/CMakeLists.txt

    r2295 r2710  
    1 SET(UTIL_SRC_FILES
     1 #
     2 #             ORXONOX - the hottest 3D action shooter ever to exist
     3 #                             > www.orxonox.net <
     4 #
     5 #        This program is free software; you can redistribute it and/or
     6 #         modify it under the terms of the GNU General Public License
     7 #        as published by the Free Software Foundation; either version 2
     8 #            of the License, or (at your option) any later version.
     9 #
     10 #       This program is distributed in the hope that it will be useful,
     11 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 #                 GNU General Public License for more details.
     14 #
     15 #   You should have received a copy of the GNU General Public License along
     16 #      with this program; if not, write to the Free Software Foundation,
     17 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     18 #
     19
     20SET_SOURCE_FILES(UTIL_FILES
     21  CRC32.h
     22  Clipboard.h
     23  Convert.h
     24  Debug.h
     25  Exception.h
     26  ExprParser.h
     27  Math.h
     28  MathConvert.h
     29  MultiType.h
     30  MultiTypeValue.h
     31  OutputBuffer.h
     32  OutputHandler.h
     33  SignalHandler.h
     34  Sleep.h
     35  String.h
     36  SubString.h
     37  UtilPrereqs.h
     38  mbool.h
     39
    240  Clipboard.cc
    341  CRC32.cc
     
    1250  SubString.cc
    1351)
     52#GET_ALL_HEADER_FILES(UTIL_HDR_FILES)
     53#SET(UTIL_FILES ${UTIL_SRC_FILES} ${UTIL_HDR_FILES})
     54GENERATE_SOURCE_GROUPS(${UTIL_FILES})
     55# Also add OrxonoxConfig to have it least somewhere in the IDE
     56LIST(APPEND UTIL_FILES
     57  ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
     58  ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
     59  ${CMAKE_BINARY_DIR}/src/SpecialConfig.h
     60  ${CMAKE_SOURCE_DIR}/src/SpecialConfig.h.in
     61)
     62SOURCE_GROUP("" FILES
     63  ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
     64  ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
     65  ${CMAKE_BINARY_DIR}/src/SpecialConfig.h
     66  ${CMAKE_SOURCE_DIR}/src/SpecialConfig.h.in
     67)
    1468
    15 ADD_LIBRARY(util SHARED ${UTIL_SRC_FILES})
     69IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
     70  # Get around displaying a few hundred lines of warning code
     71  SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w")
     72ENDIF()
    1673
    17 TARGET_LINK_LIBRARIES(util
    18   ${OGRE_LIBRARIES}
    19 )
     74ADD_LIBRARY(util SHARED ${UTIL_FILES})
     75SET_TARGET_PROPERTIES(util PROPERTIES DEFINE_SYMBOL "UTIL_SHARED_BUILD")
     76TARGET_LINK_LIBRARIES(util ${OGRE_LIBRARY})
     77
     78ORXONOX_INSTALL(util)
  • code/trunk/src/util/CRC32.h

    r2171 r2710  
    3232#include "UtilPrereqs.h"
    3333#include <iostream>
    34 #include "Integers.h"
    3534
    3635namespace orxonox
  • code/trunk/src/util/Clipboard.cc

    r2171 r2710  
    3636#include "Clipboard.h"
    3737
    38 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     38#ifdef ORXONOX_PLATFORM_WINDOWS
    3939
    4040/////////////
     
    104104}
    105105
    106 #else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
     106#else /* ORXONOX_PLATFORM_WINDOWS */
    107107
    108108/////////////
     
    135135}
    136136
    137 #endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
     137#endif /* ORXONOX_PLATFORM_WINDOWS */
  • code/trunk/src/util/Convert.h

    r2662 r2710  
    5050// This is however exactly what convertValue does, so we need to suppress these warnings.
    5151// They only occur when using the ImplicitConversion template.
    52 #if ORXONOX_COMPILER == ORXONOX_COMPILER_GNUC
     52#ifdef ORXONOX_COMPILER_GCC
    5353#  pragma GCC system_header
    5454#endif
     
    6363
    6464// disable warnings about possible loss of data
    65 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     65#ifdef ORXONOX_COMPILER_MSVC
    6666#  pragma warning(push)
    6767#  pragma warning(disable:4244)
     
    8888}
    8989
    90 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     90#ifdef ORXONOX_COMPILER_MSVC
    9191#  pragma warning(pop)
    9292#endif
  • code/trunk/src/util/Exception.cc

  • code/trunk/src/util/Exception.h

  • code/trunk/src/util/Math.h

    r2662 r2710  
    5252
    5353//Get around Windows hackery
    54 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     54#ifdef ORXONOX_PLATFORM_WINDOWS
    5555#  ifdef max
    5656#    undef max
  • code/trunk/src/util/OutputBuffer.cc

    r2171 r2710  
    6868    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
    6969    {
    70                 this->stream_ << manipulator;
    71                 this->callListeners();
    72                 return *this;
     70        this->stream_ << manipulator;
     71        this->callListeners();
     72        return *this;
    7373    }
    7474
     
    7979    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
    8080    {
    81                 this->stream_ << manipulator;
    82                 this->callListeners();
    83                 return *this;
     81        this->stream_ << manipulator;
     82        this->callListeners();
     83        return *this;
    8484    }
    8585
     
    9090    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
    9191    {
    92                 this->stream_ << manipulator;
    93                 this->callListeners();
    94                 return *this;
     92        this->stream_ << manipulator;
     93        this->callListeners();
     94        return *this;
    9595    }
    9696
  • code/trunk/src/util/OutputHandler.cc

    r2662 r2710  
    3333
    3434#include "OutputHandler.h"
    35 #include <time.h>
     35
     36#include <ctime>
     37#include <cstdlib>
    3638
    3739namespace orxonox
     
    4143        @param logfilename The name of the logfile
    4244    */
    43     OutputHandler::OutputHandler(const std::string& logfilename)
    44     {
     45    OutputHandler::OutputHandler()
     46    {
     47#ifdef ORXONOX_PLATFORM_WINDOWS
     48        char* pTempDir = getenv("TEMP");
     49        this->logfilename_ = std::string(pTempDir) + "/orxonox.log";
     50#else
     51        this->logfilename_ = "/tmp/orxonox.log";
     52#endif
     53#ifdef NDEBUG
     54        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 2;
     55        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 1;
     56#else
     57        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 3;
     58        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 2;
     59#endif
     60
    4561        this->outputBuffer_ = &this->fallbackBuffer_;
    46         this->softDebugLevel_[0] = this->softDebugLevel_[1] = this->softDebugLevel_[2] = this->softDebugLevel_[3] = 2;
    47         this->logfilename_ = logfilename;
    4862        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
    4963
     
    5367        timeinfo = localtime(&rawtime);
    5468
    55         this->logfile_ << "Started log at " << asctime(timeinfo) << std::endl;
     69        this->logfile_ << "Started log on " << asctime(timeinfo) << std::endl;
    5670        this->logfile_.flush();
    5771    }
     
    7286    OutputHandler& OutputHandler::getOutStream()
    7387    {
    74         static OutputHandler orxout("orxonox.log");
     88        static OutputHandler orxout;
    7589        return orxout;
    7690    }
     
    112126
    113127    /**
     128        @brief Sets the path where to create orxonox.log
     129        @param Path string with trailing slash
     130    */
     131    void OutputHandler::setLogPath(const std::string& path)
     132    {
     133        OutputHandler::getOutStream().logfile_.close();
     134        // store old content
     135        std::ifstream old;
     136        old.open(OutputHandler::getOutStream().logfilename_.c_str());
     137        OutputHandler::getOutStream().logfilename_ = path + "orxonox.log";
     138        OutputHandler::getOutStream().logfile_.open(OutputHandler::getOutStream().logfilename_.c_str(), std::fstream::out);
     139        OutputHandler::getOutStream().logfile_ << old.rdbuf();
     140        old.close();
     141        OutputHandler::getOutStream().logfile_.flush();
     142    }
     143
     144    /**
    114145        @brief Overloaded << operator, redirects the output to the console and the logfile.
    115146        @param sb The streambuffer that should be shown in the console
  • code/trunk/src/util/OutputHandler.h

    r2662 r2710  
    101101            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
    102102
     103            static void setLogPath(const std::string& path);
     104
    103105            void setOutputBuffer(OutputBuffer* buffer);
    104106
     
    142144
    143145        private:
    144             explicit OutputHandler(const std::string& logfilename);
    145             OutputHandler(const OutputHandler& oh);  // don't copy
     146            explicit OutputHandler();
     147            OutputHandler(const OutputHandler& oh);
    146148            virtual ~OutputHandler();
    147149
  • code/trunk/src/util/SignalHandler.cc

    r2662 r2710  
    4444}
    4545
    46 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
     46#ifdef ORXONOX_PLATFORM_LINUX
    4747
    4848#include <wait.h>
     
    159159      }
    160160
    161       COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox.log" << std::endl;
     161      COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox_crash.log" << std::endl;
    162162
    163163      int sigPipe[2];
     
    353353}
    354354
    355 #endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
     355#endif /* ORXONOX_PLATFORM_LINUX */
  • code/trunk/src/util/SignalHandler.h

    r2662 r2710  
    4646}
    4747
    48 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
     48#ifdef ORXONOX_PLATFORM_LINUX
    4949#include <signal.h>
    5050
     
    9797}
    9898
    99 #else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
     99#else /* ORXONOX_PLATFORM_LINUX */
    100100
    101101namespace orxonox
     
    116116}
    117117
    118 #endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
     118#endif /* ORXONOX_PLATFORM_LINUX */
    119119
    120120#endif /* _SignalHandler_H__ */
  • code/trunk/src/util/Sleep.h

    r2171 r2710  
    3636#define _Sleep_H__
    3737
    38 #include "OrxonoxPlatform.h"
     38#include "UtilPrereqs.h"
    3939
    40 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     40#ifdef ORXONOX_PLATFORM_WINDOWS
    4141#include <winbase.h>
    4242
  • code/trunk/src/util/UtilPrereqs.h

    r2171 r2710  
    3535#define _UtilPrereqs_H__
    3636
    37 #include "util/OrxonoxPlatform.h"
     37#include "OrxonoxConfig.h"
    3838
    3939//-----------------------------------------------------------------------
    4040// Shared library settings
    4141//-----------------------------------------------------------------------
    42 #if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( UTIL_STATIC_BUILD )
     42#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD )
    4343#  ifdef UTIL_SHARED_BUILD
    4444#    define _UtilExport __declspec(dllexport)
Note: See TracChangeset for help on using the changeset viewer.