Commits

Sylvain Rouquette committed c7519cc

updated waf
various fixes to build with msvc2010

Comments (0)

Files changed (14)

 @echo off
 if exist .target (
-    for /f %%i in (.target) do set WAFLOCK=%%i
+    for /f %%i in (.target) do (
+        set TARGET=%%i
+        set WAFLOCK=.lock-waf%%i
+    )
 )
-python waf build %* --target=%WAFLOCK%
+python waf build %* --target=%TARGET%
 @echo off
 if exist .target (
-    for /f %%i in (.target) do set WAFLOCK=%%i
+    for /f %%i in (.target) do (
+        set TARGET=%%i
+        set WAFLOCK=.lock-waf%%i
+    )
 )
-python waf clean %* --target=%WAFLOCK%
+python waf clean %* --target=%TARGET%

game/configure.bat

 @echo off
 if exist .target (
-    for /f %%i in (.target) do set WAFLOCK=%%i
+    for /f %%i in (.target) do (
+        set TARGET=%%i
+        set WAFLOCK=.lock-waf%%i
+    )
 )
-python waf configure %* --target=%WAFLOCK%
+python waf configure %* --target=%TARGET%

game/inc/common/list.h

 #include <stddef.h>
 
 
+#define INTRUSIVE_LIST(T, node)       common::ListDeclare<T, offsetof(T, node)>()
+
+
 namespace common {
 
 
 
 
 template <class T>
-ListNode<T>::ListNode() : prev_(this), next_(this)
-{}
+ListNode<T>::ListNode() {
+    prev_ = this;
+    next_ = this;
+}
 
 
 template <class T>

game/inc/io/settings.h

     Settings();
     virtual ~Settings();
 
-    int set_file(const char* filename) { filename_ = filename; }
+    int set_file(const char* filename) { filename_ = filename; return 0; }
     virtual int read() = 0;
     virtual int write() = 0;
 

game/inc/state/state_state.h

     virtual void enter() {}
     virtual void leave() {}
 
-    virtual int translate(input::CommandManager* command) {}
+    virtual int translate(input::CommandManager* command) { return 0; }
     virtual void update(unsigned int) = 0;
     virtual void render(renderer::Renderer* renderer) const = 0;
 

game/src/game/input/settings_commands.cpp

 
 int SettingsCommands::read()
 {
-
+    return 0;
 }
 
 
 int SettingsCommands::write()
 {
+    return 0;
+}
+
+
 
 }
-
-
-
-}

game/src/main/main_win32.cpp

 #include <windows.h>
 
-#include "common/list.h"
 #include "game/game_win32.h"
 #include "game/game_loop_sample.h"
 #include "common/log.h"
 
-class Test {
-    public:
-    common::ListNode<Test>  node_;
-};
+//#include "common/list.h"
+//class Test {
+//    public:
+//    common::ListNode<Test>  node_;
+//};
 
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
     LPSTR lpCmdLine, int nCmdShow)
 #endif
     LOG("starting game...");
 
-    Test* test = new Test();
-    common::List<Test>* list_test = new common::ListDeclare<Test, offsetof(Test, node_)>();
-    list_test->push_back(test);
-    delete test;
-    delete list_test;
+    //Test* test = new Test();
+    //common::List<Test>* list_test = new INTRUSIVE_LIST(Test, node_);
+    //list_test->push_back(test);
+    //delete test;
+    //delete list_test;
 
     //game::GameLoopSample game_loop;
     //game::GameWin32 *game;

game/src/platform/win32/display.cpp

     int prev_mode_width = 0, prev_mode_height = 0;
     int num_modes = 0;
 
-    short sel_modes[max_modes];
+    short* sel_modes = new short [max_modes];
 
     memset(&mode_info, 0, sizeof(mode_info));
     mode_info.dmSize = sizeof(::DEVMODE);
         video_modes_[i].height,
         video_modes_[i].rate);
     }
+    delete [] sel_modes;
 }
 
 

game/src/platform/win32/window_win32.cpp

         ::TranslateMessage(&msg);
         ::DispatchMessage(&msg);
     }
+    return 0;
 }
 
 

game/src/renderer/opengl/renderer_opengl.cpp

 #include "renderer/opengl/renderer_opengl.h"
 
+#ifdef WIN32
+#include <windows.h>
+#endif
 #include <GL/gl.h>
 
 

