More Windows patches. trunk
authorRyan C. Gordon <icculus@icculus.org>
Wed, 30 Apr 2008 01:22:45 -0400
branchtrunk
changeset 254 13184ff204b9
parent 253 6717d8bffa79
child 255 796394130035
More Windows patches.
CMakeLists.txt
finderrors.c
mojoshader_opengl.c
testparse.c
--- a/CMakeLists.txt	Tue Apr 29 20:46:43 2008 -0400
+++ b/CMakeLists.txt	Wed Apr 30 01:22:45 2008 -0400
@@ -8,6 +8,11 @@
 # testparse uses this when I'm looking at memory usage patterns.
 #ADD_DEFINITIONS(-DMOJOSHADER_DEBUG_MALLOC=1)
 
+IF(MSVC)
+    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
+    ADD_DEFINITIONS(-TP)  # force .c files to compile as C++.
+ENDIF(MSVC)
+
 FIND_PACKAGE(SDL)
 IF(SDL_FOUND)
     INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
--- a/finderrors.c	Tue Apr 29 20:46:43 2008 -0400
+++ b/finderrors.c	Wed Apr 30 01:22:45 2008 -0400
@@ -24,6 +24,10 @@
 #include "SDL.h"
 #endif
 
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
 #define report printf
 
 static int do_dir(const char *dname, const char *profile)
--- a/mojoshader_opengl.c	Tue Apr 29 20:46:43 2008 -0400
+++ b/mojoshader_opengl.c	Wed Apr 30 01:22:45 2008 -0400
@@ -13,6 +13,11 @@
 #include <stdarg.h>
 #include <assert.h>
 
+#ifdef _MSC_VER
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>  // GL headers need this for WINGDIAPI definition.
+#endif
+
 #include "mojoshader.h"
 #define GL_GLEXT_LEGACY 1
 #include "GL/gl.h"
--- a/testparse.c	Tue Apr 29 20:46:43 2008 -0400
+++ b/testparse.c	Wed Apr 30 01:22:45 2008 -0400
@@ -11,6 +11,9 @@
 #include <stdlib.h>
 #include "mojoshader.h"
 
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
 
 #if MOJOSHADER_DEBUG_MALLOC
 static void *Malloc(int len)