Browse Source

Merge pull request #4 from progranism/master

MinGW Compatibility
Lloyd Weehuizen 14 years ago
parent
commit
5847bf4690

+ 0 - 0
Dependencies/empty.txt


+ 5 - 1
Include/Rocket/Core/Debug.h

@@ -32,7 +32,11 @@
 
 
 // Define for breakpointing.
 // Define for breakpointing.
 #if defined (ROCKET_PLATFORM_WIN32)
 #if defined (ROCKET_PLATFORM_WIN32)
-#define ROCKET_BREAK _asm { int 0x03 }
+	#if defined (__MINGW32__)
+		#define ROCKET_BREAK asm("int $0x03")
+	#else
+		#define ROCKET_BREAK _asm { int 0x03 }
+	#endif
 #elif defined (ROCKET_PLATFORM_LINUX)
 #elif defined (ROCKET_PLATFORM_LINUX)
 #define ROCKET_BREAK asm ("int $0x03" )
 #define ROCKET_BREAK asm ("int $0x03" )
 #elif defined (ROCKET_PLATFORM_MACOSX)
 #elif defined (ROCKET_PLATFORM_MACOSX)

+ 4 - 2
Include/Rocket/Core/Platform.h

@@ -31,7 +31,9 @@
 #if defined __WIN32__ || defined _WIN32
 #if defined __WIN32__ || defined _WIN32
 	#define ROCKET_PLATFORM_WIN32
 	#define ROCKET_PLATFORM_WIN32
 	#define ROCKET_PLATFORM_NAME "win32"
 	#define ROCKET_PLATFORM_NAME "win32"
-    #pragma warning(disable:4355)
+	#if !defined(__MINGW32__)
+		#pragma warning(disable:4355)
+	#endif
 #elif defined __APPLE_CC__
 #elif defined __APPLE_CC__
 	#define ROCKET_PLATFORM_UNIX
 	#define ROCKET_PLATFORM_UNIX
 	#define ROCKET_PLATFORM_MACOSX
 	#define ROCKET_PLATFORM_MACOSX
@@ -53,7 +55,7 @@
 #endif
 #endif
 
 
 
 
-#if defined ROCKET_PLATFORM_WIN32
+#if defined(ROCKET_PLATFORM_WIN32) && !defined(__MINGW32__)
 	// alignment of a member was sensitive to packing
 	// alignment of a member was sensitive to packing
 	#pragma warning(disable : 4121)
 	#pragma warning(disable : 4121)
 
 

+ 2 - 1
Source/Controls/Clipboard.cpp

@@ -107,7 +107,8 @@ void Clipboard::Set(const Core::WString& _content)
 		_content.ToUTF8(win32_content);
 		_content.ToUTF8(win32_content);
 
 
 		HGLOBAL clipboard_data = GlobalAlloc(GMEM_FIXED, win32_content.Length() + 1);
 		HGLOBAL clipboard_data = GlobalAlloc(GMEM_FIXED, win32_content.Length() + 1);
-		strcpy_s((char*) clipboard_data, win32_content.Length() + 1, win32_content.CString());
+		// Replaced strcpy_s with a simple strcpy, because we know for sure it's big enough.
+		strcpy((char*) clipboard_data, win32_content.CString());
 
 
 		if (SetClipboardData(CF_TEXT, clipboard_data) == NULL)
 		if (SetClipboardData(CF_TEXT, clipboard_data) == NULL)
 		{
 		{

+ 1 - 1
Source/Core/Math.cpp

@@ -144,7 +144,7 @@ ROCKETCORE_API int RoundDown(float value)
 // Efficiently truncates a floating-point value into an integer.
 // Efficiently truncates a floating-point value into an integer.
 ROCKETCORE_API int RealToInteger(float value)
 ROCKETCORE_API int RealToInteger(float value)
 {
 {
-#if defined ROCKET_PLATFORM_WIN32
+#if defined(ROCKET_PLATFORM_WIN32) && !defined(__MINGW32__)
 	int i;
 	int i;
 	_asm
 	_asm
 	{
 	{

+ 26 - 0
how_to_build_for_mingw.txt

@@ -0,0 +1,26 @@
+Download FreeType. Get the Binaries package:
+	http://gnuwin32.sourceforge.net/packages/freetype.htm
+Direct link:
+	http://gnuwin32.sourceforge.net/downlinks/freetype-bin-zip.php
+	
+Extract to Dependencies\freetype
+
+Go into the Build folder and run:
+
+	cmake -G "MinGW Makefiles" -D CMAKE_MAKE_PROGRAM="C:\MinGW\bin\make.exe" -D FREETYPE_INCLUDE_DIRS="..\Dependencies\freetype\include;..\Dependencies\freetype\include\freetype2" -D FREETYPE_LIBRARY="..\Dependencies\freetype\lib\libfreetype.dll.a" .
+
+N.B. ** REPLACE C:\MinGW\bin\make.exe with the path to your MinGW make.exe file. **
+
+
+Once cmake completes successfully, run make
+
+	make
+
+
+The project will compile and three libraries will be generated in the Build folder:
+	libRocket.dll.a
+	libRocketControls.dll.a
+	libRocketDebugger.dll.a
+
+
+Done!