game/tools/config.py

     },
     'linux_x64': {
         'languages': 'fr gb jp tw'.split(),
-        'padding': 512,
+        'padding': 4,
         'm64': True,
         'big_endian': False,
         'zip_module': 'zlib',
         'zip_level': 9,
         'platform': 'x11',
-        'libs': 'X11 Xrandr GL rt config'.split(),
+        'libs': 'X11 Xrandr GL rt config z'.split(),
     },
     'windows_x86': {
         'languages': 'fr gb jp tw'.split(),
-        'padding': 512,
+        'padding': 4,
         'm64': False,
         'big_endian': False,
         'zip_module': 'zlib',
         'zip_level': 9,
         'platform': 'win32',
-        'libs': 'config gdi32 opengl32'.split(),
+        'libs': 'user32 gdi32 opengl32 zlibstat libconfig'.split(),
     }
 }
 

game/waf

Binary file modified.
     config.configure(conf)
 
     if conf.options.zip == 'zlib':
-        conf.env.STLIB_ZIP = 'z'
         conf.env.INCLUDES_ZIP = '../../libs/zlib'
+        #conf.env.STLIBPATH_ZIP = '../../../libs/zlib'
         conf.env.STLIBPATH_ZIP = '../../../libs/zlib'
     elif conf.options.zip == 'lzma':
         conf.env.STLIB_ZIP = 'lzma'
     conf.define('COMPRESSION_%s' % conf.options.zip.upper(), 1)
     conf.define('COMPRESSION_LIB', conf.options.zip)
 
-    conf.env.STLIB_LIBCONFIG = 'config++'
     conf.env.INCLUDES_LIBCONFIG = '../../libs/libconfig/lib'
-    conf.env.STLIBPATH_LIBCONFIG = '../../../libs/libconfig/lib/.libs'
+    conf.env.STLIBPATH_LIBCONFIG = '../../../libs/libconfig/Release'
+    #conf.env.STLIBPATH_LIBCONFIG = '../../../libs/libconfig/lib/.libs'
 
     conf.env.STLIB_YAML = 'yaml-cpp'
     conf.env.INCLUDES_YAML = '../../libs/yaml-cpp/include'
 
     if conf.env.COMPILER_CXX == 'msvc':
         conf.define('MSVC', 1)
-        conf.env.cxxflags = ['/EHsc']
-        conf.env.linkflags = []
+        conf.env.cxxflags = ['/EHsc', '/DWIN32']
+        conf.env.linkflags = ['%s.lib' % lib for lib in conf.env.libs]
+        conf.env.linkflags.append('/NODEFAULTLIB:LIBCMT');
         if conf.options.debug:
-            conf.env.cxxflags.extend(('/Z7', '/O2'))
+            conf.env.cxxflags.extend(('/Z7', '/O2', '/DDEBUG'))
             conf.env.linkflags.append('/Debug')
     else:
-        conf.env.cxxflags = ['-m64' if conf.env.m64 else '-m32']
+        conf.env.cxxflags = ['-mwindows', '-m64' if conf.env.m64 else '-m32']
         conf.env.linkflags = conf.env.cxxflags
         if conf.options.debug:
             conf.env.cxxflags.extend(('-g', '-DDEBUG'))
+        conf.env.linkflags.extend('-l%s' % lib for lib in conf.env.libs)
 
     if conf.options.debug:
         conf.env.cxxflags.append('-DDEBUG')
 
     if Utils.unversioned_sys_platform() == 'win32':
-        conf.env.cxxflags.extend(('-mwindows',
-                                  '-DWINVER=0x0601',
+        conf.env.cxxflags.extend(('-DWINVER=0x0601',
                                   '-D_WIN32_WINNT=0x0601'))
 
     if conf.options.warning:
         #conf.env.cxxflags.append('-Wdouble-promotion')
         conf.env.cxxflags.extend(('-Wall', '-Wextra', '-Weffc++', '-pedantic'))
 
-    conf.env.linkflags.extend('-l%s' % lib for lib in conf.env['libs'])
-
 
 def build(bld):
     Options.lockfile = '.lock-waf%s' % bld.env.target
                                          src/renderer/**/*.cpp
                                          src/state/**/*.cpp
                                          src/text/**/*.cpp
-                                         ''' % \
-                                         {'platform': bld.env.platform}),
+                                         ''' % {'platform': bld.env.platform}),
                 includes=['inc', '%s/res/inc' % bld.env.target],
                 cxxflags=bld.env.cxxflags,
                 linkflags=bld.env.linkflags,
-                target='game', use='ZIP LIBCONFIG YAML')
+                target='game', use='ZIP LIBCONFIG')