浏览代码

Added fixes for compiling with MinGW.

Lasse Öörni 13 年之前
父节点
当前提交
7c7e63f4ff

+ 2 - 0
Docs/GettingStarted.dox

@@ -36,6 +36,8 @@ Urho3D uses CMake (http://www.cmake.org) to build. The process has two steps:
 
 
 2) For Visual Studio, open Urho3D.sln and build the configuration(s) you like. For gcc, execute make (by default, cmake_gcc.sh specifies to make a RelWithDebInfo build.)
 2) For Visual Studio, open Urho3D.sln and build the configuration(s) you like. For gcc, execute make (by default, cmake_gcc.sh specifies to make a RelWithDebInfo build.)
 
 
+On Windows, using other compilers than Visual Studio is not officially supported. MinGW may work (cmake -G "MinGW Makefiles"), but may lack required DirectX headers. They can be copied to a MinGW installation from the following package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
+
 When using Xcode on Mac OS X, select the i386 architecture before building. Compiling Urho3D as 64-bit is not supported.
 When using Xcode on Mac OS X, select the i386 architecture before building. Compiling Urho3D as 64-bit is not supported.
 
 
 After the build is complete, the programs can be run from the Bin directory.
 After the build is complete, the programs can be run from the Bin directory.

+ 9 - 0
Engine/Container/Str.h

@@ -96,6 +96,15 @@ public:
         SetUTF8FromWChar(str);
         SetUTF8FromWChar(str);
     }
     }
     
     
+    /// Construct from a null-terminated wide character array.
+    String(wchar_t* str) :
+        length_(0),
+        capacity_(0),
+        buffer_(&endZero)
+    {
+        SetUTF8FromWChar(str);
+    }
+    
     /// Construct from a wide character string.
     /// Construct from a wide character string.
     String(const WString& str);
     String(const WString& str);
     
     

+ 2 - 0
Engine/Core/Main.h

@@ -28,8 +28,10 @@
 #ifdef WIN32
 #ifdef WIN32
 #include "MiniDump.h"
 #include "MiniDump.h"
 #include <windows.h>
 #include <windows.h>
+#ifdef _MSC_VER
 #include <crtdbg.h>
 #include <crtdbg.h>
 #endif
 #endif
+#endif
 
 
 using namespace Urho3D;
 using namespace Urho3D;
 
 

+ 2 - 1
Engine/Core/MiniDump.h

@@ -23,12 +23,13 @@
 
 
 #pragma once
 #pragma once
 
 
-#if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
+#if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
 /// Write a minidump. Needs to be called from within a structured exception handler.
 /// Write a minidump. Needs to be called from within a structured exception handler.
 int WriteMiniDump(const char* applicationName, void* exceptionPointers);
 int WriteMiniDump(const char* applicationName, void* exceptionPointers);
 #endif
 #endif
 
 
 }
 }
+

+ 3 - 0
Engine/IO/FileSystem.cpp

@@ -32,6 +32,9 @@
 #include <cstring>
 #include <cstring>
 
 
 #ifdef WIN32
 #ifdef WIN32
+#ifndef _MSC_VER
+#define _WIN32_IE 0x400
+#endif
 #include <windows.h>
 #include <windows.h>
 #include <shellapi.h>
 #include <shellapi.h>
 #include <direct.h>
 #include <direct.h>

+ 6 - 1
Readme.txt

@@ -131,6 +131,11 @@ Mac OS X.
 For gcc, execute make (by default, cmake_gcc.sh specifies to make a
 For gcc, execute make (by default, cmake_gcc.sh specifies to make a
 RelWithDebInfo build.)
 RelWithDebInfo build.)
 
 
+On Windows, using other compilers than Visual Studio is not officially
+supported. MinGW may work (cmake -G "MinGW Makefiles"), but may lack required
+DirectX headers. They can be copied to a MinGW installation from the following 
+package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
+
 When using Xcode on Mac OS X, select the i386 architecture before building.
 When using Xcode on Mac OS X, select the i386 architecture before building.
 Compiling Urho3D as 64-bit is not supported.
 Compiling Urho3D as 64-bit is not supported.
 
 
@@ -147,7 +152,7 @@ To actually make Urho3D.exe do something useful, it must be supplied with the
 name of the script file it should load and run. You can try for example the
 name of the script file it should load and run. You can try for example the
 following arguments: Scripts/NinjaSnowWar.as -w
 following arguments: Scripts/NinjaSnowWar.as -w
 
 
-To make the Urho3D examples start faster on Windows & Direct3D9 mode, run 
+To make the Urho3D examples start faster on Windows & Direct3D9 mode, run
 CompileAllShaders.bat from the Bin directory first.
 CompileAllShaders.bat from the Bin directory first.
 
 
 
 

+ 8 - 0
ThirdParty/SDL/src/thread/windows/win_ce_semaphore.c

@@ -28,10 +28,16 @@
       and it is not clear how to handle a mixture of WCE semaphores and normal
       and it is not clear how to handle a mixture of WCE semaphores and normal
       events and mutexes.
       events and mutexes.
 */
 */
+
+// Modified by Lasse Öörni for Urho3D
+
 #include "SDL_config.h"
 #include "SDL_config.h"
 
 
 #if SDL_THREAD_WINDOWS
 #if SDL_THREAD_WINDOWS
 
 
+// Urho3D: disable code when not actually on WCE
+#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
+
 #include "../../core/windows/SDL_windows.h"
 #include "../../core/windows/SDL_windows.h"
 
 
 #include "win_ce_semaphore.h"
 #include "win_ce_semaphore.h"
@@ -228,6 +234,8 @@ CleanUp(SYNCHHANDLE hSynch, DWORD Flags)
     return hSynch;
     return hSynch;
 }
 }
 
 
+#endif
+
 #endif /* SDL_THREAD_WINDOWS */
 #endif /* SDL_THREAD_WINDOWS */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */