Browse Source

Fixed MinGW build.

Lasse Öörni 14 years ago
parent
commit
1840d21d6f

+ 2 - 2
CMakeLists.txt

@@ -51,7 +51,7 @@ else ()
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -m32")
     set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
     set (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
-endif ()
+endif ()
 
 # Macro for precompiled headers
 macro (enable_pch)
@@ -73,7 +73,7 @@ macro (finalize_exe)
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different $(TARGETDIR)$(TARGETNAME).pdb ${PROJECT_BINARY_DIR}/Bin)
     else ()
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND strip ARGS ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}${CMAKE_EXECUTABLE_SUFFIX})
-    endif ()
+    endif ()
 endmacro ()
 
 # Macro for lib finalization

+ 1 - 1
Engine/Container/Swap.h

@@ -41,4 +41,4 @@ template<> void Swap<String>(String& first, String& second);
 template<> void Swap<VectorBase>(VectorBase& first, VectorBase& second);
 template<> void Swap<ListBase>(ListBase& first, ListBase& second);
 template<> void Swap<TreeBase>(TreeBase& first, TreeBase& second);
-template<> void Swap<HashBase>(HashBase& first, HashBase& second);
+template<> void Swap<HashBase>(HashBase& first, HashBase& second);

+ 3 - 3
Engine/Core/ProcessUtils.cpp

@@ -27,12 +27,12 @@
 
 #include <cstdio>
 #include <fcntl.h>
-#include <time.h>
 
 #ifdef WIN32
 #include <Windows.h>
-#else
-#include <unistd.h>
+#include <io.h>
+#else
+#include <unistd.h>
 #endif
 
 #ifdef USE_SDL

+ 30 - 30
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -54,30 +54,30 @@
 
 #ifdef _MSC_VER
 #include <float.h>
-#else
-// From http://stereopsis.com/FPU.html
-
-#define FPU_CW_PREC_MASK        0x0300
-#define FPU_CW_PREC_SINGLE      0x0000
-#define FPU_CW_PREC_DOUBLE      0x0200
-#define FPU_CW_PREC_EXTENDED    0x0300
-#define FPU_CW_ROUND_MASK       0x0c00
-#define FPU_CW_ROUND_NEAR       0x0000
-#define FPU_CW_ROUND_DOWN       0x0400
-#define FPU_CW_ROUND_UP         0x0800
-#define FPU_CW_ROUND_CHOP       0x0c00
-
-inline unsigned GetFPUState()
-{
-    unsigned control = 0;
-    __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
-    return control;
-}
-
-inline void SetFPUState(unsigned control)
-{
-    __asm__ __volatile__ ("fldcw %0" : : "m" (control));
-}
+#else
+// From http://stereopsis.com/FPU.html
+
+#define FPU_CW_PREC_MASK        0x0300
+#define FPU_CW_PREC_SINGLE      0x0000
+#define FPU_CW_PREC_DOUBLE      0x0200
+#define FPU_CW_PREC_EXTENDED    0x0300
+#define FPU_CW_ROUND_MASK       0x0c00
+#define FPU_CW_ROUND_NEAR       0x0000
+#define FPU_CW_ROUND_DOWN       0x0400
+#define FPU_CW_ROUND_UP         0x0800
+#define FPU_CW_ROUND_CHOP       0x0c00
+
+inline unsigned GetFPUState()
+{
+    unsigned control = 0;
+    __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
+    return control;
+}
+
+inline void SetFPUState(unsigned control)
+{
+    __asm__ __volatile__ ("fldcw %0" : : "m" (control));
+}
 #endif
 
 #include "DebugNew.h"
@@ -243,14 +243,14 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
         }
     }
     
-    // Mimic Direct3D way of setting FPU into round-to-nearest, single precision mode
+    // Mimic Direct3D way of setting FPU into round-to-nearest, single precision mode
     // This is actually needed for ODE to behave predictably in float mode
     #ifdef _MSC_VER
-    _controlfp(_RC_NEAR | _PC_24, _MCW_RC | _MCW_PC);
-    #else
-    unsigned control = GetFPUState();
-    control &= ~(FPU_CW_PREC_MASK | FPU_CW_ROUND_MASK);
-    control |= (FPU_CW_PREC_SINGLE | FPU_CW_ROUND_NEAR);
+    _controlfp(_RC_NEAR | _PC_24, _MCW_RC | _MCW_PC);
+    #else
+    unsigned control = GetFPUState();
+    control &= ~(FPU_CW_PREC_MASK | FPU_CW_ROUND_MASK);
+    control |= (FPU_CW_PREC_SINGLE | FPU_CW_ROUND_NEAR);
     SetFPUState(control);
     #endif
     

+ 1 - 1
Engine/Graphics/OpenGL/OGLGraphicsImpl.h

