Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5613 for code


Ignore:
Timestamp:
Aug 10, 2009, 4:44:05 PM (15 years ago)
Author:
landauf
Message:

replaced the old orxonox executable with an orxonox library. linked that library into the new orxonox executable which only contains one file (Orxonox.cc).

Location:
code/branches/libraries
Files:
2 added
4 edited

Legend:

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

    r3371 r5613  
    4444 #      PCH_FILE:          Precompiled header file
    4545 #      PCH_EXCLUDE:       Source files to be excluded from PCH support
     46 #      OUTPUT_NAME:       If you want a different name than the target name
    4647 #  Note:
    4748 #    This function also installs the target!
     
    7778                  PCH_NO_DEFAULT NO_INSTALL)
    7879  SET(_list_names LINK_LIBRARIES  VERSION   SOURCE_FILES  DEFINE_SYMBOL
    79                   TOLUA_FILES     PCH_FILE  PCH_EXCLUDE)
     80                  TOLUA_FILES     PCH_FILE  PCH_EXCLUDE OUTPUT_NAME)
    8081  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
    8182
     
    168169  ENDIF()
    169170
     171  # OUTPUT_NAME
     172  IF(_arg_OUTPUT_NAME )
     173    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES OUTPUT_NAME  ${_arg_OUTPUT_NAME})
     174  ENDIF()
     175
    170176  # Second part of precompiled header files
    171177  IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE)
  • code/branches/libraries/src/orxonox/CMakeLists.txt

    r3370 r5613  
    3737ENDIF()
    3838
    39 ORXONOX_ADD_EXECUTABLE(orxonox
     39ORXONOX_ADD_LIBRARY(orxonox
    4040  FIND_HEADER_FILES
    4141  TOLUA_FILES
     
    4545    objects/quest/QuestDescription.h
    4646    objects/quest/QuestManager.h
     47  DEFINE_SYMBOL
     48    "ORXONOX_SHARED_BUILD"
    4749  PCH_FILE
    4850    OrxonoxPrecompiledHeaders.h
    49   # When defined as WIN32 this removes the console window on Windows
    50   ${ORXONOX_WIN32}
    5151  LINK_LIBRARIES
    5252    ${Boost_FILESYSTEM_LIBRARY}
     
    6969)
    7070
    71 GET_TARGET_PROPERTY(_exec_loc orxonox LOCATION)
     71ORXONOX_ADD_EXECUTABLE(orxonox-main
     72  FIND_HEADER_FILES
     73  # When defined as WIN32 this removes the console window on Windows
     74  ${ORXONOX_WIN32}
     75  LINK_LIBRARIES
     76    orxonox
     77  SOURCE_FILES
     78    Orxonox.cc
     79  OUTPUT_NAME orxonox
     80)
     81
     82GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
    7283GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
    7384SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
  • code/branches/libraries/src/orxonox/Main.cc

    r3370 r5613  
    2727 *
    2828 */
    29  
     29
    3030/**
    3131@file
    3232@brief
    33     Entry point of the program.
     33    The main function of Orxonox.
    3434*/
    3535
     
    3737#include "SpecialConfig.h"
    3838
    39 #ifdef ORXONOX_USE_WINMAIN
    40 # ifndef WIN32_LEAN_AND_MEAN
    41 #  define WIN32_LEAN_AND_MEAN
    42 # endif
    43 #include <windows.h>
    44 #endif
    45 
    46 #include "util/Debug.h"
    4739#include "util/Exception.h"
    4840#include "core/CommandLine.h"
    4941#include "core/Game.h"
     42#include "Main.h"
    5043
    5144SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
     
    5649SetCommandLineSwitch(standalone).information("Start in standalone mode");
    5750
    58 /*
    59 @brief
    60     Main method. Game starts here (except for static initialisations).
    61 */
    62 #ifdef ORXONOX_USE_WINMAIN
    63 INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
    64 #else
    65 int main(int argc, char** argv)
    66 #endif
     51namespace orxonox
    6752{
    68     using namespace orxonox;
    69 
    70     Game* game = 0;
    71     try
     53    /**
     54    @brief
     55        Main method. Game starts here (except for static initialisations).
     56    */
     57    int main(const std::string& strCmdLine)
    7258    {
    73 #ifndef ORXONOX_USE_WINMAIN
    74         std::string strCmdLine;
    75         for (int i = 1; i < argc; ++i)
    76             strCmdLine += argv[i] + std::string(" ");
    77 #endif
    78         game = new Game(strCmdLine);
     59        Game* game = new Game(strCmdLine);
    7960
    8061        game->setStateHierarchy(
     
    10889        else
    10990            Game::getInstance().requestStates("graphics, mainMenu");
     91
     92        game->run();
     93        delete game;
     94
     95        return 0;
    11096    }
    111     catch (const std::exception& ex)
    112     {
    113         COUT(0) << "Orxonox failed to initialise: " << ex.what() << std::endl;
    114         COUT(0) << "Terminating program." << std::endl;
    115         return 1;
    116     }
    117     catch (...)
    118     {
    119         COUT(0) << "Orxonox failed to initialise: " << std::endl;
    120         COUT(0) << "Terminating program." << std::endl;
    121         return 1;
    122     }
    123 
    124     game->run();
    125     delete game;
    126 
    127     return 0;
    12897}
  • code/branches/libraries/src/orxonox/OrxonoxPrereqs.h

    r3370 r5613  
    4040// Shared library settings
    4141//-----------------------------------------------------------------------
    42 #define ORXONOX_NO_EXPORTS // This is an executable that needs no exports
    43 #if defined(ORXONOX_PLATFORM_WINDOWS) && !(defined(ORXONOX_STATIC_BUILD) || defined(ORXONOX_NO_EXPORTS))
     42#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
    4443#  ifdef ORXONOX_SHARED_BUILD
    4544#    define _OrxonoxExport __declspec(dllexport)
Note: See TracChangeset for help on using the changeset viewer.