Changeset 12

Show
Ignore:
Timestamp:
12/29/09 00:22:48 (2 years ago)
Author:
nktug
Message:

Update code for Linux compatibility with OPENAL, PLSM and OGRENEWT
Add checking librairies but compilation is not tested

Location:
trunk
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r3 r12  
    3333 
    3434        PathOption('prefix_xerces', 'xerces-c prefix', default_path, PathOption.PathIsDir), 
    35  
     35        PathOption('prefix_log', 'DFLog prefix', default_path, PathOption.PathIsDir), 
    3636        PathOption('prefix_boost', 'boost-c prefix', default_path, PathOption.PathIsDir), 
    3737        ('boost_version', 'Boost version used', '1.37.0'), 
    38  
     38        PathOption('prefix_openal', 'OPENAL prefix', default_path, PathOption.PathIsDir), 
    3939        PathOption('prefix_ogre', 'OGRE prefix', default_path, PathOption.PathIsDir), 
    40         PathOption('prefix_openal', 'OPENAL prefix', default_path, PathOption.PathIsDir) 
     40        PathOption('prefix_qt', 'QT prefix', default_path, PathOption.PathIsDir) 
    4141) 
    4242 
     
    4545#------------------------------------ 
    4646 
    47 env = Environment(ENV=os.environ, options=opt, tools = ['default', 'revision', 'version', 'custom_tests', 'writeConfigH', 'qt'], toolpath = ['scons']) 
     47if sys.platform == 'win32': 
     48  env = Environment(ENV=os.environ, options=opt, tools = ['default', 'revision', 'version', 'custom_tests', 'writeConfigH', 'qt'], toolpath = ['scons']) 
     49else: 
     50  env = Environment(ENV=os.environ, options=opt, tools = ['default', 'revision', 'version', 'custom_tests', 'writeConfigH'], toolpath = ['scons']) 
    4851 
    4952# 
     
    9699 
    97100if sys.platform == 'win32': 
    98         bin_install_dir  = top_install_dir 
    99         lib_install_dir  = top_install_dir 
    100         data_install_dir = os.path.join(top_install_dir, 'share') 
    101  
    102 else: 
    103         bin_install_dir  = os.path.join(top_install_dir, 'bin') 
    104         lib_install_dir  = os.path.join(top_install_dir, 'lib') 
    105         data_install_dir = os.path.join(top_install_dir, 'share', 'gameforge') 
     101  bin_install_dir  = top_install_dir 
     102  lib_install_dir  = top_install_dir 
     103  data_install_dir = '../data/' 
     104  log_install_dir = '../log/' 
     105else: 
     106  bin_install_dir  = os.path.join(top_install_dir, 'bin') 
     107  lib_install_dir  = top_install_dir 
     108  data_install_dir = '../data/' 
     109  log_install_dir = '../log/' 
     110 
     111#if sys.platform == 'win32': 
     112#       bin_install_dir  = top_install_dir 
     113#       lib_install_dir  = top_install_dir 
     114#       data_install_dir = os.path.join(top_install_dir, 'share') 
     115#else: 
     116#       bin_install_dir  = os.path.join(top_install_dir, 'bin') 
     117#       lib_install_dir  = os.path.join(top_install_dir, 'lib') 
     118#       data_install_dir = os.path.join(top_install_dir, 'share', 'gameforge') 
    106119 
    107120#------------------------------------ 
     
    114127        "#/include", 
    115128        env["build"], 
    116         os.path.join(env['prefix_xerces'], 'include'),  
    117         os.path.join(env['prefix_boost'], 'include'),  
    118         os.path.join(env['prefix_ogre'], 'include', 'OGRE'),  
    119         os.path.join(env['prefix_openal'], 'include', 'AL') 
     129        os.path.join(env['prefix_xerces'], 'include'), 
     130        os.path.join(env['prefix_log'], 'include'),  
     131        os.path.join(env['prefix_ogre'], 'include', 'OGRE'), 
     132        os.path.join(env['prefix_openal'], 'include', 'AL') 
    120133] 
    121134 
    122135lib_path = [ 
    123         os.path.join(env['prefix_xerces'], 'lib'),  
    124         os.path.join(env['prefix_boost'], 'lib'),  
     136        os.path.join(env['prefix_xerces'], 'lib'), 
    125137        os.path.join(env['prefix_ogre'], 'lib'),  
    126         os.path.join(env['prefix_openal'], 'lib') 
     138        os.path.join(env['prefix_openal'], 'lib'), 
     139        os.path.join(env['prefix_qt'], 'lib') 
    127140] 
     141 
     142if sys.platform == 'win32': 
     143  env.AppendUnique(CPPPATH = [os.path.join(env['prefix_boost'], 'include', 'boost'),  
     144                              os.path.join(env['prefix_qt'], 'include', 'qt4')]) 
     145 
     146#env.AppendUnique(CPPPATH = [os.path.join(env['prefix_newton'], 'include', 'NEWTON')]) 
     147##env.AppendUnique(LIBPATH = [os.path.join(env['prefix_newton'], 'lib')])   
     148else: 
     149  env.AppendUnique(CPPPATH = [os.path.join(env['prefix_boost'], 'include', 'boost-1_37'),  
     150                              os.path.join(env['prefix_qt'], 'include')]) 
     151#env.AppendUnique(CPPPATH = [env['prefix_newton']]) 
     152#env.AppendUnique(LIBPATH = [env['prefix_newton']]) 
    128153 
    129154for path in cpp_path: 
     
    153178        print "'%s' isn't a compiler supported !"%CXX 
    154179        Exit(1) 
     180 
     181# 
     182## Do not display deprecated messsage 
     183env.Append(CXXFLAGS = ['-Wno-deprecated']) 
     184 
    155185#------------------------------------ 
    156186# Platform 
     
    172202# 
    173203# Qt defines and envionnment 
    174 env.Append(CPPDEFINES = ['QT_DLL', 'QT_NO_DEBUG', 'QT_GUI_LIB', 'QT_CORE_LIB', 'QT_THREAD_SUPPORT']) 
    175  
    176 env['QT_LIB'] = 'qtmain' 
     204 
     205if sys.platform == 'win32': 
     206  env.Append(CPPDEFINES = ['QT_DLL', 'QT_NO_DEBUG', 'QT_GUI_LIB', 'QT_CORE_LIB', 'QT_THREAD_SUPPORT']) 
     207  env['QT_LIB'] = 'qtmain' 
     208else: 
     209  env.Append(CPPDEFINES = ['QT_NO_DEBUG', 'QT_GUI_LIB', 'QT_CORE_LIB', 'QT_THREAD_SUPPORT', 'QT_SHARED']) 
     210 
    177211env['QT_AUTOSCAN'] = 1 
    178 env['MOC_DIR'] = '.moc' 
    179 env['RCC_DIR'] = '.rcc' 
    180 env['UI_DIR'] = '.ui' 
    181 env['RESOURCES'] = 'application.qrc' 
     212#env['MOC_DIR'] = '*.moc' 
     213#env['RCC_DIR'] = '*.rcc' 
     214#env['UI_DIR'] = '*.ui' 
     215#env['RESOURCES'] = 'application.qrc' 
     216 
     217#env['QTDIR'] = '/usr/local/Trolltech/QtEmbedded-4.4.3-generic' 
     218 
    182219# 
    183220# 
     
    187224# 
    188225# Check QT lib name 
    189 for hd in ['QtCore4', 'QtGui4']:#, 'QtUiTools', 'Qt3Support4', 'QtDesigner4', 'QtHelp4', 'QtDesignerComponents4']: 
    190   if not conf.CheckLibWithHeader(hd, 'QtGui/QApplication', 'c++', 'QApplication qapp();'): 
    191     print "Not found Qt4 library" 
    192     Exit(1) 
    193  
    194 #for hd in ['al.h', 'alc.h', 'alut.h']: 
    195 #       if not conf.CheckCXXHeader(hd): 
    196 #               print "Did not find OpenAL header '%s' !"%hd 
    197 #               Exit(1) 
    198  
    199 #for hd in ['al.h', 'alc.h', 'alut.h']:    
    200 #               if conf.CheckLib(lib, language="C++"): 
    201 #                       found = True 
    202 #                       break        
    203      
     226 
     227if sys.platform == 'win32': 
     228  qt_header = ['QtCore4', 'QtGui4', 'QtUiTools', 'Qt3Support4', 'QtDesigner4', 'QtHelp4', 'QtDesignerComponents4'] 
     229else: 
     230  qt_header = ['QtCore', 'QtGui', 'QtUiTools', 'Qt3Support', 'QtDesigner', 'QtHelp', 'QtDesignerComponents'] 
     231 
     232for hd in qt_header: 
     233   if not conf.CheckLibWithHeader(hd, 'QtGui/QApplication', 'c++', 'QApplication qapp();'): 
     234      print "Not found Qt4 library" 
     235      Exit(1) 
     236 
    204237# 
    205238# Check Xerces lib name 
     
    243276  boost_compiler = ('vc', 'vc90') 
    244277else: 
    245   boost_compiler = ('gcc', 'gcc41') 
     278  boost_compiler = ('gcc', 'gcc43') 
    246279 
    247280boost_version = env['boost_version'].replace('.', '_').replace('_0', '') 
     
    331364        os.path.join('src','SConscript'), 
    332365        exports=['env', 'top_dir', 'bin_install_dir', 'lib_install_dir', 'data_install_dir'], 
    333         build_dir=os.path.join(env['build'], 'src'), 
     366        build_dir=os.path.join(env['build'], 'src'),  
    334367        duplicate=0) 
    335368 
  • trunk/include/dreamforge/GameSerializer.hh

    r4 r12  
    1919# define __GAME_SERIALIZER_HH__ 
    2020 
    21 #include        <xercesc/util/Xerces_autoconf_config.hpp> 
     21#if (OGRE_PLATFORM  == OGRE_PLATFORM_WIN32) 
     22  #include      <xercesc/util/Xerces_autoconf_config.hpp> 
     23#endif 
     24 
    2225#include        <xercesc/sax2/Attributes.hpp> 
    2326   
  • trunk/src/LevelEditor.cc

    r11 r12  
    1717 
    1818#if (OGRE_PLATFORM  == OGRE_PLATFORM_LINUX) 
    19   #include <QX11Info> 
     19  #include <QtGui/QX11Info> 
    2020#endif 
    2121//#include <OGRE/OgreStringConverter.h> 
     
    107107 
    108108//------------------------------------------------------------------------------------------------  
    109 void LevelEdWidget::saveObjectToFile(std::string& savefile) 
     109void LevelEdWidget::saveObjectToFile(const std::string& savefile) 
    110110{ 
    111111  CSaveFile::getInstance()->setFileName(savefile); 
     
    123123 
    124124//------------------------------------------------------------------------------------------------  
    125 void LevelEdWidget::loadObjectFromFile(std::string& loadfile) 
     125void LevelEdWidget::loadObjectFromFile(const std::string& loadfile) 
    126126{ 
    127127        // Destroy all object loaded in game 
     
    417417 
    418418//------------------------------------------------------------------------------------------------  
    419 void LevelEdWidget::createTempObject(std::string& name, std::string& file, std::string& type) 
     419void LevelEdWidget::createTempObject(const std::string& name, const std::string& file, const std::string& type) 
    420420{ 
    421421  mName = name; 
  • trunk/src/LevelEditor.hh

    r10 r12  
    2929    ~LevelEdWidget(void); 
    3030     
    31     void createTempObject(std::string& name, std::string& file, std::string& type); 
     31    void createTempObject(const std::string& name, const std::string& file, const std::string& type); 
    3232    void changeInsertionMode(bool val); 
    33     void saveObjectToFile(std::string& savefile); 
    34     void loadObjectFromFile(std::string& loadfile);   
     33    void saveObjectToFile(const std::string& savefile); 
     34    void loadObjectFromFile(const std::string& loadfile);   
    3535     
    3636    inline Ogre::Root* getRoot(void) { return mRoot; } 
  • trunk/src/ObjectEditor.cc

    r10 r12  
    1010 
    1111#if (OGRE_PLATFORM  == OGRE_PLATFORM_LINUX) 
    12   #include <QX11Info> 
     12  #include <QtGui/QX11Info> 
    1313#endif 
    1414 
  • trunk/src/Properties.hh

    r10 r12  
    2020    public: 
    2121      SelectedObjProp(QWidget *parent = 0); 
    22       ~SelectedObjProp(); 
     22      virtual ~SelectedObjProp(); 
    2323       
    2424      QTreeView* objectView; 
     
    5353    public: 
    5454      ObjEdProp(QWidget *parent = 0); 
    55       ~ObjEdProp(); 
     55      virtual ~ObjEdProp(); 
    5656 
    5757      // CARACTERITICS 
     
    9595    public: 
    9696      ResourcesProp(QWidget *parent = 0); 
    97       ~ResourcesProp(); 
     97      virtual ~ResourcesProp(); 
    9898     
    9999    protected: 
  • trunk/src/SConscript

    r10 r12  
    2929bin_game_env.AppendUnique(LIBS="libDFLog") 
    3030bin_game_env.AppendUnique(LIBPATH=["../../../../freequest/trunk/build/src"]) 
    31 bin = bin_game_env.Program("dreamforge", bin_files) 
     31 
     32bin = bin_game_env.Program("dforge", bin_files) 
    3233 
    3334# 
  • trunk/src/Workbench.cc

    r10 r12  
    11 
    22#ifdef HAVE_CONFIG_HH 
    3 #include "config.h" 
     3  #include "config.h" 
    44#endif 
    55 
    66// use for object global variables 
    7 #define GLOBAL   
    8  
     7#define GLOBAL 
    98 
    109#include <QtCore/QDir> 
    11 //#include <QVBoxLayout> 
    12 //#include <QFrame> 
     10// #include <QVBoxLayout> 
     11// #include <QFrame> 
    1312 
    1413#include "Workbench.hh" 
    15  
    1614 
    1715using namespace dreamforge; 
  • trunk/src/Workbench.hh

    r10 r12  
    1 #ifndef __WORKBENCH_HH__ 
    2  #define __WORKBENCH_HH__ 
    3   
     1#ifndef __WORKBENCH_HH__ 
     2  #define __WORKBENCH_HH__ 
     3 
    44#include <QtGui/QMainWindow> 
    55#include <QtGui/QtGui> 
    6  
    76 
    87#include "LevelEditor.hh" 
     
    1514namespace dreamforge  
    1615{  
    17   
     16 
    1817 /*** 
    1918   Our Workbench which represente the Qt MainWindow. 
     
    7473 }; 
    7574 
    76 }// namespace dreamforge   
    77   
    78  #endif 
     75}// namespace dreamforge  
     76 
     77#endif 
     78 
     79 
  • trunk/src/dreamforge/GameObjectManager.cc

    r8 r12  
    7474        { 
    7575                obj->destroy(); 
    76     mObjectList.erase(it); 
     76    mObjectList.erase(it->first); 
    7777        }        
    7878} 
  • trunk/src/treemodel.cpp

    r4 r12  
    4343using namespace dreamforge; 
    4444 
    45 //! [0] 
     45 
    4646TreeModel::TreeModel(const QStringList &headers, const QString &data, 
    4747                     QObject *parent) 
     
    5555    setupModelData(data.split(QString("\n")), rootItem); 
    5656} 
    57 //! [0] 
    58  
    59 //! [1] 
     57 
    6058TreeModel::~TreeModel() 
    6159{ 
    6260    delete rootItem; 
    6361} 
    64 //! [1] 
    65  
    66 //! [2] 
     62 
    6763int TreeModel::columnCount(const QModelIndex &parent) const 
    6864{ 
    6965    return rootItem->columnCount(); 
    7066} 
    71 //! [2] 
    7267 
    7368QVariant TreeModel::data(const QModelIndex &index, int role) const 
     
    8479} 
    8580 
    86 //! [3] 
    8781Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const 
    8882{ 
     
    9286    return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; 
    9387} 
    94 //! [3] 
    95  
    96 //! [4] 
     88 
    9789TreeItem *TreeModel::getItem(const QModelIndex &index) const 
    9890{ 
     
    10395    return rootItem; 
    10496} 
    105 //! [4] 
    10697 
    10798QVariant TreeModel::headerData(int section, Qt::Orientation orientation, 
     
    114105} 
    115106 
    116 //! [5] 
    117107QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const 
    118108{ 
    119109    if (parent.isValid() && parent.column() != 0) 
    120110        return QModelIndex(); 
    121 //! [5] 
    122  
    123 //! [6] 
     111 
    124112    TreeItem *parentItem = getItem(parent); 
    125113 
     
    130118        return QModelIndex(); 
    131119} 
    132 //! [6] 
    133120 
    134121bool TreeModel::insertColumns(int position, int columns, const QModelIndex &parent) 
     
    155142} 
    156143 
    157 //! [7] 
    158144QModelIndex TreeModel::parent(const QModelIndex &index) const 
    159145{ 
     
    169155    return createIndex(parentItem->childNumber(), 0, parentItem); 
    170156} 
    171 //! [7] 
    172157 
    173158bool TreeModel::removeColumns(int position, int columns, const QModelIndex &parent) 
     
    197182} 
    198183 
    199 //! [8] 
    200184int TreeModel::rowCount(const QModelIndex &parent) const 
    201185{ 
     
    204188    return parentItem->childCount(); 
    205189} 
    206 //! [8] 
    207190 
    208191bool TreeModel::setData(const QModelIndex &index, const QVariant &value, 
     
    286269    } 
    287270} 
     271 
     272#include "treemodel.moc" 
  • trunk/src/treemodel.h

    r4 r12  
    4343#include <QtCore/QVariant> 
    4444 
    45  
    4645namespace dreamforge  
    4746{ 
    4847   
    4948class TreeItem;   
    50 //! [0] 
     49 
    5150class TreeModel : public QAbstractItemModel 
    5251{ 
     
    5453 
    5554public: 
    56     TreeModel(const QStringList &headers, const QString &data, 
    57               QObject *parent = 0); 
    58     ~TreeModel(); 
    59 //! [0] //! [1] 
     55    TreeModel(const QStringList &headers, const QString &data, QObject *parent = 0); 
     56    virtual ~TreeModel( void ); 
    6057 
    6158    QVariant data(const QModelIndex &index, int role) const; 
     
    6966    int rowCount(const QModelIndex &parent = QModelIndex()) const; 
    7067    int columnCount(const QModelIndex &parent = QModelIndex()) const; 
    71 //! [1] 
    7268 
    73 //! [2] 
    7469    Qt::ItemFlags flags(const QModelIndex &index) const; 
    7570    bool setData(const QModelIndex &index, const QVariant &value, 
     
    9388    TreeItem *rootItem; 
    9489}; 
    95 //! [2] 
    9690 
    9791}