@@ -26,7 +26,7 @@
 #include "Color.h"
 #include "Map.h"
 
-#include <GLee.h>
+#include <GLee.h>
 #include <SDL.h>
 
 /// Graphics implementation

+ 1 - 1
Engine/Graphics/RenderSurface.h

@@ -27,4 +27,4 @@
 #include "OpenGL/OGLRenderSurface.h"
 #else
 #include "Direct3D9/D3D9RenderSurface.h"
-#endif
+#endif

+ 7 - 7
Engine/IO/FileSystem.cpp

@@ -32,19 +32,19 @@
 
 #ifdef WIN32
 #include <Windows.h>
-#include <Shellapi.h>
+#include <Shellapi.h>
 #include <direct.h>
 #include <process.h>
 // Enable SHGetSpecialFolderPath on MinGW
 #ifndef _MSC_VER
-#define _WIN32_IE 0x0400st
+#define _WIN32_IE 0x0400
 #endif
 #include <Shlobj.h>
-#else
-#include <dirent.h>
+#else
+#include <dirent.h>
 #include <errno.h>
 #include <unistd.h>
-#include <sys/stat.h>
+#include <sys/stat.h>
 #define MAX_PATH 256
 #endif
 
@@ -120,7 +120,7 @@ int FileSystem::SystemCommand(const String& commandLine)
 }
 
 int FileSystem::SystemRun(const String& fileName, const Vector<String>& arguments)
-{
+{
     #ifdef WIN32
     if (allowedPaths_.Empty())
     {
@@ -138,7 +138,7 @@ int FileSystem::SystemRun(const String& fileName, const Vector<String>& argument
     {
         LOGERROR("Executing an external command is not allowed");
         return -1;
-    }
+    }
     #else
     /// \todo Implement on Unix-like systems
     LOGERROR("SystemRun not implemented");

+ 1 - 1
Engine/Physics/PhysicsDefs.h

@@ -40,4 +40,4 @@ typedef struct dxGeom* dGeomID;
 typedef struct dxJoint* dJointID;
 typedef struct dxJointGroup* dJointGroupID;
 typedef struct dxTriMeshData* dTriMeshDataID;
-typedef struct dxHeightfieldData* dHeightfieldDataID;
+typedef struct dxHeightfieldData* dHeightfieldDataID;

+ 1 - 1
Engine/Physics/PhysicsWorld.h

@@ -229,4 +229,4 @@ private:
 };
 
 /// Register Physics library objects
-void RegisterPhysicsLibrary(Context* context);
+void RegisterPhysicsLibrary(Context* context);

+ 3 - 3
Readme.txt

@@ -77,11 +77,11 @@ Urho3D uses cmake (http://www.cmake.org) to build. The process has two steps:
 1) Run cmake in the root directory with your preferred toolchain specified to
 generate the build files. Visual Studio 2008/2010 and MinGW have been tested.
 You can use the batch files provided (cmake_vs2008.bat, cmake_vs2010.bat and
-cmake_gcc.bat.)
+cmake_mingw.bat.)
 
 2) For Visual Studio, open Urho3D.sln and build the configuration(s) you like.
-For MinGW, execute make (by default, cmake_gcc.bat specifies to make a Release
-build.)
+For MinGW, execute make (by default, cmake_mingw.bat specifies to make a 
+Release build.)
 
 The build process will also compile models and shaders from the Source_Asset
 directory into Bin/Data/Models & Bin/Data/Shaders. Shader compilation requires

+ 3 - 3
Tools/OgreImporter/OgreImporter.cpp

@@ -132,7 +132,7 @@ void LoadSkeleton(const String& skeletonFileName)
     XMLElement skeletonRoot;
     File skeletonFileSource(context_);
     skeletonFileSource.Open(skeletonFileName);
-    if (!skelFile_->Load(skeletonFileSource))
+    if (!skelFile_->Load(skeletonFileSource))
         PrintLine("Failed to load skeleton " + skeletonFileName);
     skeletonRoot = skelFile_->GetRootElement();
     
@@ -415,12 +415,12 @@ void LoadMesh(const String& inputFileName, bool generateTangents, bool splitSubM
         subGeometryLodLevel.indexCount_ = indices;
         if (vertexStart + vertices > 65535)
             iBuf->indexSize_ = sizeof(unsigned);
-        
+        
         XMLElement boneAssignments = subMesh.GetChildElement("boneassignments");
         if (bones_.Size())
         {
             if (boneAssignments)
-            {
+            {
                 XMLElement boneAssignment = boneAssignments.GetChildElement("vertexboneassignment");
                 while (boneAssignment)
                 {

+ 1 - 1
cmake_gcc.sh

@@ -1 +1 @@
-cmake -G "Unix Makefiles"
+cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release