From 745168fb2b47aef9b7fc70e52828a3b2aed321af Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 30 Apr 2008 01:22:45 -0400 Subject: [PATCH] More Windows patches. --HG-- branch : trunk --- CMakeLists.txt | 5 +++++ finderrors.c | 4 ++++ mojoshader_opengl.c | 5 +++++ testparse.c | 3 +++ 4 files changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b58002e..74ef1b1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,11 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC) # 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}) diff --git a/finderrors.c b/finderrors.c index 12e6d69f..cbe8896d 100644 --- a/finderrors.c +++ b/finderrors.c @@ -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) diff --git a/mojoshader_opengl.c b/mojoshader_opengl.c index 3f7be5ef..3cc9ab75 100644 --- a/mojoshader_opengl.c +++ b/mojoshader_opengl.c @@ -13,6 +13,11 @@ #include #include +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN 1 +#include // GL headers need this for WINGDIAPI definition. +#endif + #include "mojoshader.h" #define GL_GLEXT_LEGACY 1 #include "GL/gl.h" diff --git a/testparse.c b/testparse.c index f063a0c6..c6de92df 100644 --- a/testparse.c +++ b/testparse.c @@ -11,6 +11,9 @@ #include #include "mojoshader.h" +#ifdef _MSC_VER +#define snprintf _snprintf +#endif #if MOJOSHADER_DEBUG_MALLOC static void *Malloc(int len)